Skip to content

Commit f556795

Browse files
committed
address coderabbit comments, fix workflow id on popover
1 parent 2aa2be6 commit f556795

File tree

5 files changed

+26
-23
lines changed

5 files changed

+26
-23
lines changed

src/components/queue/job/JobDetailsPopover.stories.ts

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,16 +92,32 @@ function makeRunningTaskWithStart(
9292
function makeHistoryTask(
9393
id: string,
9494
priority: number,
95-
_durationSec: number,
95+
durationSec: number,
9696
ok: boolean,
9797
errorMessage?: string
9898
): TaskItemImpl {
9999
const now = Date.now()
100+
const executionEndTime = now
101+
const executionStartTime = now - durationSec * 1000
100102
return makeTask(id, priority, {
101103
status: ok ? 'completed' : 'failed',
102-
create_time: now,
104+
create_time: executionStartTime - 5000,
103105
update_time: now,
104-
error_message: errorMessage
106+
execution_start_time: executionStartTime,
107+
execution_end_time: executionEndTime,
108+
execution_error: errorMessage
109+
? {
110+
prompt_id: id,
111+
timestamp: now,
112+
node_id: '1',
113+
node_type: 'ExampleNode',
114+
exception_message: errorMessage,
115+
exception_type: 'RuntimeError',
116+
traceback: [],
117+
current_inputs: {},
118+
current_outputs: {}
119+
}
120+
: undefined
105121
})
106122
}
107123

src/components/queue/job/JobGroupsList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
v-for="ji in group.items"
1313
:key="ji.id"
1414
:job-id="ji.id"
15-
:workflow-id="ji.taskRef?.workflow?.id"
15+
:workflow-id="ji.taskRef?.workflowId"
1616
:state="ji.state"
1717
:title="ji.title"
1818
:right-text="ji.meta"

src/platform/remote/comfyui/jobs/types/jobTypes.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const zPreviewOutput = z
3636
*/
3737
const zExecutionError = z
3838
.object({
39+
prompt_id: z.string().optional(),
40+
timestamp: z.number().optional(),
3941
node_id: z.string(),
4042
node_type: z.string(),
4143
executed: z.array(z.string()).optional(),
@@ -61,20 +63,12 @@ const zRawJobListItem = z
6163
execution_end_time: z.number().nullable().optional(),
6264
preview_output: zPreviewOutput.nullable().optional(),
6365
outputs_count: z.number().optional(),
64-
error_message: z.string().nullable().optional(),
6566
execution_error: zExecutionError.nullable().optional(),
6667
workflow_id: z.string().nullable().optional(),
6768
priority: z.number().optional()
6869
})
6970
.passthrough()
7071

71-
/**
72-
* Job list item with priority always set (either from server or synthetic)
73-
*/
74-
const zJobListItem = zRawJobListItem.extend({
75-
priority: z.number() // Always set: server-provided or synthetic (total - offset - index)
76-
})
77-
7872
/**
7973
* Job detail - returned by GET /api/jobs/{job_id} (detail endpoint)
8074
* Includes full workflow and outputs for re-execution and downloads
@@ -117,5 +111,6 @@ export const zJobsListResponse = z
117111

118112
export type JobStatus = z.infer<typeof zJobStatus>
119113
export type RawJobListItem = z.infer<typeof zRawJobListItem>
120-
export type JobListItem = z.infer<typeof zJobListItem>
114+
/** Job list item with priority always set (server-provided or synthetic) */
115+
export type JobListItem = RawJobListItem & { priority: number }
121116
export type JobDetail = z.infer<typeof zJobDetail>

src/stores/queueStore.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ export class TaskItemImpl {
308308
* Error message if job failed
309309
*/
310310
get errorMessage(): string | undefined {
311-
return this.job.error_message ?? undefined
311+
return this.job.execution_error?.exception_message ?? undefined
312312
}
313313

314314
/**
@@ -484,15 +484,6 @@ export class TaskItemImpl {
484484
public toJob(): JobListItem {
485485
return this.job
486486
}
487-
488-
/**
489-
* Cancel this task (for queue items)
490-
*/
491-
public async cancel(): Promise<void> {
492-
if (this.taskType === 'Running' || this.taskType === 'Pending') {
493-
await api.interrupt(this.job.id)
494-
}
495-
}
496487
}
497488

498489
export const useQueueStore = defineStore('queue', () => {

tests-ui/tests/composables/useResultGallery.test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ describe('useResultGallery', () => {
154154
const loadedTask = new TaskItemImpl(job, {}, fullOutputs)
155155
task.loadFullOutputs = async () => loadedTask
156156

157+
// fetchApi presence triggers lazy loading when outputsCount > 1
157158
const mockFetchApi = async () => new Response()
158159

159160
const { galleryItems, galleryActiveIndex, onViewItem } = useResultGallery(

0 commit comments

Comments
 (0)