mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-17 16:03:06 +00:00
* 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>
99 lines
2.7 KiB
Svelte
99 lines
2.7 KiB
Svelte
<script lang="ts">
|
|
import { Settings } from 'lucide-svelte'
|
|
import Popover from '$lib/components/meltComponents/Popover.svelte'
|
|
import Select from '$lib/components/select/Select.svelte'
|
|
import { workspaceStore } from '$lib/stores'
|
|
import {
|
|
createDatatablesResource,
|
|
createSchemasResource,
|
|
toDatatableItems,
|
|
toSchemaItems
|
|
} from './datatableUtils.svelte'
|
|
import { Button } from '../common'
|
|
import { getRawAppOperatingWorkspace } from './rawAppWorkspace'
|
|
|
|
const getOpWs = getRawAppOperatingWorkspace()
|
|
let opWs = $derived(getOpWs?.() ?? $workspaceStore)
|
|
|
|
interface Props {
|
|
/** Currently selected datatable */
|
|
datatable: string | undefined
|
|
/** Currently selected schema */
|
|
schema: string | undefined
|
|
/** Callback when either value changes */
|
|
onChange?: (datatable: string | undefined, schema: string | undefined) => void
|
|
/** Description text to show in the popover */
|
|
description?: string
|
|
}
|
|
|
|
let {
|
|
datatable,
|
|
schema,
|
|
onChange,
|
|
description = 'Set the default datatable and schema for new tables. This is where AI will create new tables when needed.'
|
|
}: Props = $props()
|
|
|
|
// Load available datatables and schemas using shared utilities
|
|
const datatables = createDatatablesResource(() => opWs)
|
|
const schemas = createSchemasResource(
|
|
() => datatable,
|
|
() => opWs
|
|
)
|
|
|
|
const datatableItems = $derived(toDatatableItems(datatables.current))
|
|
const schemaItems = $derived(toSchemaItems(schemas.current))
|
|
|
|
// Track datatable changes to reset schema
|
|
let previousDatatable = $state<string | undefined>(undefined)
|
|
$effect(() => {
|
|
if (previousDatatable !== undefined && datatable !== previousDatatable) {
|
|
// Reset schema when datatable changes
|
|
onChange?.(datatable, undefined)
|
|
}
|
|
previousDatatable = datatable
|
|
})
|
|
</script>
|
|
|
|
<Popover>
|
|
{#snippet trigger()}
|
|
<Button
|
|
title="Configure default datatable & schema"
|
|
unifiedSize="xs"
|
|
variant="subtle"
|
|
nonCaptureEvent
|
|
btnClasses="px-1"
|
|
>
|
|
<Settings size={12} />
|
|
</Button>
|
|
{/snippet}
|
|
{#snippet content()}
|
|
<div class="flex flex-col gap-3 p-4 min-w-64 max-w-80">
|
|
<div class="text-xs font-medium text-primary">Default Datatable & Schema</div>
|
|
|
|
<p class="text-2xs text-tertiary leading-relaxed">
|
|
{description}
|
|
</p>
|
|
|
|
<div class="flex flex-col gap-1">
|
|
<span class="text-2xs text-tertiary">Database</span>
|
|
<Select
|
|
items={datatableItems}
|
|
bind:value={() => datatable, (v) => onChange?.(v, schema)}
|
|
placeholder="Select database"
|
|
size="sm"
|
|
/>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-1">
|
|
<span class="text-2xs text-tertiary">Schema</span>
|
|
<Select
|
|
items={schemaItems}
|
|
bind:value={() => schema ?? '', (v) => onChange?.(datatable, v || undefined)}
|
|
placeholder="public"
|
|
size="sm"
|
|
/>
|
|
</div>
|
|
</div>
|
|
{/snippet}
|
|
</Popover>
|