diff --git a/backend/windmill-worker/src/worker_flow.rs b/backend/windmill-worker/src/worker_flow.rs index e8cd67108bba8..c14dd2f359783 100644 --- a/backend/windmill-worker/src/worker_flow.rs +++ b/backend/windmill-worker/src/worker_flow.rs @@ -3146,8 +3146,11 @@ async fn compute_next_flow_transform( } /* forloop modules are expected set `iter: { value: Value, index: usize }` as job arguments */ FlowModuleValue::ForloopFlow { modules, modules_node, iterator, parallel, .. } => { + tracing::error!("{:?}", flow_job); // if it's a simple single step flow, we will collapse it as an optimization and need to pass flow_input as an arg - let is_simple = !parallel && is_simple_modules(&modules, flow.failure_module.as_ref()); + let is_simple = !matches!(flow_job.job_kind, JobKind::FlowPreview) + && !parallel + && is_simple_modules(&modules, flow.failure_module.as_ref()); // if is_simple { // match value { diff --git a/frontend/src/lib/components/Dev.svelte b/frontend/src/lib/components/Dev.svelte index 90659e3103098..02967efaeb9ca 100644 --- a/frontend/src/lib/components/Dev.svelte +++ b/frontend/src/lib/components/Dev.svelte @@ -504,7 +504,8 @@ initialPath: '', flowInputsStore: writable({}), customUi: {}, - insertButtonOpen: writable(false) + insertButtonOpen: writable(false), + executionCount: writable(0), }) setContext('PropPickerContext', { flowPropPickerConfig: writable(undefined), diff --git a/frontend/src/lib/components/FlowBuilder.svelte b/frontend/src/lib/components/FlowBuilder.svelte index 4ada01aea7d79..156954d8e121f 100644 --- a/frontend/src/lib/components/FlowBuilder.svelte +++ b/frontend/src/lib/components/FlowBuilder.svelte @@ -107,7 +107,7 @@ export let disabledFlowInputs = false export let savedPrimarySchedule: ScheduleTrigger | undefined = undefined export let version: number | undefined = undefined - export let setSavedraftCb: ((cb: () => void) => void) | undefined = undefined + export let setSavedraftCb: ((cb: () => void) => void) | undefined = undefined // Used by multiplayer deploy collision warning let deployedValue: Value | undefined = undefined // Value to diff against @@ -528,7 +528,8 @@ initialPath, flowInputsStore: writable({}), customUi, - insertButtonOpen + insertButtonOpen, + executionCount: writable(0) }) setContext('TriggerContext', { diff --git a/frontend/src/lib/components/FlowPreviewContent.svelte b/frontend/src/lib/components/FlowPreviewContent.svelte index a336fd42d3fe5..88b22c899683e 100644 --- a/frontend/src/lib/components/FlowPreviewContent.svelte +++ b/frontend/src/lib/components/FlowPreviewContent.svelte @@ -36,8 +36,16 @@ runPreview($previewArgs, undefined) } - const { selectedId, previewArgs, flowStateStore, flowStore, pathStore, initialPath, customUi } = - getContext('FlowEditorContext') + const { + selectedId, + previewArgs, + flowStateStore, + flowStore, + pathStore, + initialPath, + customUi, + executionCount + } = getContext('FlowEditorContext') const dispatch = createEventDispatcher() function extractFlow(previewMode: 'upTo' | 'whole'): OpenFlow { @@ -330,6 +338,10 @@ wideResults {flowStateStore} {jobId} + on:done={() => { + console.log('done') + $executionCount = $executionCount + 1 + }} on:jobsLoaded={({ detail }) => { job = detail }} diff --git a/frontend/src/lib/components/FlowStatusViewerInner.svelte b/frontend/src/lib/components/FlowStatusViewerInner.svelte index 35803d53e3129..5ad9145c5d403 100644 --- a/frontend/src/lib/components/FlowStatusViewerInner.svelte +++ b/frontend/src/lib/components/FlowStatusViewerInner.svelte @@ -627,7 +627,6 @@ j != state?.selectedForloopIndex || setManually != state?.selectedForLoopSetManually if (selectedNotEqual) { - console.log('not equal') globalState?.update((topLevelModuleStates) => { topLevelModuleStates[modId] = { type: 'WaitingForPriorSteps', diff --git a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte index 7737c9e17369d..95c549e64099b 100644 --- a/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte +++ b/frontend/src/lib/components/flows/content/FlowModuleComponent.svelte @@ -57,7 +57,8 @@ pathStore, saveDraft, flowInputsStore, - customUi + customUi, + executionCount } = getContext('FlowEditorContext') export let flowModule: FlowModule @@ -107,17 +108,18 @@ $: editor !== undefined && setCopilotModuleEditor() - $: stepPropPicker = failureModule - ? getFailureStepPropPicker($flowStateStore, $flowStore, $previewArgs) - : getStepPropPicker( - $flowStateStore, - parentModule, - previousModule, - flowModule.id, - $flowStore, - $previewArgs, - false - ) + $: stepPropPicker = + $executionCount != undefined && failureModule + ? getFailureStepPropPicker($flowStateStore, $flowStore, $previewArgs) + : getStepPropPicker( + $flowStateStore, + parentModule, + previousModule, + flowModule.id, + $flowStore, + $previewArgs, + false + ) function onKeyDown(event: KeyboardEvent) { if ((event.ctrlKey || event.metaKey) && event.key == 'Enter') { diff --git a/frontend/src/lib/components/flows/previousResults.ts b/frontend/src/lib/components/flows/previousResults.ts index 3e2a297390bea..6ca5481dd41e6 100644 --- a/frontend/src/lib/components/flows/previousResults.ts +++ b/frontend/src/lib/components/flows/previousResults.ts @@ -74,12 +74,18 @@ function getFlowInput( if (parentState && parentModule) { if ( parentState.previewArgs && - !(parentModule.value?.type === 'forloopflow' && parentModule.value?.modules?.length === 1) && parentState && typeof parentState.previewArgs == 'object' && `iter` in parentState.previewArgs ) { - return { ...topFlowInput, ...parentState.previewArgs } + return { + iter: { + value: "Iteration's value", + index: "Iteration's index" + }, + ...topFlowInput, + ...parentState.previewArgs + } } else { let parentFlowInput = getFlowInput(parentModules, flowState, args, schema) if (parentModule.value.type === 'forloopflow') { diff --git a/frontend/src/lib/components/flows/types.ts b/frontend/src/lib/components/flows/types.ts index 2cf7127018f00..633834da0b576 100644 --- a/frontend/src/lib/components/flows/types.ts +++ b/frontend/src/lib/components/flows/types.ts @@ -40,4 +40,5 @@ export type FlowEditorContext = { flowInputsStore: Writable customUi: FlowBuilderWhitelabelCustomUi insertButtonOpen: Writable + executionCount: Writable } diff --git a/frontend/src/lib/components/propertyPicker/PropPicker.svelte b/frontend/src/lib/components/propertyPicker/PropPicker.svelte index 66b85816a3249..7e62990eb60dc 100644 --- a/frontend/src/lib/components/propertyPicker/PropPicker.svelte +++ b/frontend/src/lib/components/propertyPicker/PropPicker.svelte @@ -94,8 +94,10 @@ let filteringFlowInputsOrResult = '' async function filterPickableProperties() { if (!$propPickerConfig || !filterActive) { - flowInputsFiltered = pickableProperties.flow_input - resultByIdFiltered = pickableProperties.priorIds + if (search === EMPTY_STRING) { + flowInputsFiltered = pickableProperties.flow_input + resultByIdFiltered = pickableProperties.priorIds + } filteringFlowInputsOrResult = '' return } @@ -189,7 +191,7 @@ await updateCollapsable() } - $: search, $inputMatches, $propPickerConfig, updateState() + $: search, $inputMatches, $propPickerConfig, pickableProperties, updateState()
diff --git a/frontend/src/routes/flows/dev/+page.svelte b/frontend/src/routes/flows/dev/+page.svelte index cb984d1095f04..a44b9824d3430 100644 --- a/frontend/src/routes/flows/dev/+page.svelte +++ b/frontend/src/routes/flows/dev/+page.svelte @@ -99,7 +99,8 @@ initialPath: '', flowInputsStore: writable({}), customUi: {}, - insertButtonOpen: writable(false) + insertButtonOpen: writable(false), + executionCount: writable(0) }) setContext('PropPickerContext', { flowPropPickerConfig: writable(undefined),