diff --git a/frontend/src/lib/components/Dev.svelte b/frontend/src/lib/components/Dev.svelte index 70e21ae0fa..8843528284 100644 --- a/frontend/src/lib/components/Dev.svelte +++ b/frontend/src/lib/components/Dev.svelte @@ -52,6 +52,21 @@ import { ModulesTestStates } from './modulesTest.svelte' import type { GraphModuleState } from './graph' + let { + initial = undefined + }: { + initial?: + | { + type: 'script' + script: LastEditScript + } + | { + type: 'flow' + flow: LastEditFlow + } + | undefined + } = $props() + let flowCopilotContext: FlowCopilotContext = { shouldUpdatePropertyType: writable<{ [key: string]: 'static' | 'javascript' | undefined @@ -126,6 +141,7 @@ } let currentScript: LastEditScript | undefined = $state(undefined) + let mode: 'script' | 'flow' = $state('script') let schema = $state(emptySchema()) const href = window.location.href @@ -144,6 +160,15 @@ let loadingCodebaseButton = $state(false) let lastCommandId = '' + if (initial) { + if (initial.type == 'script') { + replaceScript(initial.script) + } else if (initial.type == 'flow') { + replaceFlow(initial.flow) + } + modeInitialized = true + } + const el = (event) => { // sendUserToast(`Received message from parent ${event.data.type}`, true) if (event.data.type == 'runTest') { @@ -414,8 +439,6 @@ } } - let mode: 'script' | 'flow' = $state('script') - const flowStore = $state({ val: { summary: '', @@ -630,7 +653,13 @@ - +
{#if mode == 'script'} diff --git a/frontend/src/lib/components/JobLoader.svelte b/frontend/src/lib/components/JobLoader.svelte index 14e675328e..e83d8d482e 100644 --- a/frontend/src/lib/components/JobLoader.svelte +++ b/frontend/src/lib/components/JobLoader.svelte @@ -46,6 +46,7 @@ toastError?: boolean onlyResult?: boolean loadPlaceholderJobOnStart?: Job + token?: string // If you want to find out progress of subjobs of a flow, check job.flow_status.progress scriptProgress?: number | undefined @@ -65,6 +66,7 @@ loadPlaceholderJobOnStart = undefined, scriptProgress = $bindable(undefined), noLogs = false, + token = undefined, children }: Props = $props() @@ -676,6 +678,10 @@ ) } + if (token) { + params.set('token', token) + } + const sseUrl = `/api/w/${workspace}/jobs_u/getupdate_sse/${id}?${params.toString()}` currentEventSource = new EventSource(sseUrl) diff --git a/frontend/src/routes/test_dev/test_dev_script/+page.svelte b/frontend/src/routes/test_dev/test_dev_script/+page.svelte new file mode 100644 index 0000000000..d2bc360201 --- /dev/null +++ b/frontend/src/routes/test_dev/test_dev_script/+page.svelte @@ -0,0 +1,30 @@ + + + + +