mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-21 08:03:33 +00:00
* 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>
128 lines
3.7 KiB
Svelte
128 lines
3.7 KiB
Svelte
<script lang="ts">
|
|
import { Badge, Skeleton } from '$lib/components/common'
|
|
import NoItemFound from '$lib/components/home/NoItemFound.svelte'
|
|
import SearchItems from '$lib/components/SearchItems.svelte'
|
|
import { FlowService, type Flow } from '$lib/gen'
|
|
import { emptyString } from '$lib/utils'
|
|
|
|
import { createEventDispatcher, getContext, untrack } from 'svelte'
|
|
import type { FlowEditorContext } from '../types'
|
|
import { flip } from 'svelte/animate'
|
|
import { fade } from 'svelte/transition'
|
|
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
|
|
|
|
const operatingWorkspace = useOperatingWorkspace()
|
|
interface Props {
|
|
children?: import('svelte').Snippet
|
|
}
|
|
|
|
let { children }: Props = $props()
|
|
|
|
const flowEditorContext = getContext<FlowEditorContext>('FlowEditorContext')
|
|
let opWs = $derived(flowEditorContext?.opWorkspace?.() ?? $operatingWorkspace)
|
|
|
|
// export let failureModule: boolean
|
|
const dispatch = createEventDispatcher()
|
|
|
|
let items = $state(undefined) as Flow[] | undefined
|
|
let filteredItems = $state(undefined) as (Flow & { marked?: string })[] | undefined
|
|
let filter = $state('')
|
|
|
|
let ownerFilter: string | undefined = $state(undefined)
|
|
|
|
async function loadFlows() {
|
|
items = await FlowService.listFlows({ workspace: opWs!, withoutDescription: true })
|
|
}
|
|
$effect(() => {
|
|
opWs && untrack(() => loadFlows())
|
|
})
|
|
let prefilteredItems = $derived(
|
|
ownerFilter ? items?.filter((x) => x.path.startsWith(ownerFilter!)) : items
|
|
)
|
|
let owners = $derived(
|
|
Array.from(
|
|
new Set(filteredItems?.map((x) => x.path.split('/').slice(0, 2).join('/')) ?? [])
|
|
).sort()
|
|
)
|
|
</script>
|
|
|
|
<SearchItems
|
|
{filter}
|
|
items={prefilteredItems}
|
|
bind:filteredItems
|
|
f={(x) => (emptyString(x.summary) ? x.path : x.summary + ' (' + x.path + ')')}
|
|
/>
|
|
<div class="flex flex-col min-h-0 p-4">
|
|
<h3 class="mb-4">Pick a Workspace Flow</h3>
|
|
<div class="w-full flex mt-1 items-center gap-2 mb-3">
|
|
{@render children?.()}
|
|
|
|
<input
|
|
type="text"
|
|
placeholder="Search Workspace Flow"
|
|
bind:value={filter}
|
|
class="text-2xl grow"
|
|
/>
|
|
</div>
|
|
|
|
{#if filteredItems}
|
|
{#if owners.length > 0}
|
|
<div class="gap-2 w-full flex flex-wrap my-2">
|
|
{#each owners as owner (owner)}
|
|
<div in:fade={{ duration: 50 }} animate:flip={{ duration: 100 }}>
|
|
<Badge
|
|
class="cursor-pointer hover:bg-gray-200"
|
|
clickable
|
|
onclick={() => {
|
|
ownerFilter = ownerFilter == owner ? undefined : owner
|
|
}}
|
|
color={owner === ownerFilter ? 'blue' : 'gray'}
|
|
baseClass={owner === ownerFilter ? 'border border-blue-500' : 'border'}
|
|
>
|
|
{owner}
|
|
{#if owner === ownerFilter}✗{/if}
|
|
</Badge>
|
|
</div>
|
|
{/each}
|
|
</div>
|
|
{/if}
|
|
{#if filter.length > 0 && filteredItems.length == 0}
|
|
<NoItemFound />
|
|
{/if}
|
|
<ul class="divide-y overflow-auto">
|
|
{#each filteredItems as { path, summary, description, marked }}
|
|
<li class="flex flex-row w-full">
|
|
<button
|
|
class="p-4 gap-1 flex flex-row grow hover:bg-surface-hover bg-surface transition-all text-primary"
|
|
onclick={() => {
|
|
dispatch('pick', { path })
|
|
}}
|
|
>
|
|
<div class="flex flex-col">
|
|
<div class="text-sm font-semibold flex flex-col">
|
|
<span class="mr-2 text-left">
|
|
{#if marked}
|
|
{@html marked}
|
|
{:else}
|
|
{!summary || summary.length == 0 ? path : summary}
|
|
{/if}
|
|
</span>
|
|
<span class="font-normal text-xs text-left italic overflow-hidden"
|
|
>{path ?? ''}
|
|
</span>
|
|
</div>
|
|
<div class="text-xs font-light italic text-left">{description ?? ''}</div>
|
|
</div>
|
|
</button>
|
|
</li>
|
|
{/each}
|
|
</ul>
|
|
{:else}
|
|
<div class="mt-6"></div>
|
|
|
|
{#each new Array(6) as _}
|
|
<Skeleton layout={[[4], 0.7]} />
|
|
{/each}
|
|
{/if}
|
|
</div>
|