mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-20 08:08:58 +00:00
feat: adapt workspace settings to narrow layouts (#12492)
* feat: adapt workspace settings to narrow layouts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep a section mounted across the narrow breakpoint and use the full picker in a session preview Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * feat: list workspace settings sections in the session tab picker Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: highlight aliased settings tabs and keep settings searchable in the picker Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: open the session picker on Pages when workspace settings is not the user's Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
b9dc5f26db
commit
0c18bdc825
@@ -5,7 +5,8 @@ uses — the workspace pages, then the folders with their flows, scripts and app
|
||||
row navigates the app there.
|
||||
|
||||
It lands among the current page's siblings: an item opens in its folder with the item
|
||||
highlighted, a workspace page inside Pages with that page highlighted.
|
||||
highlighted, a workspace page inside Pages with that page highlighted, and a pane of a page with
|
||||
several (a workspace settings section) among that page's panes.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { ChevronDown } from 'lucide-svelte'
|
||||
@@ -21,13 +22,18 @@ highlighted, a workspace page inside Pages with that page highlighted.
|
||||
} from './sessions/previewRouter'
|
||||
import { editPathFor, leafKeyFor, viewPathFor, type WorkspaceItem } from './workspacePicker'
|
||||
import { logFeatureUsage } from '$lib/utils/featureUsage'
|
||||
import type { PageHeaderItem, PageHeaderSection } from './pageHeaderRegistry.svelte'
|
||||
import type {
|
||||
PageHeaderItem,
|
||||
PageHeaderSection,
|
||||
PageHeaderSubpage
|
||||
} from './pageHeaderRegistry.svelte'
|
||||
|
||||
let {
|
||||
item,
|
||||
pagePath,
|
||||
artifacts,
|
||||
actingWorkspaceId,
|
||||
subpages,
|
||||
iconSize = 14
|
||||
}: {
|
||||
/** The item the page is about, to land in its folder. */
|
||||
@@ -38,6 +44,8 @@ highlighted, a workspace page inside Pages with that page highlighted.
|
||||
artifacts?: PageHeaderSection['navArtifacts']
|
||||
/** Load from, and navigate within, this workspace rather than the one the app points at. */
|
||||
actingWorkspaceId?: string
|
||||
/** The panes of the page at `pagePath`, listed under it and opened on the current one. */
|
||||
subpages?: PageHeaderSubpage[]
|
||||
iconSize?: number
|
||||
} = $props()
|
||||
|
||||
@@ -60,20 +68,23 @@ highlighted, a workspace page inside Pages with that page highlighted.
|
||||
const parts = item?.path?.split('/') ?? []
|
||||
return parts.length >= 3 ? { kind: 'all', dir: parts.slice(0, -1).join('/') } : undefined
|
||||
})
|
||||
const currentSubpage = $derived(subpages?.find((sp) => sp.current))
|
||||
const initialHighlight = $derived(
|
||||
artifacts?.currentId
|
||||
? artifactKey(artifacts.currentId)
|
||||
: currentItem
|
||||
? leafKeyFor(currentItem.kind, currentItem.path)
|
||||
: pagePath
|
||||
? pageKey(pagePath)
|
||||
: undefined
|
||||
currentSubpage
|
||||
? pageKey(currentSubpage.href)
|
||||
: artifacts?.currentId
|
||||
? artifactKey(artifacts.currentId)
|
||||
: currentItem
|
||||
? leafKeyFor(currentItem.kind, currentItem.path)
|
||||
: pagePath
|
||||
? pageKey(pagePath)
|
||||
: undefined
|
||||
)
|
||||
|
||||
// A page acting on another workspace than the app's (a session in a fork) keeps acting on it:
|
||||
// the route reads `?workspace=` before the store.
|
||||
function withWorkspace(href: string): string {
|
||||
if (!actingWorkspaceId) return href
|
||||
if (!actingWorkspaceId || /[?&]workspace=/.test(href)) return href
|
||||
const sep = href.includes('?') ? '&' : '?'
|
||||
return `${href}${sep}workspace=${encodeURIComponent(actingWorkspaceId)}`
|
||||
}
|
||||
@@ -133,6 +144,7 @@ highlighted, a workspace page inside Pages with that page highlighted.
|
||||
return href ? withWorkspace(href) : undefined
|
||||
}}
|
||||
onPick={pick}
|
||||
subpages={subpages ? { path: pagePath ?? '', pages: subpages } : undefined}
|
||||
/>
|
||||
{/snippet}
|
||||
</Popover>
|
||||
|
||||
@@ -546,7 +546,7 @@
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button
|
||||
variant="accent"
|
||||
disabled={busy || !selectedDevId || !!candidateClash}
|
||||
|
||||
@@ -579,7 +579,12 @@ leaves and ignores the current scope.
|
||||
{secondary ?? leaf.secondary}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="text-xs text-primary font-normal font-mono truncate">
|
||||
<div
|
||||
class="text-xs text-primary font-normal truncate {secondary === undefined &&
|
||||
leaf.plainLabel
|
||||
? ''
|
||||
: 'font-mono'}"
|
||||
>
|
||||
{secondary ?? leaf.label}
|
||||
</div>
|
||||
{/if}
|
||||
@@ -660,7 +665,11 @@ leaves and ignores the current scope.
|
||||
{#if scope.length > 0 && !isSearching}
|
||||
<button
|
||||
type="button"
|
||||
class="flex items-center gap-1.5 w-full text-left px-3 py-1 text-xs font-medium font-mono text-secondary bg-surface-secondary/20 hover:bg-surface-hover transition-colors"
|
||||
class="flex items-center gap-1.5 w-full text-left px-3 py-1 text-xs font-medium {headerChain.every(
|
||||
(b) => b.plainLabel
|
||||
)
|
||||
? ''
|
||||
: 'font-mono'} text-secondary bg-surface-secondary/20 hover:bg-surface-hover transition-colors"
|
||||
onmousedown={(e) => e.preventDefault()}
|
||||
onclick={goUp}
|
||||
title={headerLabel}
|
||||
@@ -734,9 +743,10 @@ leaves and ignores the current scope.
|
||||
role="option"
|
||||
aria-selected={isHl}
|
||||
data-nav-key={entry.key}
|
||||
class="flex items-center gap-1.5 w-full text-left px-3 py-1.5 text-xs font-medium font-mono text-emphasis transition-colors {isHl
|
||||
? 'bg-surface-hover'
|
||||
: ''}"
|
||||
class="flex items-center gap-1.5 w-full text-left px-3 py-1.5 text-xs font-medium {entry
|
||||
.node.plainLabel
|
||||
? ''
|
||||
: 'font-mono'} text-emphasis transition-colors {isHl ? 'bg-surface-hover' : ''}"
|
||||
onmousedown={(e) => e.preventDefault()}
|
||||
onclick={() => drill(entry)}
|
||||
onmouseenter={() => setHoverHighlight(entry.key)}
|
||||
|
||||
@@ -285,7 +285,7 @@
|
||||
</script>
|
||||
|
||||
<div class={classNames('space-y-2', noMargin ? '' : 'mt-2')}>
|
||||
<ToggleButtonGroup bind:selected={draft.selected} disabled={!isEditable}>
|
||||
<ToggleButtonGroup bind:selected={draft.selected} disabled={!isEditable} wrap>
|
||||
{#snippet children({ item })}
|
||||
<ToggleButton label="Slack" value="slack" {item} disabled={!isEditable} />
|
||||
<ToggleButton label="Teams" value="teams" {item} disabled={!isEditable} />
|
||||
@@ -314,21 +314,25 @@
|
||||
<div class="flex flex-col gap-6 p-4 rounded-md shadow-sm bg-surface-tertiary">
|
||||
{#if draft.selected === 'custom'}
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex flex-row">
|
||||
<ScriptPicker
|
||||
disabled={!isEditable || (customRequiresEE && !$enterpriseLicense)}
|
||||
kinds={['script', 'failure']}
|
||||
allowFlow={true}
|
||||
bind:scriptPath={draft.custom.path}
|
||||
bind:itemKind={draft.custom.kind}
|
||||
allowRefresh={isEditable}
|
||||
workspace={effectiveWorkspace}
|
||||
clearable
|
||||
/>
|
||||
<div class="flex flex-wrap items-center gap-x-4 gap-y-2">
|
||||
<!-- The basis is the narrowest the picker stays usable at; below it the template
|
||||
button wraps rather than squeezing the select to nothing. -->
|
||||
<div class="grow basis-72 min-w-0">
|
||||
<ScriptPicker
|
||||
disabled={!isEditable || (customRequiresEE && !$enterpriseLicense)}
|
||||
kinds={['script', 'failure']}
|
||||
allowFlow={true}
|
||||
bind:scriptPath={draft.custom.path}
|
||||
bind:itemKind={draft.custom.kind}
|
||||
allowRefresh={isEditable}
|
||||
workspace={effectiveWorkspace}
|
||||
clearable
|
||||
/>
|
||||
</div>
|
||||
|
||||
{#if !draft.custom.path}
|
||||
<Button
|
||||
btnClasses="ml-4 whitespace-nowrap"
|
||||
btnClasses="whitespace-nowrap"
|
||||
variant="default"
|
||||
size="xs"
|
||||
href={templateHref}
|
||||
|
||||
@@ -98,6 +98,10 @@ not this component) — so the lead can run the whole line.
|
||||
const found = navPageFor(page.url.pathname)
|
||||
return found?.path === '/' ? undefined : found
|
||||
})
|
||||
// A page with panes names the pane, not itself, but its picker still files them under it.
|
||||
const pickerPagePath = $derived(
|
||||
routePage?.path ?? (section?.subpages ? navPageFor(page.url.pathname)?.path : undefined)
|
||||
)
|
||||
|
||||
/** One look for every segment, whichever picker it opens. */
|
||||
const SEGMENT =
|
||||
@@ -286,8 +290,9 @@ not this component) — so the lead can run the whole line.
|
||||
|
||||
{#snippet navPicker(measure: boolean)}
|
||||
<!-- The page's own name is the last segment, so the chevron after it moves to a sibling page or
|
||||
item. Not in a session's preview band, which must not lead out of the host's workspace. -->
|
||||
{#if !nameOnly && !section?.noNavPicker}
|
||||
item. A session's preview band has the tab's own picker for that, so it shows this one only
|
||||
on a page with panes, whose name here is the pane's. -->
|
||||
{#if !section?.noNavPicker && (!nameOnly || (section?.subpages && !item))}
|
||||
{#if measure}
|
||||
<span class="flex items-center h-9 px-1.5 shrink-0">
|
||||
<ChevronDown size={ICON} class="flex-shrink-0" />
|
||||
@@ -295,9 +300,10 @@ not this component) — so the lead can run the whole line.
|
||||
{:else}
|
||||
<BreadcrumbNavPicker
|
||||
{item}
|
||||
pagePath={routePage?.path}
|
||||
pagePath={pickerPagePath}
|
||||
artifacts={section?.navArtifacts}
|
||||
{actingWorkspaceId}
|
||||
subpages={item ? undefined : section?.subpages}
|
||||
iconSize={ICON}
|
||||
/>
|
||||
{/if}
|
||||
@@ -521,11 +527,17 @@ not this component) — so the lead can run the whole line.
|
||||
{:else if section}
|
||||
{#if section.parent}
|
||||
<!-- Gives width back with the workspace part, before the section's own name does. -->
|
||||
<span
|
||||
class={twMerge(SEGMENT, LEAD, 'shrink-[999] hover:bg-transparent hover:text-secondary')}
|
||||
>
|
||||
<span class="truncate">{section.parent}</span>
|
||||
</span>
|
||||
{#if section.parentHref && !measure}
|
||||
<a href={section.parentHref} class={twMerge(SEGMENT, LEAD, 'shrink-[999]')}>
|
||||
<span class="truncate">{section.parent}</span>
|
||||
</a>
|
||||
{:else}
|
||||
<span
|
||||
class={twMerge(SEGMENT, LEAD, 'shrink-[999] hover:bg-transparent hover:text-secondary')}
|
||||
>
|
||||
<span class="truncate">{section.parent}</span>
|
||||
</span>
|
||||
{/if}
|
||||
{@render slash()}
|
||||
{/if}
|
||||
{#if section.content && measure}
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import { arrowTabNav } from '$lib/attachments/arrowTabNav'
|
||||
import EEOnly from '$lib/components/EEOnly.svelte'
|
||||
import { enterpriseLicense } from '$lib/stores'
|
||||
import { ChevronRight } from 'lucide-svelte'
|
||||
|
||||
interface NavigationItem {
|
||||
id: string
|
||||
@@ -29,10 +30,19 @@
|
||||
onNavigate: (id: string) => void
|
||||
/** Renders each item as a link to this URL; the link navigates, so `onNavigate` is not called. */
|
||||
itemHref?: (id: string) => string
|
||||
/** Ends each entry with a chevron, for a list whose entries each open as a page of their own. */
|
||||
drillIn?: boolean
|
||||
class?: string
|
||||
}
|
||||
|
||||
let { groups, selectedId, onNavigate, itemHref, class: className = '' }: Props = $props()
|
||||
let {
|
||||
groups,
|
||||
selectedId,
|
||||
onNavigate,
|
||||
itemHref,
|
||||
drillIn = false,
|
||||
class: className = ''
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<!-- Up/Down walks the items, wrapping at the ends. On the wrapper rather than on each
|
||||
@@ -58,7 +68,7 @@
|
||||
aiId={item.aiId}
|
||||
aiDescription={item.aiDescription}
|
||||
startIcon={item.icon ? { icon: item.icon } : undefined}
|
||||
btnClasses={'!justify-start text-left !w-full'}
|
||||
btnClasses="group/nav-item !justify-start text-left !w-full"
|
||||
href={itemHref?.(item.id)}
|
||||
onClick={itemHref ? undefined : () => onNavigate(item.id)}
|
||||
>
|
||||
@@ -74,6 +84,14 @@
|
||||
{item.count}
|
||||
</span>
|
||||
{/if}
|
||||
{#if drillIn}
|
||||
<!-- On the hovered or focused entry only; a touch screen cannot hover, so
|
||||
there it stays on every entry. -->
|
||||
<ChevronRight
|
||||
size={14}
|
||||
class="text-tertiary shrink-0 opacity-0 group-hover/nav-item:opacity-100 group-focus-visible/nav-item:opacity-100 [@media(hover:none)]:opacity-100"
|
||||
/>
|
||||
{/if}
|
||||
</div>
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -30,6 +30,9 @@ export type DrillLeaf<L> = {
|
||||
current?: boolean
|
||||
/** When true, leaf is rendered but disabled (greyed + no-op click). */
|
||||
disabled?: boolean
|
||||
/** A name in words rather than an identifier (a path, a file, a command), so it is set in
|
||||
* the UI font instead of monospace. */
|
||||
plainLabel?: boolean
|
||||
}
|
||||
|
||||
/** Branch node — interior entry the user drills into. */
|
||||
@@ -51,6 +54,9 @@ export type DrillBranch<L> = {
|
||||
* at `Workspace > Flows > f/demo > foo` groups under "Flows" (not
|
||||
* "f/demo"). */
|
||||
searchGroup?: boolean
|
||||
/** A name in words rather than an identifier (a path, a file, a command), so it is set in
|
||||
* the UI font instead of monospace. */
|
||||
plainLabel?: boolean
|
||||
}
|
||||
|
||||
export type DrillNode<L> = DrillBranch<L> | DrillLeaf<L>
|
||||
|
||||
@@ -2,6 +2,17 @@ import type { Snippet } from 'svelte'
|
||||
import type { WorkspaceItemKind } from './workspacePicker'
|
||||
import type { OpenInSessionSource } from './sessions/OpenInSessionButton.svelte'
|
||||
|
||||
/** One pane of a page with several, such as a workspace settings section. */
|
||||
export type PageHeaderSubpage = {
|
||||
label: string
|
||||
/** Absolute, keeping the query the page needs (an embed's `nomenubar`). */
|
||||
href: string
|
||||
/** Header the pane is listed under. */
|
||||
group?: string
|
||||
current?: boolean
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
/** An item the page is working on: the breadcrumb walks its path and ends with its summary. */
|
||||
export type PageHeaderItem = {
|
||||
/** Absent for an item the picker does not file under a kind — an agent's detail page. The
|
||||
@@ -28,6 +39,12 @@ export type PageHeaderSection = {
|
||||
/** The page the section belongs to, when the section is one pane of it — a settings page's
|
||||
* active tab. Drawn as a lead segment before `label`. */
|
||||
parent?: string
|
||||
/** Makes `parent` a link, for a page whose panes have an index of their own to return to. */
|
||||
parentHref?: string
|
||||
/** The panes of the page `parent` names. The chevron's picker lists them under that page in
|
||||
* Pages and opens on them; in an embed, where the picker must not lead out of the host's
|
||||
* workspace, it lists them alone. */
|
||||
subpages?: PageHeaderSubpage[]
|
||||
/** Rendered in place of `label` when the name is itself a control, such as an editable title. */
|
||||
content?: Snippet
|
||||
/** Scopes the segment's picker, when the section maps to a kind of item. */
|
||||
|
||||
@@ -51,6 +51,9 @@ section or the flat layout.
|
||||
} from './previewRouter'
|
||||
import { useSessionPermissions } from './sessionPermissions.svelte'
|
||||
import type { AIWorkMode } from '$lib/components/copilot/chat/workMode'
|
||||
import type { PageHeaderSubpage } from '$lib/components/pageHeaderRegistry.svelte'
|
||||
import { WORKSPACE_SETTINGS_PATH } from './previewPaths'
|
||||
import { workspaceSettingsSubpages } from '$lib/components/workspaceSettings/workspaceSettingsSections'
|
||||
|
||||
type Kind = WorkspaceItemKind
|
||||
type DrillPickerHandle = {
|
||||
@@ -82,6 +85,9 @@ section or the flat layout.
|
||||
/** Where picking a target navigates, for a host whose pick is a navigation; rows then
|
||||
* open in a new tab on middle and ⌘/Ctrl-click. */
|
||||
targetHref?: (target: PreviewTarget) => string | undefined
|
||||
/** The panes of the page at `path`, which Pages then lists as a branch of them. Defaults
|
||||
* to the workspace settings sections, which a host outside that page cannot read from it. */
|
||||
subpages?: { path: string; pages: PageHeaderSubpage[] }
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -95,8 +101,12 @@ section or the flat layout.
|
||||
workspaceId,
|
||||
artifacts,
|
||||
chat,
|
||||
targetHref
|
||||
targetHref,
|
||||
subpages: subpagesProp
|
||||
}: Props = $props()
|
||||
const subpages = $derived(
|
||||
subpagesProp ?? { path: WORKSPACE_SETTINGS_PATH, pages: workspaceSettingsSubpages() }
|
||||
)
|
||||
|
||||
const kinds: Kind[] = ['flow', 'script', 'app']
|
||||
const effectiveWorkspace = $derived(workspaceId ?? $workspaceStore)
|
||||
@@ -248,10 +258,39 @@ section or the flat layout.
|
||||
key: pageKey(p.path),
|
||||
label: p.label,
|
||||
icon: p.icon,
|
||||
plainLabel: true,
|
||||
data: { type: 'page', href: p.path, label: p.label }
|
||||
}
|
||||
}
|
||||
|
||||
const subpageLeaves = $derived<DrillLeaf<PreviewTarget>[]>(
|
||||
(subpages?.pages ?? []).map((sp) => ({
|
||||
type: 'leaf',
|
||||
key: pageKey(sp.href),
|
||||
label: sp.label,
|
||||
section: sp.group,
|
||||
current: sp.current || pageKey(sp.href) === initialHighlight,
|
||||
disabled: sp.disabled,
|
||||
plainLabel: true,
|
||||
data: { type: 'page', href: sp.href, label: sp.label }
|
||||
}))
|
||||
)
|
||||
|
||||
function pageNode(p: (typeof PREVIEW_PAGES)[number]): DrillNode<PreviewTarget> {
|
||||
const leaf = pageLeaf(p)
|
||||
if (p.path !== subpages?.path || subpageLeaves.length === 0) return leaf
|
||||
return {
|
||||
type: 'branch',
|
||||
key: leaf.key,
|
||||
label: leaf.label,
|
||||
icon: leaf.icon,
|
||||
plainLabel: true,
|
||||
// Search reads leaves only, so each pane carries its page's name for the page to be
|
||||
// found by it.
|
||||
children: subpageLeaves.map((l) => ({ ...l, searchableText: `${l.label} ${p.label}` }))
|
||||
}
|
||||
}
|
||||
|
||||
// Home is deliberately not navigable from the session preview — it stays in
|
||||
// PREVIEW_PAGES only so a tab already sitting on '/' keeps its label.
|
||||
const pagesBranch = $derived<DrillBranch<PreviewTarget>>({
|
||||
@@ -260,8 +299,9 @@ section or the flat layout.
|
||||
label: 'Pages',
|
||||
icon: Compass,
|
||||
searchGroup: true,
|
||||
plainLabel: true,
|
||||
children: PREVIEW_PAGES.filter((p) => p.path !== '/' && permissions.pageAllowed(p)).map(
|
||||
pageLeaf
|
||||
pageNode
|
||||
)
|
||||
})
|
||||
|
||||
@@ -275,11 +315,13 @@ section or the flat layout.
|
||||
label: 'Artifacts',
|
||||
icon: FileText,
|
||||
searchGroup: true,
|
||||
plainLabel: true,
|
||||
children: artifacts.map((a) => ({
|
||||
type: 'leaf' as const,
|
||||
key: artifactKey(a.id),
|
||||
label: a.name,
|
||||
icon: FileText,
|
||||
plainLabel: true,
|
||||
data: { type: 'artifact', id: a.id, name: a.name }
|
||||
}))
|
||||
}
|
||||
@@ -300,6 +342,7 @@ section or the flat layout.
|
||||
label: 'Data pipelines',
|
||||
icon: NetworkIcon,
|
||||
searchGroup: true,
|
||||
plainLabel: true,
|
||||
children: pipelinesResource.current.map(({ folder }) => {
|
||||
const path = `/pipeline/${encodeURIComponent(folder)}`
|
||||
return {
|
||||
@@ -336,6 +379,7 @@ section or the flat layout.
|
||||
label: 'AI agents',
|
||||
icon: Bot,
|
||||
searchGroup: true,
|
||||
plainLabel: true,
|
||||
children: shownAgents.map((a) => ({
|
||||
type: 'leaf' as const,
|
||||
key: `agent:${a.path}`,
|
||||
@@ -377,12 +421,31 @@ section or the flat layout.
|
||||
// highlight's shape alone: the artifacts branch may not have materialized yet
|
||||
// (artifacts hydrate from IndexedDB after tabs restore), and the drill entries
|
||||
// fill in reactively once it does.
|
||||
// Not gated on the branch being listed yet: the page permissions that list it can still be
|
||||
// loading when the picker opens, and the scope is read only then. Once they show the page is
|
||||
// not this user's (a fork owner on its Members section), the picker reopens on Pages rather
|
||||
// than inside a branch that is not listed, which would show nothing.
|
||||
const subpageBranchKey = untrack(() =>
|
||||
subpages && subpageLeaves.some((l) => l.key === initialHighlight)
|
||||
? pageKey(subpages.path)
|
||||
: undefined
|
||||
)
|
||||
const computedInitialScope = untrack(() =>
|
||||
initialHighlight && isArtifactKey(initialHighlight)
|
||||
? ['artifacts']
|
||||
: initialHighlight && isPageKey(initialHighlight)
|
||||
? ['pages']
|
||||
: legacyScopeToPath(initialScope, kinds, 'flat')
|
||||
subpageBranchKey
|
||||
? ['pages', subpageBranchKey]
|
||||
: initialHighlight && isArtifactKey(initialHighlight)
|
||||
? ['artifacts']
|
||||
: initialHighlight && isPageKey(initialHighlight)
|
||||
? ['pages']
|
||||
: legacyScopeToPath(initialScope, kinds, 'flat')
|
||||
)
|
||||
|
||||
const subpagePage = $derived(PREVIEW_PAGES.find((p) => p.path === subpages.path))
|
||||
const subpagesDenied = $derived(
|
||||
!!subpageBranchKey &&
|
||||
permissions.settled &&
|
||||
!!subpagePage &&
|
||||
!permissions.pageAllowed(subpagePage)
|
||||
)
|
||||
|
||||
// The flat root has no branch to carry a per-kind loading flag — surface
|
||||
@@ -406,27 +469,29 @@ section or the flat layout.
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
<DrillPicker
|
||||
bind:this={inner}
|
||||
{tree}
|
||||
onPick={(leaf) => pick(leaf.data)}
|
||||
initialScope={computedInitialScope}
|
||||
{initialHighlight}
|
||||
{externalFilter}
|
||||
{autoFocus}
|
||||
{flush}
|
||||
{leafIcon}
|
||||
{branchIcon}
|
||||
leafSecondary={(leaf, scope) =>
|
||||
leaf.data.type === 'item'
|
||||
? relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data.item), scope)
|
||||
: undefined}
|
||||
onScopeChange={(scope) => {
|
||||
if (scope.length > 0) loader.ensureForScopeSegment(scope[0])
|
||||
}}
|
||||
onFilterChange={loader.onFilterChange}
|
||||
leafAction={editAction}
|
||||
leafBadge={stateBadge}
|
||||
leafHref={targetHref ? (leaf) => targetHref(leaf.data) : undefined}
|
||||
{rootLoading}
|
||||
/>
|
||||
{#key subpagesDenied}
|
||||
<DrillPicker
|
||||
bind:this={inner}
|
||||
{tree}
|
||||
onPick={(leaf) => pick(leaf.data)}
|
||||
initialScope={subpagesDenied ? ['pages'] : computedInitialScope}
|
||||
{initialHighlight}
|
||||
{externalFilter}
|
||||
{autoFocus}
|
||||
{flush}
|
||||
{leafIcon}
|
||||
{branchIcon}
|
||||
leafSecondary={(leaf, scope) =>
|
||||
leaf.data.type === 'item'
|
||||
? relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data.item), scope)
|
||||
: undefined}
|
||||
onScopeChange={(scope) => {
|
||||
if (scope.length > 0) loader.ensureForScopeSegment(scope[0])
|
||||
}}
|
||||
onFilterChange={loader.onFilterChange}
|
||||
leafAction={editAction}
|
||||
leafBadge={stateBadge}
|
||||
leafHref={targetHref ? (leaf) => targetHref(leaf.data) : undefined}
|
||||
{rootLoading}
|
||||
/>
|
||||
{/key}
|
||||
|
||||
@@ -618,9 +618,11 @@
|
||||
|
||||
<Section>
|
||||
{#snippet action()}
|
||||
<div class="flex flex-row items-center gap-2 relative whitespace-nowrap w-full">
|
||||
<input placeholder="Filter members" bind:value={userFilter} class="input !pl-8 !w-56" />
|
||||
<Search class="absolute left-2" size={14} />
|
||||
<div class="flex flex-row flex-wrap items-center gap-2 whitespace-nowrap w-full">
|
||||
<div class="relative flex items-center">
|
||||
<input placeholder="Filter members" bind:value={userFilter} class="input !pl-8 !w-56" />
|
||||
<Search class="absolute left-2" size={14} />
|
||||
</div>
|
||||
|
||||
{#if !isAdminsWorkspaceWithoutEE}
|
||||
<Popover
|
||||
@@ -638,7 +640,7 @@
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#snippet content()}
|
||||
<div class="flex flex-col gap-4 p-4 w-[520px]">
|
||||
<div class="flex flex-col gap-4 p-4 w-[min(520px,calc(100vw-2rem))] whitespace-normal">
|
||||
<span class="text-sm font-semibold text-emphasis">Who joins without an invite</span>
|
||||
|
||||
<div class="flex flex-col gap-1">
|
||||
|
||||
@@ -180,8 +180,7 @@
|
||||
)
|
||||
function kindItems(current: string | undefined) {
|
||||
const showInstance = instanceAvailable || current === 'instance'
|
||||
const showExternal =
|
||||
externalAvailable || current === 'external_instance'
|
||||
const showExternal = externalAvailable || current === 'external_instance'
|
||||
const labels = managedInstanceLabels(
|
||||
instanceAvailable || anyInstanceRow,
|
||||
externalAvailable || anyExternalRow
|
||||
@@ -442,7 +441,7 @@
|
||||
</Label>
|
||||
<Label
|
||||
label="Database"
|
||||
class="flex-1 min-w-96"
|
||||
class="flex-1 basis-96 min-w-0"
|
||||
tooltip="The database where the data is stored."
|
||||
>
|
||||
{#if dataTable.reference}
|
||||
@@ -457,7 +456,7 @@
|
||||
</Tooltip>
|
||||
</div>
|
||||
{:else}
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<div class="relative">
|
||||
{#if dataTable.database.resource_type === 'instance'}
|
||||
<Tooltip
|
||||
@@ -491,7 +490,7 @@
|
||||
class="w-44"
|
||||
/>
|
||||
</div>
|
||||
<div class="flex items-center gap-1 w-80 relative">
|
||||
<div class="flex items-center gap-1 w-80 max-w-full relative">
|
||||
{#if dataTable.database.resource_type === 'external_instance'}
|
||||
<ExternalInstanceDbSelect
|
||||
class="flex-1"
|
||||
|
||||
@@ -0,0 +1,225 @@
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
import { WORKSPACE_SHOW_SLACK_CMD, WORKSPACE_SHOW_WEBHOOK_CLI_SYNC } from '$lib/consts'
|
||||
import type { PageHeaderSubpage } from '$lib/components/pageHeaderRegistry.svelte'
|
||||
import { WORKSPACE_SETTINGS_PATH } from '$lib/components/sessions/previewPaths'
|
||||
|
||||
export type WorkspaceSettingsSection = {
|
||||
id: string
|
||||
label: string
|
||||
aiId: string
|
||||
aiDescription: string
|
||||
showIf?: boolean
|
||||
isEE?: boolean
|
||||
}
|
||||
|
||||
/** The sections an admin sees in workspace settings, in sidebar order. Read outside the page as
|
||||
* well, by the session preview's picker, which lists them before the page has loaded. */
|
||||
export const WORKSPACE_SETTINGS_SECTION_GROUPS: {
|
||||
title?: string
|
||||
items: WorkspaceSettingsSection[]
|
||||
}[] = [
|
||||
{
|
||||
items: [
|
||||
{
|
||||
id: 'general',
|
||||
label: 'General',
|
||||
aiId: 'workspace-settings-general',
|
||||
aiDescription: 'General workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'users',
|
||||
label: 'Users',
|
||||
aiId: 'workspace-settings-users',
|
||||
aiDescription: 'Users workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'ai',
|
||||
label: 'Windmill AI',
|
||||
aiId: 'workspace-settings-ai',
|
||||
aiDescription: 'Windmill AI workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'premium',
|
||||
label: 'Premium plans',
|
||||
aiId: 'workspace-settings-premium',
|
||||
aiDescription: 'Premium plans workspace settings',
|
||||
showIf: isCloudHosted()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Git & deployment',
|
||||
items: [
|
||||
{
|
||||
id: 'git_sync',
|
||||
label: 'Git sync',
|
||||
aiId: 'workspace-settings-git-sync',
|
||||
aiDescription: 'Git sync workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'dev_workspace',
|
||||
label: 'Dev workspace',
|
||||
aiId: 'workspace-settings-dev-workspace',
|
||||
aiDescription:
|
||||
'Pair this workspace with a dev workspace (same code, different environment), and choose which items its deploy UI may promote'
|
||||
},
|
||||
{
|
||||
id: 'rulesets',
|
||||
label: 'Rulesets',
|
||||
aiId: 'workspace-settings-rulesets',
|
||||
aiDescription: 'Protection Rulesets workspace settings',
|
||||
isEE: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Integrations',
|
||||
items: [
|
||||
{
|
||||
id: 'slack',
|
||||
label: 'Slack / Teams',
|
||||
aiId: 'workspace-settings-slack',
|
||||
aiDescription: 'Slack / Teams workspace settings',
|
||||
showIf: WORKSPACE_SHOW_SLACK_CMD
|
||||
},
|
||||
{
|
||||
id: 'webhook',
|
||||
label: 'Webhook',
|
||||
aiId: 'workspace-settings-webhook',
|
||||
aiDescription: 'Webhook workspace settings',
|
||||
showIf: WORKSPACE_SHOW_WEBHOOK_CLI_SYNC && !isCloudHosted()
|
||||
},
|
||||
{
|
||||
id: 'native_triggers',
|
||||
label: 'Integration triggers',
|
||||
aiId: 'workspace-settings-integrations',
|
||||
aiDescription: 'Workspace integrations for integration triggers'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Hooks',
|
||||
items: [
|
||||
{
|
||||
id: 'error_handler',
|
||||
label: 'Error / success handler',
|
||||
aiId: 'workspace-settings-error-handler',
|
||||
aiDescription: 'Error and success handler workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'variable_expiration',
|
||||
label: 'Variable expiration',
|
||||
aiId: 'workspace-settings-variable-expiration',
|
||||
aiDescription:
|
||||
'Runnable executed when a variable value is about to expire, so the value can be rotated'
|
||||
},
|
||||
{
|
||||
id: 'critical_alerts',
|
||||
label: 'Critical alerts',
|
||||
aiId: 'workspace-settings-critical-alerts',
|
||||
aiDescription: 'Critical alerts workspace settings',
|
||||
isEE: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Data & storage',
|
||||
items: [
|
||||
{
|
||||
id: 'windmill_data_tables',
|
||||
label: 'Data tables',
|
||||
aiId: 'workspace-settings-windmill-data-tables',
|
||||
aiDescription: 'Data tables workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'windmill_lfs',
|
||||
label: 'Object storage (S3)',
|
||||
aiId: 'workspace-settings-windmill-lfs',
|
||||
aiDescription: 'Object Storage (S3) workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'volume_storage',
|
||||
label: 'Volumes',
|
||||
aiId: 'workspace-settings-volume-storage',
|
||||
aiDescription: 'Volume storage workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'ducklake',
|
||||
label: 'Ducklake',
|
||||
aiId: 'workspace-settings-ducklake',
|
||||
aiDescription: 'Ducklake workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'dbt',
|
||||
label: 'dbt',
|
||||
aiId: 'workspace-settings-dbt',
|
||||
aiDescription: 'dbt warehouses workspace settings'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Advanced',
|
||||
items: [
|
||||
{
|
||||
id: 'default_app',
|
||||
label: 'Apps',
|
||||
aiId: 'workspace-settings-apps',
|
||||
aiDescription: 'Apps workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'shared_ui',
|
||||
label: 'Shared UI folder',
|
||||
aiId: 'workspace-settings-shared-ui',
|
||||
aiDescription: 'Shared frontend folder usable by raw apps'
|
||||
},
|
||||
{
|
||||
id: 'dependencies',
|
||||
label: 'Dependencies',
|
||||
aiId: 'workspace-settings-dependencies',
|
||||
aiDescription: 'Workspace dependencies settings'
|
||||
},
|
||||
{
|
||||
id: 'encryption',
|
||||
label: 'Encryption',
|
||||
aiId: 'workspace-settings-encryption',
|
||||
aiDescription: 'Encryption workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'trashbin',
|
||||
label: 'Trashbin',
|
||||
aiId: 'workspace-settings-trashbin',
|
||||
aiDescription: 'Trashbin for recently deleted items'
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
/** Older `tab` values that open a section under another id. */
|
||||
const SECTION_ALIASES: Record<string, string> = {
|
||||
teams: 'slack',
|
||||
success_handler: 'error_handler',
|
||||
// The Deployment UI tab was folded into Dev workspace; its links keep working.
|
||||
deploy_to: 'dev_workspace'
|
||||
}
|
||||
|
||||
/** The section a `tab` query value opens. */
|
||||
export function workspaceSettingsSectionId(tab: string): string {
|
||||
return SECTION_ALIASES[tab] ?? tab
|
||||
}
|
||||
|
||||
/** The sections as picker subpages, each a link to `/workspace_settings?tab=<id>`. */
|
||||
export function workspaceSettingsSubpages(currentTab?: string): PageHeaderSubpage[] {
|
||||
return WORKSPACE_SETTINGS_SECTION_GROUPS.flatMap((group) =>
|
||||
group.items
|
||||
.filter((i) => i.showIf !== false)
|
||||
.map((i) => ({
|
||||
label: i.label,
|
||||
href: `${WORKSPACE_SETTINGS_PATH}?tab=${i.id}`,
|
||||
group: group.title,
|
||||
current: i.id === currentTab
|
||||
}))
|
||||
)
|
||||
}
|
||||
@@ -31,6 +31,8 @@
|
||||
import { cubicOut } from 'svelte/easing'
|
||||
import { useReducedMotion } from '$lib/svelte5Utils.svelte'
|
||||
import Popover from '$lib/components/meltComponents/Popover.svelte'
|
||||
import { WORKSPACE_SETTINGS_PATH } from '$lib/components/sessions/previewPaths'
|
||||
import { workspaceSettingsSectionId } from '$lib/components/workspaceSettings/workspaceSettingsSections'
|
||||
import PreviewRouterPicker, {
|
||||
type Scope
|
||||
} from '$lib/components/sessions/PreviewRouterPicker.svelte'
|
||||
@@ -814,11 +816,17 @@
|
||||
parsedRoute
|
||||
? leafKeyFor(parsedRoute.kind, parsedRoute.itemPath)
|
||||
: currentPage
|
||||
? pageKey(currentPage.path)
|
||||
? pageKey(currentPage.path + sectionQuery(displayPath))
|
||||
: activeArtifact
|
||||
? artifactKey(activeArtifact.id)
|
||||
: undefined
|
||||
)
|
||||
// A workspace settings section is a subpage of its own in the picker, keyed with its `tab`.
|
||||
function sectionQuery(path: string): string {
|
||||
if (currentPage?.path !== WORKSPACE_SETTINGS_PATH) return ''
|
||||
const tab = new URL(path, window.location.origin).searchParams.get('tab')
|
||||
return tab ? `?tab=${workspaceSettingsSectionId(tab)}` : ''
|
||||
}
|
||||
let activeTabPickerOpen = $state(false)
|
||||
/** Measured width of the floating action controls, reserved as the tab strip's right
|
||||
* padding so tabs stop before them instead of scrolling underneath. */
|
||||
|
||||
@@ -29,7 +29,10 @@
|
||||
import ForkMemberSettings from '$lib/components/settings/ForkMemberSettings.svelte'
|
||||
import SettingsPageHeader from '$lib/components/settings/SettingsPageHeader.svelte'
|
||||
import MemberWorkspaceSettings from '$lib/components/settings/MemberWorkspaceSettings.svelte'
|
||||
import { WORKSPACE_SHOW_SLACK_CMD, WORKSPACE_SHOW_WEBHOOK_CLI_SYNC } from '$lib/consts'
|
||||
import {
|
||||
WORKSPACE_SETTINGS_SECTION_GROUPS,
|
||||
workspaceSettingsSectionId
|
||||
} from '$lib/components/workspaceSettings/workspaceSettingsSections'
|
||||
import {
|
||||
OauthService,
|
||||
SlackAgentsService,
|
||||
@@ -58,9 +61,13 @@
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { clone, emptyString, encodeState, hasUnsavedChanges } from '$lib/utils'
|
||||
import { downloadViaClient, shouldDownloadViaClient } from '$lib/utils/downloadFile'
|
||||
import { ExternalLink, Slack, Target } from 'lucide-svelte'
|
||||
import { ArrowLeft, ExternalLink, Slack, Target } from 'lucide-svelte'
|
||||
import DropdownV2 from '$lib/components/DropdownV2.svelte'
|
||||
import { pageHeader } from '$lib/components/pageHeaderRegistry.svelte'
|
||||
import {
|
||||
pageHeader,
|
||||
type PageHeaderSection,
|
||||
type PageHeaderSubpage
|
||||
} from '$lib/components/pageHeaderRegistry.svelte'
|
||||
import SidebarNavigation from '$lib/components/common/sidebar/SidebarNavigation.svelte'
|
||||
|
||||
import PremiumInfo from '$lib/components/settings/PremiumInfo.svelte'
|
||||
@@ -594,19 +601,12 @@
|
||||
| 'dependencies'
|
||||
| 'rulesets'
|
||||
| 'shared_ui'
|
||||
// Both 'slack' and 'teams' URLs map to 'slack' tab
|
||||
if (selectedTab === 'teams') {
|
||||
return 'slack'
|
||||
}
|
||||
// Both 'success_handler' and 'error_handler' URLs map to 'error_handler' tab
|
||||
if (selectedTab === 'success_handler') {
|
||||
return 'error_handler'
|
||||
}
|
||||
// The Deployment UI tab was folded into Dev workspace; keep its links working.
|
||||
if (selectedTab === 'deploy_to') {
|
||||
return 'dev_workspace'
|
||||
}
|
||||
return selectedTab || 'users'
|
||||
return selectedTab
|
||||
? (workspaceSettingsSectionId(selectedTab) as Exclude<
|
||||
typeof selectedTab,
|
||||
'teams' | 'success_handler' | 'deploy_to'
|
||||
>)
|
||||
: 'users'
|
||||
})
|
||||
|
||||
let slack_tabs: 'slack_commands' | 'teams_commands' = $derived(
|
||||
@@ -1547,192 +1547,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Navigation groups for sidebar
|
||||
const adminNavigationGroups = $derived([
|
||||
{
|
||||
items: [
|
||||
{
|
||||
id: 'general',
|
||||
label: 'General',
|
||||
aiId: 'workspace-settings-general',
|
||||
aiDescription: 'General workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'users',
|
||||
label: 'Users',
|
||||
aiId: 'workspace-settings-users',
|
||||
aiDescription: 'Users workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'ai',
|
||||
label: 'Windmill AI',
|
||||
aiId: 'workspace-settings-ai',
|
||||
aiDescription: 'Windmill AI workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'premium',
|
||||
label: 'Premium plans',
|
||||
aiId: 'workspace-settings-premium',
|
||||
aiDescription: 'Premium plans workspace settings',
|
||||
showIf: isCloudHosted()
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Git & deployment',
|
||||
items: [
|
||||
{
|
||||
id: 'git_sync',
|
||||
label: 'Git sync',
|
||||
aiId: 'workspace-settings-git-sync',
|
||||
aiDescription: 'Git sync workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'dev_workspace',
|
||||
label: 'Dev workspace',
|
||||
aiId: 'workspace-settings-dev-workspace',
|
||||
aiDescription:
|
||||
'Pair this workspace with a dev workspace (same code, different environment), and choose which items its deploy UI may promote'
|
||||
},
|
||||
{
|
||||
id: 'rulesets',
|
||||
label: 'Rulesets',
|
||||
aiId: 'workspace-settings-rulesets',
|
||||
aiDescription: 'Protection Rulesets workspace settings',
|
||||
isEE: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Integrations',
|
||||
items: [
|
||||
{
|
||||
id: 'slack',
|
||||
label: 'Slack / Teams',
|
||||
aiId: 'workspace-settings-slack',
|
||||
aiDescription: 'Slack / Teams workspace settings',
|
||||
showIf: WORKSPACE_SHOW_SLACK_CMD
|
||||
},
|
||||
{
|
||||
id: 'webhook',
|
||||
label: 'Webhook',
|
||||
aiId: 'workspace-settings-webhook',
|
||||
aiDescription: 'Webhook workspace settings',
|
||||
showIf: WORKSPACE_SHOW_WEBHOOK_CLI_SYNC && !isCloudHosted()
|
||||
},
|
||||
{
|
||||
id: 'native_triggers',
|
||||
label: 'Integration triggers',
|
||||
aiId: 'workspace-settings-integrations',
|
||||
aiDescription: 'Workspace integrations for integration triggers'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Hooks',
|
||||
items: [
|
||||
{
|
||||
id: 'error_handler',
|
||||
label: 'Error / success handler',
|
||||
aiId: 'workspace-settings-error-handler',
|
||||
aiDescription: 'Error and success handler workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'variable_expiration',
|
||||
label: 'Variable expiration',
|
||||
aiId: 'workspace-settings-variable-expiration',
|
||||
aiDescription:
|
||||
'Runnable executed when a variable value is about to expire, so the value can be rotated'
|
||||
},
|
||||
{
|
||||
id: 'critical_alerts',
|
||||
label: 'Critical alerts',
|
||||
aiId: 'workspace-settings-critical-alerts',
|
||||
aiDescription: 'Critical alerts workspace settings',
|
||||
isEE: true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Data & storage',
|
||||
items: [
|
||||
{
|
||||
id: 'windmill_data_tables',
|
||||
label: 'Data tables',
|
||||
aiId: 'workspace-settings-windmill-data-tables',
|
||||
aiDescription: 'Data tables workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'windmill_lfs',
|
||||
label: 'Object storage (S3)',
|
||||
aiId: 'workspace-settings-windmill-lfs',
|
||||
aiDescription: 'Object Storage (S3) workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'volume_storage',
|
||||
label: 'Volumes',
|
||||
aiId: 'workspace-settings-volume-storage',
|
||||
aiDescription: 'Volume storage workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'ducklake',
|
||||
label: 'Ducklake',
|
||||
aiId: 'workspace-settings-ducklake',
|
||||
aiDescription: 'Ducklake workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'dbt',
|
||||
label: 'dbt',
|
||||
aiId: 'workspace-settings-dbt',
|
||||
aiDescription: 'dbt warehouses workspace settings'
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
title: 'Advanced',
|
||||
items: [
|
||||
{
|
||||
id: 'default_app',
|
||||
label: 'Apps',
|
||||
aiId: 'workspace-settings-apps',
|
||||
aiDescription: 'Apps workspace settings',
|
||||
isEE: true
|
||||
},
|
||||
{
|
||||
id: 'shared_ui',
|
||||
label: 'Shared UI folder',
|
||||
aiId: 'workspace-settings-shared-ui',
|
||||
aiDescription: 'Shared frontend folder usable by raw apps'
|
||||
},
|
||||
{
|
||||
id: 'dependencies',
|
||||
label: 'Dependencies',
|
||||
aiId: 'workspace-settings-dependencies',
|
||||
aiDescription: 'Workspace dependencies settings'
|
||||
},
|
||||
{
|
||||
id: 'encryption',
|
||||
label: 'Encryption',
|
||||
aiId: 'workspace-settings-encryption',
|
||||
aiDescription: 'Encryption workspace settings'
|
||||
},
|
||||
{
|
||||
id: 'trashbin',
|
||||
label: 'Trashbin',
|
||||
aiId: 'workspace-settings-trashbin',
|
||||
aiDescription: 'Trashbin for recently deleted items'
|
||||
}
|
||||
]
|
||||
}
|
||||
])
|
||||
|
||||
// A fork's creator manages its members through the same screen, but nothing else about the
|
||||
// workspace is theirs to change, so they get the Members entry alone.
|
||||
const navigationGroups = $derived(
|
||||
canAdmin
|
||||
? adminNavigationGroups
|
||||
? WORKSPACE_SETTINGS_SECTION_GROUPS
|
||||
: [
|
||||
{
|
||||
items: [
|
||||
@@ -1764,6 +1583,70 @@
|
||||
params.set('tab', id)
|
||||
return `?${params.toString()}`
|
||||
}
|
||||
function sectionListHref(): string {
|
||||
const params = new URLSearchParams($page.url.searchParams)
|
||||
params.delete('tab')
|
||||
const query = params.toString()
|
||||
return query ? `?${query}` : WORKSPACE_SETTINGS_PATH
|
||||
}
|
||||
|
||||
// Below 768px (Tailwind `md`) the sidebar would leave a phone or a session preview a sliver for
|
||||
// the settings, so the list and the section become two pages. Measured on the page's own box
|
||||
// rather than the viewport: the app's sidebar takes its share of a viewport first.
|
||||
let layoutWidth = $state(window.innerWidth)
|
||||
type SectionEntry = { id: string; label: string; showIf?: boolean; disabled?: boolean }
|
||||
const sectionGroups = $derived(
|
||||
navigationGroups.map((g) => ({
|
||||
title: g.title as string | undefined,
|
||||
items: (g.items as SectionEntry[]).filter((i) => i.showIf !== false)
|
||||
}))
|
||||
)
|
||||
const visibleSections = $derived(sectionGroups.flatMap((g) => g.items))
|
||||
const pagedLayout = $derived(layoutWidth < 768 && !showYaml && visibleSections.length > 1)
|
||||
// The URL says which page is on screen, so the browser's back button returns to the list and
|
||||
// a link to a section opens on it. Wide, a missing `tab` still means the default section.
|
||||
const sectionOpen = $derived($page.url.searchParams.has('tab'))
|
||||
// The list and the section slide between each other the way `PagedContent` pages do: the
|
||||
// page arriving travels a quarter of the box and fades in, the page leaving vanishes at once
|
||||
// so it never ghosts over the one arriving. `side` is where a hidden page waits.
|
||||
function slidingPage(shown: boolean, side: -1 | 1): string {
|
||||
const offset = shown ? '' : side < 0 ? '-translate-x-1/4' : 'translate-x-1/4'
|
||||
return `absolute inset-0 motion-reduce:!transition-none ${offset} ${shown ? '' : 'opacity-0 pointer-events-none'}`
|
||||
}
|
||||
function slideTransition(shown: boolean): string {
|
||||
return `transform 130ms ease-out, opacity ${shown ? '90ms' : '0s'} ease-out`
|
||||
}
|
||||
// None for a single section (a fork owner's Members): Workspace settings is admin-only, so the
|
||||
// picker has no branch to list it under.
|
||||
const subpages: PageHeaderSubpage[] | undefined = $derived(
|
||||
visibleSections.length < 2
|
||||
? undefined
|
||||
: sectionGroups.flatMap((group) =>
|
||||
group.items.map((i) => ({
|
||||
label: i.label,
|
||||
href: WORKSPACE_SETTINGS_PATH + tabHref(i.id),
|
||||
group: group.title,
|
||||
current: i.id === tab,
|
||||
disabled: i.disabled
|
||||
}))
|
||||
)
|
||||
)
|
||||
const headerSection: PageHeaderSection | undefined = $derived(
|
||||
showYaml
|
||||
? { parent: 'Workspace settings', label: 'YAML' }
|
||||
: pagedLayout
|
||||
? sectionOpen && tabLabel
|
||||
? {
|
||||
parent: 'Workspace settings',
|
||||
parentHref: sectionListHref(),
|
||||
label: tabLabel,
|
||||
subpages
|
||||
}
|
||||
: undefined
|
||||
: tabLabel
|
||||
? { parent: 'Workspace settings', label: tabLabel, subpages }
|
||||
: undefined
|
||||
)
|
||||
</script>
|
||||
|
||||
<CenteredPage wrapperClasses="pb-0 h-full" handleOverflow={false} class="flex flex-col h-full">
|
||||
@@ -1774,37 +1657,77 @@
|
||||
two controls that sat beside the title are the page's actions. The panes below scroll
|
||||
inside themselves, so the bar keeps its edge at rest rather than only under a scroll. -->
|
||||
<PageHeaderContent
|
||||
section={showYaml
|
||||
? { parent: 'Workspace settings', label: 'YAML' }
|
||||
: tabLabel
|
||||
? { parent: 'Workspace settings', label: tabLabel }
|
||||
: undefined}
|
||||
section={headerSection}
|
||||
actions={settingsActions}
|
||||
{sessionSource}
|
||||
actionFolds={1}
|
||||
separator="always"
|
||||
/>
|
||||
|
||||
<div class="flex grow min-h-0 pb-4">
|
||||
<!-- Sidebar Navigation -->
|
||||
<!-- The top padding belongs inside both scrollers, not above them: it is the gap under the
|
||||
separator at rest, and it has to travel with the content so what scrolls passes under
|
||||
the line rather than stopping short of it. -->
|
||||
{#if !showYaml}
|
||||
<div class="w-60 shrink-0 h-full overflow-auto pt-6 pb-4 pr-4 -ml-2">
|
||||
<SidebarNavigation
|
||||
groups={navigationGroups}
|
||||
selectedId={tab}
|
||||
onNavigate={(id) => goto(tabHref(id))}
|
||||
itemHref={tabHref}
|
||||
/>
|
||||
<div class="flex grow min-h-0 pb-4" bind:clientWidth={layoutWidth}>
|
||||
<!-- One tree for both layouts, which differ only in classes: a section moved to another
|
||||
parent would be rebuilt, losing the unsaved edits it keeps in its own state.
|
||||
Narrow, the negative margin undoes CenteredPage's side padding, which each page puts
|
||||
back inside its scroller: the box clips, so a scroller inside the padding would have
|
||||
its scrollbar cut and a gap beside it. -->
|
||||
<div
|
||||
class="flex flex-1 min-w-0 h-full {pagedLayout
|
||||
? 'relative overflow-hidden -mx-4 sm:-mx-6 md:-mx-8'
|
||||
: ''}"
|
||||
>
|
||||
{#if !showYaml}
|
||||
<!-- The top padding belongs inside both scrollers, not above them: it is the gap
|
||||
under the separator at rest, and it has to travel with the content so what
|
||||
scrolls passes under the line rather than stopping short of it. Narrow, 8px
|
||||
short of the page gutter: the entries carry their own. -->
|
||||
<div
|
||||
class={pagedLayout
|
||||
? `${slidingPage(!sectionOpen, -1)} overflow-auto pt-4 pb-4 px-2 sm:px-4 md:px-6`
|
||||
: 'w-60 shrink-0 h-full overflow-auto pt-6 pb-4 pr-4 -ml-2'}
|
||||
style:transition={pagedLayout ? slideTransition(!sectionOpen) : undefined}
|
||||
inert={pagedLayout && sectionOpen}
|
||||
>
|
||||
<!-- Capped narrow so a row's hover band stays the size of a menu entry. -->
|
||||
<SidebarNavigation
|
||||
class={pagedLayout ? 'max-w-sm' : ''}
|
||||
groups={navigationGroups}
|
||||
selectedId={pagedLayout && !sectionOpen ? '' : tab}
|
||||
onNavigate={(id) => goto(tabHref(id))}
|
||||
itemHref={tabHref}
|
||||
drillIn={pagedLayout}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
class={pagedLayout ? `${slidingPage(sectionOpen, 1)} flex` : 'flex flex-1 min-w-0 h-full'}
|
||||
style:transition={pagedLayout ? slideTransition(sectionOpen) : undefined}
|
||||
inert={pagedLayout && !sectionOpen}
|
||||
>
|
||||
{@render sectionPane()}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Main Content -->
|
||||
<div class="flex-1 min-w-0 h-full">
|
||||
<div class="h-full overflow-auto">
|
||||
<div class="h-fit px-6 pt-6" style="scrollbar-gutter: stable both-edges;">
|
||||
{#snippet sectionPane()}
|
||||
<div class="flex-1 min-w-0 h-full flex flex-col">
|
||||
{#if pagedLayout}
|
||||
<div class="flex pt-3 px-4 sm:px-6 md:px-8">
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="xs"
|
||||
startIcon={{ icon: ArrowLeft }}
|
||||
btnClasses="text-secondary"
|
||||
href={sectionListHref()}
|
||||
>
|
||||
All settings
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="grow min-h-0 overflow-auto">
|
||||
<div
|
||||
class="h-fit {pagedLayout ? 'px-4 sm:px-6 md:px-8 pt-3' : 'px-6 pt-6'}"
|
||||
style="scrollbar-gutter: stable both-edges;"
|
||||
>
|
||||
{#if !loadedSettings}
|
||||
<Skeleton layout={[1, [40]]} />
|
||||
{:else if showYaml}
|
||||
@@ -2216,7 +2139,7 @@
|
||||
documentation for more information.
|
||||
</p>
|
||||
{/if}
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-x-2">
|
||||
<Button
|
||||
destructive
|
||||
disabled={$workspaceStore === 'admins' || $workspaceStore === 'starter'}
|
||||
@@ -2936,7 +2859,7 @@ export async function main(
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{/snippet}
|
||||
{:else}
|
||||
<PageHeaderContent separator="always" />
|
||||
<MemberWorkspaceSettings />
|
||||
|
||||
Reference in New Issue
Block a user