mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-22 08:03:38 +00:00
fix(frontend): scope raw-app, flow and script editors to the session workspace (#10015)
* fix(frontend): scope raw-app/flow/script editors to the session workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): scope flow and script editor operations to the session workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): scope flow preview, inline-script creation and datatable schema to the session workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review — thread session workspace through flow resource pickers, script fetch, preview cancel/recording and path collision check Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Claude review — pass session workspace to preview FlowStatusViewer and align FlowChatManager guards Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Pi review — show acting workspace in script-not-found message and fetch picked script from it in EditorBar Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 2 — thread session workspace into flow step test, raw-app inline runnable, inline editor toolbars and MCP OAuth path Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 3 — thread session workspace into dynamic-input helpers and the flow-preview argument side panel (history/saved-inputs/captures) Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 4 — thread session workspace into nested flow/script drawers, flow chat inputs and the flow input side tabs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 5 — thread session workspace into script-module fork/reload and key the raw-app schema cache by workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 6 — key the DB manager schema cache by acting workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): address Codex review round 7 — thread session workspace into resource-valued arg pickers and the editor variable/resource helper drawers Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix(frontend): scope the flow asset explorer's ResourceEditorDrawer to the acting workspace Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: thread acting workspace through flow asset explore controls Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> * fix: thread acting workspace through SQL REPL, secret args, helper forms, S3 inputs, saved inputs Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
9ad6927231
commit
c000bbca28
@@ -20,7 +20,8 @@
|
||||
import { getScriptByPath, scriptLangToEditorLang } from '$lib/scripts'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
import { Loader2 } from 'lucide-svelte'
|
||||
import { untrack } from 'svelte'
|
||||
import { getContext, untrack } from 'svelte'
|
||||
import type { FlowEditorContext } from '../types'
|
||||
|
||||
interface Props {
|
||||
path: string
|
||||
@@ -44,6 +45,9 @@
|
||||
language = $bindable(undefined)
|
||||
}: Props = $props()
|
||||
|
||||
const flowEditorContext = getContext<FlowEditorContext>('FlowEditorContext')
|
||||
let opWs = $derived(flowEditorContext?.opWorkspace?.() ?? $workspaceStore)
|
||||
|
||||
let code: string | undefined = $state()
|
||||
let previousCode: string | undefined = $state()
|
||||
let lock: string | undefined = $state(undefined)
|
||||
@@ -51,7 +55,7 @@
|
||||
let notFound = $state(false)
|
||||
|
||||
function getCachedKey(path: string, hash: string | undefined) {
|
||||
return `${$workspaceStore}-${path}-${hash ?? ''}`
|
||||
return `${opWs}-${path}-${hash ?? ''}`
|
||||
}
|
||||
function getCachedValues(path: string, hash: string | undefined) {
|
||||
const key = getCachedKey(path, hash)
|
||||
@@ -64,12 +68,15 @@
|
||||
notFound = cachedValues[key]?.notFound ?? false
|
||||
}
|
||||
|
||||
getCachedValues(untrack(() => path), untrack(() => hash))
|
||||
getCachedValues(
|
||||
untrack(() => path),
|
||||
untrack(() => hash)
|
||||
)
|
||||
|
||||
async function loadPreviousCode(previousHash: string) {
|
||||
try {
|
||||
const previousScript = await ScriptService.getScriptByHash({
|
||||
workspace: $workspaceStore!,
|
||||
workspace: opWs!,
|
||||
hash: previousHash
|
||||
})
|
||||
previousCode = previousScript.content
|
||||
@@ -93,8 +100,8 @@
|
||||
const script = path.startsWith('hub/')
|
||||
? await getScriptByPath(path!)
|
||||
: hash
|
||||
? await ScriptService.getScriptByHash({ workspace: $workspaceStore!, hash })
|
||||
: await getScriptByPath(path!)
|
||||
? await ScriptService.getScriptByHash({ workspace: opWs!, hash })
|
||||
: await getScriptByPath(path!, opWs)
|
||||
code = script.content
|
||||
|
||||
language = script.language
|
||||
@@ -133,7 +140,7 @@
|
||||
<div class="text-xs text-primary mb-4">tag: {tag}</div>
|
||||
{/if}
|
||||
{#if notFound}
|
||||
<div class="text-red-400">script not found at {path} in workspace {$workspaceStore}</div>
|
||||
<div class="text-red-400">script not found at {path} in workspace {opWs}</div>
|
||||
{:else if showAllCode}
|
||||
{#if showDiff}
|
||||
{#key (previousCode ?? '') + (code ?? '')}
|
||||
|
||||
Reference in New Issue
Block a user