diff --git a/frontend/src/lib/components/FlowStatusViewerInner.svelte b/frontend/src/lib/components/FlowStatusViewerInner.svelte index 4ae3aff676..0d7188ed7c 100644 --- a/frontend/src/lib/components/FlowStatusViewerInner.svelte +++ b/frontend/src/lib/components/FlowStatusViewerInner.svelte @@ -31,6 +31,7 @@ | { moduleId: string flowJobs: string[] + length: number } | undefined = undefined export let job: Job | undefined = undefined @@ -55,6 +56,15 @@ } } + if (flowJobIds) { + $durationStatuses[flowJobIds?.moduleId ?? ''] = { + ...($durationStatuses[flowJobIds?.moduleId ?? ''] ?? {}), + iteration_from: Math.max(flowJobIds.flowJobs.length - 20, 0), + iteration_total: flowJobIds?.length, + byJob: {} + } + } + function updateForloop(len: number) { forloop_selected = flowJobIds?.flowJobs[len - 1] ?? '' lastSize = len @@ -91,7 +101,6 @@ mod.type === FlowStatusModule.type.WAITING_FOR_EXECUTOR && $flowModuleStates[mod.id ?? '']?.scheduled_for == undefined ) { - console.debug('updating', mod.job) JobService.getJob({ workspace: workspaceId ?? $workspaceStore ?? '', id: mod.job ?? '' @@ -177,7 +186,7 @@ } } if ($durationStatuses[mod.id] == undefined) { - $durationStatuses[mod.id] = {} + $durationStatuses[mod.id] = { byJob: {} } } let started_at = job.started_at ? new Date(job.started_at).getTime() : undefined if (job.type == 'QueuedJob') { @@ -189,7 +198,7 @@ started_at, parent_module: mod['parent_module'] } - $durationStatuses[mod.id][job.id] = { + $durationStatuses[mod.id].byJob[job.id] = { created_at: job.created_at ? new Date(job.created_at).getTime() : undefined, started_at } @@ -203,10 +212,11 @@ parent_module: mod['parent_module'], duration_ms: job['duration_ms'], started_at: started_at, + iteration: mod.iterator?.itered?.length, iteration_total: mod.iterator?.itered?.length // retries: $flowStateStore?.raw_flow } - $durationStatuses[mod.id][job.id] = { + $durationStatuses[mod.id].byJob[job.id] = { created_at: job.created_at ? new Date(job.created_at).getTime() : undefined, started_at, duration_ms: job['duration_ms'] @@ -214,7 +224,6 @@ } } } - let showEmbeddeds = -20 let flowTimeline: FlowTimeline @@ -229,14 +238,23 @@
{/if} --> {#if isListJob} - {#if (flowJobIds?.flowJobs.length ?? 0) > 20} -

- For performance reasons, only the last 20 items are shown.

{/if} @@ -306,21 +324,29 @@ {/if}
{#if isListJob} + {@const lenToAdd = Math.min( + 20, + $durationStatuses[flowJobIds?.moduleId ?? '']?.iteration_from ?? 0 + )}

Embedded flows: ({flowJobIds?.flowJobs.length} items)

- {#if (flowJobIds?.flowJobs.length ?? 0) > 20} -

- For performance reasons, only the last 20 items are shown.

{/if} - {#each (flowJobIds?.flowJobs.length ?? 0) > 20 ? flowJobIds?.flowJobs?.slice(showEmbeddeds) ?? [] : flowJobIds?.flowJobs ?? [] as loopJobId, j} + {#each (flowJobIds?.flowJobs.length ?? 0) > 20 ? flowJobIds?.flowJobs?.slice($durationStatuses[flowJobIds?.moduleId ?? '']?.iteration_from ?? 0) ?? [] : flowJobIds?.flowJobs ?? [] as loopJobId, j (loopJobId)} {#if render} +
+ {/if} + +
+
{k}
+
+ {#if min && total} +
+ {#each items?.[k] ?? [] as b} + {@const waitingLen = b?.created_at + ? b.started_at + ? b.started_at - b?.created_at + : b.duration_ms + ? 0 + : now - b?.created_at + : 0} +
- {/if} -
- {/each} -
- {/if}
+ {#if b.started_at} + + {/if} +
+ {/each} + + {/if} + {/each} {:else} diff --git a/frontend/src/lib/components/graph/FlowGraph.svelte b/frontend/src/lib/components/graph/FlowGraph.svelte index 62d4d2bdf0..c73de49558 100644 --- a/frontend/src/lib/components/graph/FlowGraph.svelte +++ b/frontend/src/lib/components/graph/FlowGraph.svelte @@ -380,8 +380,11 @@ getParentIds(parent), module, undefined, - flowModuleStates?.[module.id]?.iteration_total - ? 'Iteration ' + flowModuleStates?.[module.id]?.iteration_total + flowModuleStates?.[module.id]?.iteration + ? 'Iteration ' + + flowModuleStates?.[module.id]?.iteration + + '/' + + (flowModuleStates?.[module.id]?.iteration_total ?? '?') : '', loopDepth, false, diff --git a/frontend/src/lib/components/graph/model.ts b/frontend/src/lib/components/graph/model.ts index cd18ce1c49..cb50203e9f 100644 --- a/frontend/src/lib/components/graph/model.ts +++ b/frontend/src/lib/components/graph/model.ts @@ -28,16 +28,25 @@ export type Branch = { export type GraphItem = Node | Loop | Branch export type GraphModuleStates = { - job_id: string, + job_id: string states: Record } export type FlowStatusViewerContext = { - flowStateStore?: Writable, + flowStateStore?: Writable flowModuleStates: Writable> retryStatus: Writable> - suspendStatus: Writable>, - durationStatuses: Writable>> + suspendStatus: Writable> + durationStatuses: Writable< + Record< + string, + { + iteration_from?: number + iteration_total?: number + byJob: Record + } + > + > } export type GraphModuleState = { type: FlowStatusModule.type @@ -47,6 +56,7 @@ export type GraphModuleState = { scheduled_for?: Date job_id?: string parent_module?: string + iteration?: number iteration_total?: number retries?: number duration_ms?: number