Files
windmill/frontend/src/lib/components/FlowHistoryJobPicker.svelte
T
6186a0645d feat: edit variables, resources and triggers in their own session tab (#11206)
* feat: edit variables, resources and triggers in their own session tab

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: take a trigger's flow kind from its config and name the written trigger

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* refactor: one operating-workspace context for editors acting on a session's workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: reload page item tabs only in sessions acting on the tool's workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: resolve open in workspace for every preview tab kind in one place

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: guard every component under a session editor against the navigation workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: show a page item tab whose item is gone instead of mounting its editor

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: follow a saved page item in the tab's own workspace and restore in-frame rows

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* feat: close a page item tab from its editor header

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: judge trigger permissions by the user acting in the session workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: judge every session-editor permission by the user acting in that workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: keep session permissions reactive to the acting role and restore tabs as last seen

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* fix: default Path's owner controls to the user acting in its workspace

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
2026-09-19 23:29:14 +02:00

75 lines
1.8 KiB
Svelte

<script lang="ts">
import { HistoryIcon } from 'lucide-svelte'
import { createEventDispatcher, untrack } from 'svelte'
import PopoverV2 from '$lib/components/meltComponents/Popover.svelte'
import HistoricInputs from './HistoricInputs.svelte'
import { JobService } from '$lib/gen'
import { Button } from './common'
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
const operatingWorkspace = useOperatingWorkspace()
interface Props {
path: string
selected?: string | undefined
selectInitial?: boolean
loading?: boolean
newFlow?: boolean
}
let {
path,
selected = undefined,
selectInitial = false,
loading = $bindable(false),
newFlow = false
}: Props = $props()
const dispatch = createEventDispatcher()
async function loadInitial() {
loading = true
let jobs = await JobService.listJobs({
workspace: $operatingWorkspace!,
scriptPathExact: path,
jobKinds: ['flow', 'flowpreview'].join(','),
perPage: 1
})
if (jobs.length > 0) {
if (selectInitial) {
dispatch('select', { jobId: jobs[0].id, initial: true })
}
} else {
dispatch('nohistory')
}
loading = false
}
$effect(() => {
if ($operatingWorkspace && !newFlow) {
untrack(() => loadInitial())
}
})
</script>
<PopoverV2 closeButton={false}>
{#snippet trigger()}
<Button variant="default" startIcon={{ icon: HistoryIcon }}>History</Button>
{/snippet}
{#snippet content()}
<div class="p-2 h-[400px] overflow-hidden w-80 border shadow-sm">
<HistoricInputs
on:select={(e) => {
if (e.detail) {
dispatch('select', { jobId: e.detail?.jobId, initial: false })
} else {
dispatch('unselect')
}
}}
{selected}
runnableId={path}
runnableType={'FlowPath'}
/>
</div>
{/snippet}
</PopoverV2>