mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-20 06:20:11 +00:00
rename statuses, add aria label
This commit is contained in:
@@ -141,7 +141,7 @@ describe('WorkflowTab - job state indicator', () => {
|
||||
mockExecutionStore.clearWorkflowStatus.mockClear()
|
||||
})
|
||||
|
||||
it.for(['running', 'success', 'error'] as const)(
|
||||
it.for(['running', 'completed', 'failed'] as const)(
|
||||
'shows %s indicator from store',
|
||||
(status) => {
|
||||
mockExecutionStore.workflowStatus = new Map([
|
||||
@@ -167,7 +167,7 @@ describe('WorkflowTab - job state indicator', () => {
|
||||
|
||||
it('does not show job indicator on active tab', () => {
|
||||
mockExecutionStore.workflowStatus = new Map([
|
||||
['/workflows/test.json', 'success']
|
||||
['/workflows/test.json', 'completed']
|
||||
])
|
||||
|
||||
const wrapper = mountTab({ activeWorkflowKey: 'test-key' })
|
||||
@@ -189,7 +189,7 @@ describe('WorkflowTab - job state indicator', () => {
|
||||
|
||||
it('clears workflow status when tab becomes active', async () => {
|
||||
mockExecutionStore.workflowStatus = new Map([
|
||||
['/workflows/test.json', 'success']
|
||||
['/workflows/test.json', 'completed']
|
||||
])
|
||||
|
||||
const wrapper = mountTab()
|
||||
|
||||
@@ -23,17 +23,17 @@
|
||||
<div class="relative">
|
||||
<i
|
||||
v-if="jobState"
|
||||
aria-hidden="true"
|
||||
data-testid="job-state-indicator"
|
||||
:data-state="jobState"
|
||||
:aria-label="jobStateLabel"
|
||||
:class="
|
||||
cn(
|
||||
'absolute top-1/2 left-1/2 z-10 size-4 -translate-1/2 group-hover:hidden',
|
||||
jobState === 'running' &&
|
||||
'icon-[lucide--loader-circle] animate-spin text-muted-foreground',
|
||||
jobState === 'success' &&
|
||||
jobState === 'completed' &&
|
||||
'icon-[lucide--circle-check] text-success-background',
|
||||
jobState === 'error' &&
|
||||
jobState === 'failed' &&
|
||||
'icon-[lucide--octagon-alert] text-destructive-background'
|
||||
)
|
||||
"
|
||||
@@ -186,6 +186,16 @@ const jobState = computed(() => {
|
||||
return executionStore.workflowStatus.get(path) ?? null
|
||||
})
|
||||
|
||||
const jobStateLabelMap: Record<string, string> = {
|
||||
running: 'g.running',
|
||||
completed: 'g.completed',
|
||||
failed: 'g.failed'
|
||||
}
|
||||
|
||||
const jobStateLabel = computed(() =>
|
||||
jobState.value ? t(jobStateLabelMap[jobState.value]) : undefined
|
||||
)
|
||||
|
||||
watch(isActiveTab, (isActive) => {
|
||||
const path = props.workflowOption.workflow.path
|
||||
if (isActive && path) executionStore.clearWorkflowStatus(path)
|
||||
|
||||
@@ -511,27 +511,27 @@ describe('useExecutionStore - workflowStatus', () => {
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBeUndefined()
|
||||
})
|
||||
|
||||
it('sets success on execution_success', () => {
|
||||
it('sets completed on execution_success', () => {
|
||||
callStoreJob('job-1', '/workflows/a.json')
|
||||
fireExecutionStart('job-1')
|
||||
fireExecutionSuccess('job-1')
|
||||
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('success')
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('completed')
|
||||
})
|
||||
|
||||
it('sets error on execution_error', () => {
|
||||
it('sets failed on execution_error', () => {
|
||||
callStoreJob('job-1', '/workflows/a.json')
|
||||
fireExecutionStart('job-1')
|
||||
fireExecutionError('job-1')
|
||||
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('error')
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('failed')
|
||||
})
|
||||
|
||||
it('clearWorkflowStatus removes the entry', () => {
|
||||
callStoreJob('job-1', '/workflows/a.json')
|
||||
fireExecutionStart('job-1')
|
||||
fireExecutionSuccess('job-1')
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('success')
|
||||
expect(store.workflowStatus.get('/workflows/a.json')).toBe('completed')
|
||||
|
||||
store.clearWorkflowStatus('/workflows/a.json')
|
||||
expect(store.workflowStatus.has('/workflows/a.json')).toBe(false)
|
||||
|
||||
@@ -53,7 +53,7 @@ interface QueuedJob {
|
||||
*/
|
||||
export const MAX_PROGRESS_JOBS = 1000
|
||||
|
||||
export type WorkflowStatus = 'running' | 'success' | 'error'
|
||||
export type WorkflowStatus = 'running' | 'completed' | 'failed'
|
||||
|
||||
export const useExecutionStore = defineStore('execution', () => {
|
||||
const workflowStore = useWorkflowStore()
|
||||
@@ -294,7 +294,7 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
e: CustomEvent<ExecutionInterruptedWsMessage>
|
||||
) {
|
||||
const jobId = e.detail.prompt_id
|
||||
setWorkflowStatus(jobId, 'error')
|
||||
setWorkflowStatus(jobId, 'failed')
|
||||
if (activeJobId.value) clearInitializationByJobId(activeJobId.value)
|
||||
resetExecutionState(jobId)
|
||||
}
|
||||
@@ -311,7 +311,7 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
})
|
||||
}
|
||||
const jobId = e.detail.prompt_id
|
||||
setWorkflowStatus(jobId, 'success')
|
||||
setWorkflowStatus(jobId, 'completed')
|
||||
resetExecutionState(jobId)
|
||||
}
|
||||
|
||||
@@ -409,7 +409,7 @@ export const useExecutionStore = defineStore('execution', () => {
|
||||
}
|
||||
|
||||
function handleExecutionError(e: CustomEvent<ExecutionErrorWsMessage>) {
|
||||
setWorkflowStatus(e.detail.prompt_id, 'error')
|
||||
setWorkflowStatus(e.detail.prompt_id, 'failed')
|
||||
|
||||
if (isCloud) {
|
||||
useTelemetry()?.trackExecutionError({
|
||||
|
||||
Reference in New Issue
Block a user