From 7c4f568a8fc03ef78d6491c7cbd0f7b80f6478cd Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 18 Aug 2023 01:32:19 +0200 Subject: [PATCH] update flow status even for flows --- backend/windmill-worker/src/worker.rs | 26 ++++++++++--------- .../lib/components/FlowStatusViewer.svelte | 6 ++--- frontend/src/lib/components/JobStatus.svelte | 2 +- .../apps/components/buttons/AppButton.svelte | 17 +++++++++++- .../components/progressBar/ProgressBar.svelte | 3 +++ 5 files changed, 37 insertions(+), 17 deletions(-) diff --git a/backend/windmill-worker/src/worker.rs b/backend/windmill-worker/src/worker.rs index f71a15a668..9ff6393a8b 100644 --- a/backend/windmill-worker/src/worker.rs +++ b/backend/windmill-worker/src/worker.rs @@ -1002,6 +1002,20 @@ async fn handle_queued_job( return Err(Error::ExecutionErr(e)); } + let (cache_ttl, step) = if job.is_flow_step { + update_flow_status_in_progress( + db, + &job.workspace_id, + job.parent_job + .ok_or_else(|| Error::InternalErr(format!("expected parent job")))?, + job.id, + ) + .await? + } else { + (None, None) + }; + + match job.job_kind { JobKind::FlowPreview | JobKind::Flow => { let args = job.args.clone().unwrap_or(Value::Null); @@ -1030,18 +1044,6 @@ async fn handle_queued_job( set_logs(&logs, &job.id, db).await; - let (cache_ttl, step) = if job.is_flow_step { - update_flow_status_in_progress( - db, - &job.workspace_id, - job.parent_job - .ok_or_else(|| Error::InternalErr(format!("expected parent job")))?, - job.id, - ) - .await? - } else { - (None, None) - }; let cached_res_path = if cache_ttl.is_some() { let flow_path = sqlx::query_scalar!( diff --git a/frontend/src/lib/components/FlowStatusViewer.svelte b/frontend/src/lib/components/FlowStatusViewer.svelte index 8a92c63127..26240bf464 100644 --- a/frontend/src/lib/components/FlowStatusViewer.svelte +++ b/frontend/src/lib/components/FlowStatusViewer.svelte @@ -483,15 +483,15 @@
{#if node.job_id} - diff --git a/frontend/src/lib/components/JobStatus.svelte b/frontend/src/lib/components/JobStatus.svelte index cc2c6c7180..08445e3cfd 100644 --- a/frontend/src/lib/components/JobStatus.svelte +++ b/frontend/src/lib/components/JobStatus.svelte @@ -46,7 +46,7 @@
- Running {#if job.flow_status}({job.flow_status?.step ?? ''} of {job.raw_flow?.modules + Running {#if job.flow_status}({job.flow_status?.step + 1 ?? ''} of {job.raw_flow?.modules ?.length ?? '?'}){/if}
diff --git a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte index bb91d1da88..8a2b1b2e27 100644 --- a/frontend/src/lib/components/apps/components/buttons/AppButton.svelte +++ b/frontend/src/lib/components/apps/components/buttons/AppButton.svelte @@ -2,7 +2,13 @@ import { Button } from '$lib/components/common' import { getContext } from 'svelte' import type { AppInput } from '../../inputType' - import type { AppViewerContext, ComponentCustomCSS, RichConfigurations } from '../../types' + import type { + AppViewerContext, + ComponentCustomCSS, + ListContext, + ListInputs, + RichConfigurations + } from '../../types' import AlignWrapper from '../helpers/AlignWrapper.svelte' import type RunnableComponent from '../helpers/RunnableComponent.svelte' import RunnableWrapper from '../helpers/RunnableWrapper.svelte' @@ -32,6 +38,9 @@ const { worldStore, app, componentControl, selectedComponent } = getContext('AppViewerContext') + const rowContext = getContext('RowWrapperContext') + const rowInputs: ListInputs | undefined = getContext('RowInputs') + let resolvedConfig = initConfig( components['buttoncomponent'].initialData.configuration, configuration @@ -81,6 +90,9 @@ $selectedComponent = [id] + if (rowContext && rowInputs) { + rowInputs(id, { result: outputs.result.peak(), loading: true }) + } if (preclickAction) { await preclickAction() } @@ -90,6 +102,9 @@ } else { await runnableComponent?.runComponent() } + if (rowContext && rowInputs) { + rowInputs(id, { result: outputs.result.peak(), loading: false }) + } } let loading = false diff --git a/frontend/src/lib/components/progressBar/ProgressBar.svelte b/frontend/src/lib/components/progressBar/ProgressBar.svelte index beef77ffaf..00e913d2bc 100644 --- a/frontend/src/lib/components/progressBar/ProgressBar.svelte +++ b/frontend/src/lib/components/progressBar/ProgressBar.svelte @@ -82,6 +82,9 @@ {state.length ? $percent.toFixed(0) : 0}%
+
{#each state as step, index}