fix: fix vscode extension dev mode
This commit is contained in:
@@ -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 @@
|
||||
|
||||
<svelte:window onkeydown={onKeyDown} />
|
||||
|
||||
<JobLoader noCode={true} bind:this={jobLoader} bind:isLoading={testIsLoading} bind:job={testJob} />
|
||||
<JobLoader
|
||||
{token}
|
||||
noCode={true}
|
||||
bind:this={jobLoader}
|
||||
bind:isLoading={testIsLoading}
|
||||
bind:job={testJob}
|
||||
/>
|
||||
|
||||
<main class="h-screen w-full">
|
||||
{#if mode == 'script'}
|
||||
|
||||
@@ -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)
|
||||
|
||||
30
frontend/src/routes/test_dev/test_dev_script/+page.svelte
Normal file
30
frontend/src/routes/test_dev/test_dev_script/+page.svelte
Normal file
@@ -0,0 +1,30 @@
|
||||
<script lang="ts">
|
||||
import Dev from '$lib/components/Dev.svelte'
|
||||
|
||||
import { userStore, workspaceStore } from '$lib/stores'
|
||||
import { getUserExt } from '$lib/user'
|
||||
|
||||
loadUser()
|
||||
|
||||
async function loadUser() {
|
||||
if ($workspaceStore) {
|
||||
$userStore = await getUserExt($workspaceStore)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- <ScriptWrapper {script} neverShowMeta={true} {customUi} /> -->
|
||||
|
||||
<Dev
|
||||
initial={{
|
||||
type: 'script',
|
||||
script: {
|
||||
path: 'u/admin/foo',
|
||||
language: 'bun',
|
||||
content: `export async function main() {
|
||||
console.log("Hello, world!")
|
||||
return
|
||||
}`
|
||||
}
|
||||
}}
|
||||
/>
|
||||
Reference in New Issue
Block a user