{#if render}
{#if isRunning}
{#if recordingMode} Recording {/if}
{:else}
{#if jobId !== undefined && selectedJobStep !== undefined && restart.topLevelRestartable} { runPreview(previewArgs.val, { flow_job_id: jobId, step_id: stepId, branch_or_iteration_n: branchOrIterationN }) }} /> {/if} {#if !flowStore.val.value?.chat_input_enabled} {/if} {#if lastRecordingJobId && recordingMode} {/if}
{/if}
{/if}
handleScroll()} > {#if render} {#if flowStore.val.value?.chat_input_enabled}
{ // Its own run's id, not `jobId`: several test chats can start a run at // once, and `jobId` is whichever started last. const started = await runPreview( { user_message: userMessage, ...(additionalInputs ?? {}) }, undefined, conversationId ) return started ?? '' }} conversationKind="test" frame="boxed" path={$pathStore} identity={$initialPathStore || fakeInitialPath} inputSchema={flowStore.val.schema} flowModules={flowStore.val.value?.modules} />
{:else}
{ selectInput(e.detail.payload, e.detail?.type) }} {isValid} {jsonView} >
schemaFormWithArgPicker?.resetSelected()} {inputSelected} />
{ refresh() }} />
{#if jsonView}
{ if (e.detail) { previewArgs.val = e.detail } }} initialCode={argsToJsonPayload( flowStore.val.schema as Schema | undefined, previewArgs.val )} updateOnBlur={false} placeholder={`Write args as JSON.

Example:

{
  "foo": "12"
}`} />
{:else} {#key renderCount}
{ savedArgs = $state.snapshot(previewArgs.val) }} bind:isValid helperScript={DynamicInput.flowHelperScript( flowStore.val.schema?.['x-windmill-dyn-select-code'] as string | undefined, flowStore.val.schema?.['x-windmill-dyn-select-lang'] as | ScriptLang | undefined, $initialPathStore, !$roleCaps.code )} />
{/key} {/if}
{/if} {/if}
{#if flowHasChanged()}
Flow changed since last preview
{/if}
{#if job} {:else}
{/if} { if (!currentJobId) { currentJobId = jobId } const detail = e.detail jobId = detail.jobId if (detail.initial && stepHistoryLoader?.flowJobInitial === undefined) { stepHistoryLoader?.setFlowJobInitial(detail.initial) } }} on:unselect={() => { jobId = currentJobId currentJobId = undefined }} path={$initialPathStore == '' ? $pathStore : $initialPathStore} bind:loading={loadingHistory} />
{#if jobId} {/if} {#if job}
{/if} {#if jobId} {#if stepHistoryLoader?.flowJobInitial}
{ stepHistoryLoader?.setFlowJobInitial(false) }} class="cursor-pointer h-full hover:bg-gray-500/20 dark:hover:bg-gray-500/20 dark:bg-gray-500/80 rounded bg-gray-500/40 absolute top-0 left-0 w-full z-50" >
Previous run of this flow from history
{/if} { isRunning = false $executionCount = $executionCount + 1 // Reset 'initial' flags for modules that were part of this flow test, // so OutputPicker no longer shows "Run loaded from history" for (const mod of completedJob.flow_status?.modules ?? []) { if (mod.id) { stepHistoryLoader?.resetInitial(mod.id) } } if (recordingMode && completedJob?.id) { lastRecordingJobId = completedJob.id } onJobDone?.() }} bind:selectedJobStep bind:rightColumnSelect bind:isOwner {render} {customUi} showLogsWithResult notes={flowStore.val.value.notes} groups={flowStore.val.value.groups} /> {:else if loadingHistory}
Loading history...
{:else}
Flow status will display here
{/if}