diff --git a/backend/src/worker_flow.rs b/backend/src/worker_flow.rs index 8a21e9770b..4a6597ecef 100644 --- a/backend/src/worker_flow.rs +++ b/backend/src/worker_flow.rs @@ -283,10 +283,11 @@ pub async fn update_flow_status_in_progress( let step = get_step_of_flow_status(db, flow).await?; sqlx::query(&format!( "UPDATE queue - SET flow_status = jsonb_set(flow_status, '{{modules, {step}, job}}', $1) - WHERE id = $2 AND workspace_id = $3", + SET flow_status = jsonb_set(jsonb_set(flow_status, '{{modules, {step}, job}}', $1), '{{modules, {step}, type}}', $2) + WHERE id = $3 AND workspace_id = $4", )) .bind(json!(job_in_progress.to_string())) + .bind(json!("InProgress")) .bind(flow) .bind(w_id) .execute(db) diff --git a/frontend/src/lib/components/FlowStatusViewer.svelte b/frontend/src/lib/components/FlowStatusViewer.svelte index 19ae3b0e4b..3a812088ae 100644 --- a/frontend/src/lib/components/FlowStatusViewer.svelte +++ b/frontend/src/lib/components/FlowStatusViewer.svelte @@ -5,19 +5,18 @@ import Icon from 'svelte-awesome' import { check } from 'svelte-awesome/icons' - import { CompletedJob, FlowStatusModule, JobService, QueuedJob } from '$lib/gen' + import { CompletedJob, FlowStatusModule, Job, JobService, QueuedJob } from '$lib/gen' import { workspaceStore } from '$lib/stores' import FlowJobResult from './FlowJobResult.svelte' import JobStatus from './JobStatus.svelte' export let job: QueuedJob | CompletedJob - export let jobs: (CompletedJob | CompletedJob[] | undefined)[] = [] + export let jobs: (Job | Job[] | undefined)[] = [] let lastJobid: string | undefined let forloop_selected = '' - let logs: { [key: number]: string } = {} let pres: { [key: number]: HTMLElement } = {} async function loadResults() { @@ -27,13 +26,12 @@ let i = mods?.findIndex((x) => x.type == FlowStatusModule.type.IN_PROGRESS) if (i != -1) { let last = mods[i] - if (last?.type == FlowStatusModule.type.IN_PROGRESS) { - logs[i] = - (await JobService.getJob({ workspace: $workspaceStore ?? '', id: last.job ?? '' })) - .logs ?? '' - logs = logs - pres[i].scroll({ top: pres[i]?.scrollHeight, behavior: 'smooth' }) - } + jobs[i] = await JobService.getJob({ + workspace: $workspaceStore ?? '', + id: last.job ?? '' + }) + jobs = jobs + pres[i].scroll({ top: pres[i]?.scrollHeight, behavior: 'smooth' }) } } } @@ -63,6 +61,10 @@ }) } + function toJob(x: any): Job { + return x as Job + } + function toCompletedJob(x: any): CompletedJob { return x as CompletedJob } @@ -99,6 +101,7 @@ {#each job?.raw_flow?.modules ?? [] as mod, i}
{logs[
- i
- ] ?? ''}
+ {:else if jobs[i]}
+
+ {toJob(
+ jobs[i]
+ ).logs ?? ''}
-
+