update flow status even for flows

This commit is contained in:
Ruben Fiszel
2023-08-18 01:32:19 +02:00
parent 237460b121
commit 7c4f568a8f
5 changed files with 37 additions and 17 deletions

View File

@@ -1002,6 +1002,20 @@ async fn handle_queued_job<R: rsmq_async::RsmqConnection + Send + Sync + Clone>(
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<R: rsmq_async::RsmqConnection + Send + Sync + Clone>(
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!(

View File

@@ -483,15 +483,15 @@
<div class="px-2 flex gap-2 min-w-0">
<ModuleStatus type={node.type} scheduled_for={node['scheduled_for']} />
{#if node.job_id}
<div class="truncate"
<div class="truncate min-w-1/2"
><div class=" text-primary whitespace-nowrap truncate">
<span class="font-bold">Job Id</span>
<span class="font-bold mr-2">Job Id</span>
<a
rel="noreferrer"
target="_blank"
href="/run/{node.job_id ?? ''}?workspace={job?.workspace_id}"
>
{truncateRev(node.job_id ?? '', 10) ?? ''}
{truncateRev(node.job_id ?? '', 1) ?? ''}
</a>
</div>
</div>

View File

@@ -46,7 +46,7 @@
<div>
<Badge large color="yellow">
<Icon data={faCircle} scale={SMALL_ICON_SCALE} class="mr-2" />
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}
</Badge>
</div>

View File

@@ -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>('AppViewerContext')
const rowContext = getContext<ListContext>('RowWrapperContext')
const rowInputs: ListInputs | undefined = getContext<ListInputs>('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

View File

@@ -82,6 +82,9 @@
{state.length ? $percent.toFixed(0) : 0}%
</span>
</div>
<!-- {#each state as step, index}
{index} {JSON.stringify(step)}
{/each} -->
<div class="flex w-full bg-gray-200 rounded-full h-4 overflow-hidden">
{#each state as step, index}
<div