mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-17 00:20:51 +00:00
fix: make in-app navigation targets real links for new-tab clicks (#12202)
* fix: open list rows in a new tab on middle and ctrl/cmd-click Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * test: cover openOnNewTabClick nested-control and modifier handling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * refactor: drop the JS new-tab handler from run rows, keep only real links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: make in-app navigation targets real links across the frontend Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: share one modified-click predicate and keep run args out of edit links Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: decode group deep-link hashes before matching names Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: encode group names in deep-link hashes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: keep converted link rows in their text colour and palette links out of tab order Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: clear the resource-type hash on close, close run menus on middle-click Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: run portalled picker and palette link handlers before sveltekit follows the href Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> * fix: encode native-trigger ids in deep-link hashes Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
This commit is contained in:
co-authored by
Claude Opus 5.5
Ruben Fiszel
parent
f6c4b260d5
commit
070dc488e6
@@ -128,6 +128,10 @@ highlighted, a workspace page inside Pages with that page highlighted.
|
||||
{currentItem}
|
||||
artifacts={artifacts?.items}
|
||||
workspaceId={actingWorkspaceId}
|
||||
targetHref={(target) => {
|
||||
const href = hrefFor(target)
|
||||
return href ? withWorkspace(href) : undefined
|
||||
}}
|
||||
onPick={pick}
|
||||
/>
|
||||
{/snippet}
|
||||
|
||||
@@ -30,6 +30,8 @@ close siblings.
|
||||
/** Load the picker's items from this workspace (session editors pass their
|
||||
* acting workspace); falls back to $workspaceStore inside the picker. */
|
||||
workspaceId?: string
|
||||
/** Where picking an item navigates; see `WorkspaceItemDrillPicker`. */
|
||||
itemHref?: (item: WorkspaceItem) => string
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -42,7 +44,8 @@ close siblings.
|
||||
isCurrent = false,
|
||||
currentItem,
|
||||
onPick,
|
||||
workspaceId
|
||||
workspaceId,
|
||||
itemHref
|
||||
}: Props = $props()
|
||||
|
||||
let isOpen = $state(false)
|
||||
@@ -80,6 +83,7 @@ close siblings.
|
||||
{initialHighlight}
|
||||
{currentItem}
|
||||
{workspaceId}
|
||||
{itemHref}
|
||||
onPick={handlePick}
|
||||
/>
|
||||
{/snippet}
|
||||
|
||||
@@ -20,8 +20,13 @@
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
import ContentSearchInnerItem from './ContentSearchInnerItem.svelte'
|
||||
import { createEventDispatcher, untrack } from 'svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
function closeUnlessNewTab(e?: Event) {
|
||||
if (!(e instanceof MouseEvent && isNewTabClick(e))) dispatch('close')
|
||||
}
|
||||
interface Props {
|
||||
search?: string
|
||||
}
|
||||
@@ -249,7 +254,7 @@
|
||||
<Button
|
||||
href={`/scripts/get/${item.path}`}
|
||||
startIcon={{ icon: ExternalLink }}
|
||||
on:click={() => dispatch('close')}
|
||||
onClick={closeUnlessNewTab}
|
||||
>
|
||||
Open
|
||||
</Button>
|
||||
@@ -281,7 +286,7 @@
|
||||
{#each filteredResourceItems.slice(0, showNbResources) ?? [] as item}
|
||||
<ContentSearchInnerItem
|
||||
title={`Resource: ${item.path}`}
|
||||
href={`/resources#${item.path}`}
|
||||
href={`/resources#/resource/${item.path}`}
|
||||
on:close
|
||||
>
|
||||
{#snippet actions()}
|
||||
@@ -294,7 +299,11 @@
|
||||
{/snippet}
|
||||
</Tooltip>
|
||||
{/if}
|
||||
<Button href={`/resources#${item.path}`} target="_blank" startIcon={{ icon: Edit }}>
|
||||
<Button
|
||||
href={`/resources#/resource/${item.path}`}
|
||||
target="_blank"
|
||||
startIcon={{ icon: Edit }}
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
{/snippet}
|
||||
@@ -325,7 +334,7 @@
|
||||
<Button
|
||||
href={`/flows/get/${item.path}`}
|
||||
startIcon={{ icon: ExternalLink }}
|
||||
on:click={() => dispatch('close')}
|
||||
onClick={closeUnlessNewTab}
|
||||
>
|
||||
Open
|
||||
</Button>
|
||||
@@ -365,7 +374,7 @@
|
||||
<Button
|
||||
href={`/apps/get/${item.path}`}
|
||||
startIcon={{ icon: ExternalLink }}
|
||||
on:click={() => dispatch('close')}
|
||||
onClick={closeUnlessNewTab}
|
||||
>
|
||||
Open
|
||||
</Button>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
interface Props {
|
||||
title: string
|
||||
@@ -18,8 +19,8 @@
|
||||
<a
|
||||
class="text-accent truncate text-xs"
|
||||
{href}
|
||||
onclick={() => {
|
||||
dispatch('close')
|
||||
onclick={(e) => {
|
||||
if (!isNewTabClick(e)) dispatch('close')
|
||||
}}
|
||||
>
|
||||
{title}
|
||||
|
||||
@@ -1,13 +1,26 @@
|
||||
<script lang="ts" module>
|
||||
import type { Item } from '$lib/utils'
|
||||
|
||||
export type DeployDropdownItem =
|
||||
| {
|
||||
label: string
|
||||
/** Gets the message typed in the hover popover, for items that deploy. */
|
||||
onClick: (deploymentMsg: string) => void
|
||||
}
|
||||
| {
|
||||
label: string
|
||||
/** Renders a link, for an item that only navigates. */
|
||||
href: string
|
||||
hrefTarget?: Item['hrefTarget']
|
||||
}
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
import { Button } from '$lib/components/common'
|
||||
import { Save, CornerDownLeft } from 'lucide-svelte'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
|
||||
type DropdownItem = {
|
||||
label: string
|
||||
/** Gets the message typed in the hover popover, for items that deploy. */
|
||||
onClick: (deploymentMsg: string) => void
|
||||
}
|
||||
type DropdownItem = DeployDropdownItem
|
||||
|
||||
const {
|
||||
loading = false,
|
||||
@@ -36,7 +49,9 @@
|
||||
}
|
||||
|
||||
function withMessage(items: DropdownItem[]) {
|
||||
return items.map((item) => ({ ...item, onClick: () => item.onClick(deploymentMsg) }))
|
||||
return items.map((item) =>
|
||||
'href' in item ? item : { ...item, onClick: () => item.onClick(deploymentMsg) }
|
||||
)
|
||||
}
|
||||
let items = $derived(
|
||||
typeof dropdownItems === 'function'
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { switchWorkspace } from '$lib/storeUtils'
|
||||
import { goto } from '$app/navigation'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import {
|
||||
findCanonicalDevWorkspace,
|
||||
findWorkspaceAncestors,
|
||||
@@ -244,20 +244,29 @@
|
||||
|
||||
// With a name, deep-links into that rule's drawer; without one, the rulesets list. Built from
|
||||
// scratch rather than from the current query so no stale `?workspace=<dev>` survives a switch.
|
||||
function rulesetsHref(name?: string): string {
|
||||
function rulesetsHref(name?: string, workspace?: string): string {
|
||||
const rule = name ? `&rule=${encodeURIComponent(name)}` : ''
|
||||
return `/workspace_settings?tab=rulesets${rule}`
|
||||
const ws = workspace ? `&workspace=${encodeURIComponent(workspace)}` : ''
|
||||
return `/workspace_settings?tab=rulesets${rule}${ws}`
|
||||
}
|
||||
|
||||
function openRulesets(name?: string) {
|
||||
goto(rulesetsHref(name))
|
||||
}
|
||||
type RulesetsLink = { href: (name?: string) => string; onclick?: (e?: Event) => void }
|
||||
|
||||
function openRulesetsInParent(name?: string) {
|
||||
if (!parentId) return
|
||||
switchWorkspace(parentId)
|
||||
goto(rulesetsHref(name))
|
||||
}
|
||||
const ownRulesetsLink: RulesetsLink = { href: (name) => rulesetsHref(name) }
|
||||
|
||||
// The `?workspace=` param is what switches a new tab; this tab switches through the store,
|
||||
// which also resets the protection rules state of the workspace it leaves.
|
||||
let parentRulesetsLink: RulesetsLink | undefined = $derived.by(() => {
|
||||
const id = parentId
|
||||
if (!id || !canEditParentRules) return undefined
|
||||
return {
|
||||
href: (name) => rulesetsHref(name, id),
|
||||
onclick: (e) => {
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
switchWorkspace(id)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// Reparenting an ancestor below this workspace would close a parent<->child cycle, which the
|
||||
// backend rejects: with a dev workspace allowed as prod, the family root is such an ancestor and
|
||||
@@ -349,18 +358,18 @@
|
||||
</script>
|
||||
|
||||
<!-- The locks are protection rules, so being paired does not imply them: a pairing that came from the
|
||||
deploy_to migration rather than from an attach carries neither. `onOpen` navigates to the rules
|
||||
deploy_to migration rather than from an attach carries neither. `open` links to the rules
|
||||
of the workspace this panel describes, which is not the active one on the dev side; it is
|
||||
undefined when the reader is not an admin there. The labels name that workspace in that case,
|
||||
so the button does not switch workspaces without saying so. -->
|
||||
{#snippet protectionsPanel(opts: {
|
||||
title: string
|
||||
rules: ReturnType<typeof useProtectionRules>
|
||||
onOpen?: (name?: string) => void
|
||||
open?: RulesetsLink
|
||||
editLabel: string
|
||||
manageLabel: string
|
||||
})}
|
||||
{@const onOpen = opts.onOpen}
|
||||
{@const open = opts.open}
|
||||
{@const rules = opts.rules}
|
||||
<div class="flex flex-col gap-1 rounded-md border bg-surface-secondary p-3">
|
||||
<span class="text-xs font-semibold text-emphasis">{opts.title}</span>
|
||||
@@ -397,12 +406,13 @@
|
||||
<span class="text-2xs text-secondary">Applied by this pairing</span>
|
||||
{/if}
|
||||
</div>
|
||||
{#if onOpen}
|
||||
{#if open}
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="2xs"
|
||||
startIcon={{ icon: Pen }}
|
||||
onclick={() => onOpen(ruleset.name)}
|
||||
href={open.href(ruleset.name)}
|
||||
onClick={open.onclick}
|
||||
>
|
||||
{opts.editLabel}
|
||||
</Button>
|
||||
@@ -412,9 +422,9 @@
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{#if onOpen && rules.enforcingRulesets.length === 0}
|
||||
{#if open && rules.enforcingRulesets.length === 0}
|
||||
<div class="self-start mt-1">
|
||||
<Button variant="subtle" unifiedSize="2xs" onclick={() => onOpen()}>
|
||||
<Button variant="subtle" unifiedSize="2xs" href={open.href()} onClick={open.onclick}>
|
||||
{opts.manageLabel}
|
||||
</Button>
|
||||
</div>
|
||||
@@ -435,7 +445,7 @@
|
||||
{@render protectionsPanel({
|
||||
title: 'Protections in force on this workspace',
|
||||
rules: ownRules,
|
||||
onOpen: openRulesets,
|
||||
open: ownRulesetsLink,
|
||||
editLabel: 'Edit',
|
||||
manageLabel: 'Manage in Rulesets'
|
||||
})}
|
||||
@@ -547,7 +557,7 @@
|
||||
<Button
|
||||
variant="default"
|
||||
startIcon={{ icon: GitFork }}
|
||||
onclick={() => goto('/user/fork_workspace?dev=true')}
|
||||
href="/user/fork_workspace?dev=true"
|
||||
>
|
||||
Create a new dev workspace
|
||||
</Button>
|
||||
@@ -605,7 +615,7 @@
|
||||
{@render protectionsPanel({
|
||||
title: `Protections in force on ${parentId}`,
|
||||
rules: parentRules,
|
||||
onOpen: canEditParentRules ? openRulesetsInParent : undefined,
|
||||
open: parentRulesetsLink,
|
||||
editLabel: `Edit in ${parentId}`,
|
||||
manageLabel: `Manage in ${parentId}`
|
||||
})}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
import { GitCompareArrows, Pencil, Wrench } from 'lucide-svelte'
|
||||
import { DraftService, type UserDraftItemKind } from '$lib/gen'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { OtherUserDraftLoad, editRouteFor } from '$lib/components/otherUserDraftLoad.svelte'
|
||||
import { fetchDeployedValueForDiff } from '$lib/components/otherUserDraftDiff'
|
||||
import { roleCapabilities, userStore } from '$lib/stores'
|
||||
@@ -328,7 +327,7 @@
|
||||
variant="subtle"
|
||||
size="xs3"
|
||||
startIcon={{ icon: Pencil }}
|
||||
on:click={() => goto(editRouteFor(itemKind, path))}
|
||||
href={editRouteFor(itemKind, path)}
|
||||
>
|
||||
Edit
|
||||
</Button>
|
||||
|
||||
@@ -35,6 +35,7 @@ leaves and ignores the current scope.
|
||||
import Badge from '$lib/components/common/badge/Badge.svelte'
|
||||
import type { BadgeColor } from '$lib/components/common/badge/model'
|
||||
import Button from '$lib/components/common/button/Button.svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
interface Props {
|
||||
tree: DrillNode<L>[]
|
||||
@@ -88,6 +89,11 @@ leaves and ignores the current scope.
|
||||
/** Status badge on the right of a leaf row. Returns `undefined` for a leaf with
|
||||
* nothing to report. The hover action, when there is one, covers it. */
|
||||
leafBadge?: (leaf: DrillLeaf<L>) => { label: string; color: BadgeColor } | undefined
|
||||
/** Where picking a leaf navigates, for a host whose pick is a navigation. The row then
|
||||
* renders as a link: a plain click still goes through `onPick`, while a middle or
|
||||
* ⌘/Ctrl-click opens it in a new tab — taking ⌘/Ctrl-click from `leafAction`, which
|
||||
* keeps ⌘/Ctrl-Enter. */
|
||||
leafHref?: (leaf: DrillLeaf<L>) => string | undefined
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -106,7 +112,8 @@ leaves and ignores the current scope.
|
||||
rootLoading = false,
|
||||
rowTooltip,
|
||||
leafAction,
|
||||
leafBadge
|
||||
leafBadge,
|
||||
leafHref
|
||||
}: Props = $props()
|
||||
|
||||
let searchInput: TextInput | undefined = $state()
|
||||
@@ -517,6 +524,7 @@ leaves and ignores the current scope.
|
||||
{@const tip = rowTooltip?.(leaf)}
|
||||
{@const action = leaf.disabled ? undefined : leafAction?.(leaf)}
|
||||
{@const badge = leafBadge?.(leaf)}
|
||||
{@const href = leaf.disabled ? undefined : leafHref?.(leaf)}
|
||||
<!-- The row's action sits BESIDE the option rather than inside it: a button nested in
|
||||
a button is invalid markup. The wrapper carries the row's padding, highlight and
|
||||
hover group so the two still read as one row. -->
|
||||
@@ -533,8 +541,10 @@ leaves and ignores the current scope.
|
||||
}}
|
||||
onmouseleave={tooltipLeave}
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'button'}
|
||||
type={href ? undefined : 'button'}
|
||||
{href}
|
||||
id={idFor(key)}
|
||||
role="option"
|
||||
aria-selected={isHl}
|
||||
@@ -543,10 +553,18 @@ leaves and ignores the current scope.
|
||||
aria-label={tip ? `${leaf.label} — ${tip}` : undefined}
|
||||
class="min-w-0 flex-1 text-left flex items-center gap-2 pl-3 {isCur
|
||||
? 'cursor-default text-emphasis font-medium'
|
||||
: ''} {leaf.disabled ? 'opacity-50 cursor-not-allowed' : ''}"
|
||||
disabled={leaf.disabled}
|
||||
onmousedown={(e) => e.preventDefault()}
|
||||
onclick={(e) => pick(leaf, e.metaKey || e.ctrlKey)}
|
||||
: 'text-[color:inherit]'} {leaf.disabled ? 'opacity-50 cursor-not-allowed' : ''}"
|
||||
disabled={href ? undefined : leaf.disabled}
|
||||
tabindex={0}
|
||||
onmousedown={(e: MouseEvent) => e.preventDefault()}
|
||||
onclickcapture={(e: MouseEvent) => {
|
||||
// Capture, not a delegated onclick: the picker is portalled outside the app root,
|
||||
// where a delegated handler runs after SvelteKit's link handler has already
|
||||
// followed the href, too late for preventDefault to keep a plain click on `pick`.
|
||||
if (href && isNewTabClick(e)) return
|
||||
e.preventDefault()
|
||||
pick(leaf, e.metaKey || e.ctrlKey)
|
||||
}}
|
||||
>
|
||||
{@render defaultLeafIcon(leaf)}
|
||||
<!-- Centred in a two-line row's height so a one-line leaf sits where a two-line
|
||||
@@ -566,7 +584,7 @@ leaves and ignores the current scope.
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</button>
|
||||
</svelte:element>
|
||||
<!-- Keyed on the props rather than on this leaf's own badge or action, so a picker
|
||||
that has either holds the column open on every row: paths then truncate at one
|
||||
column and the button lands in the same place down the list. -->
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<script lang="ts">
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
type Item = {
|
||||
label: string
|
||||
icon?: any
|
||||
right?: string
|
||||
onClick?: () => void
|
||||
/** Renders the row as a link, so it opens in a new tab on middle/ctrl-click. */
|
||||
href?: string
|
||||
onHover?: (hover: boolean) => void
|
||||
}
|
||||
export type Props = {
|
||||
@@ -11,31 +15,55 @@
|
||||
items: Item[]
|
||||
}
|
||||
let { items, closeCallback }: Props = $props()
|
||||
|
||||
const rowClass =
|
||||
'px-3 h-9 text-xs cursor-pointer hover:bg-surface-hover font-normal w-full text-left flex items-center gap-2.5'
|
||||
|
||||
function onRowClick(item: Item, e: MouseEvent) {
|
||||
if (!(item.href && isNewTabClick(e))) item.onClick?.()
|
||||
item.onHover?.(false)
|
||||
closeCallback?.()
|
||||
}
|
||||
</script>
|
||||
|
||||
{#snippet rowContent(item: Item)}
|
||||
{#if item.icon}
|
||||
<item.icon size="16"></item.icon>
|
||||
{/if}
|
||||
<span class="flex-1">
|
||||
{item.label}
|
||||
</span>
|
||||
{#if item.right}
|
||||
<span class="text-xs text-hint">{item.right}</span>
|
||||
{/if}
|
||||
{/snippet}
|
||||
|
||||
<ul class="bg-surface-tertiary rounded-md border w-56 relative drop-shadow-base">
|
||||
{#each items as item}
|
||||
<li class="w-full">
|
||||
<button
|
||||
class="px-3 h-9 text-xs cursor-pointer hover:bg-surface-hover font-normal w-full text-left flex items-center gap-2.5"
|
||||
onclick={() => {
|
||||
item.onClick?.()
|
||||
item.onHover?.(false)
|
||||
closeCallback?.()
|
||||
}}
|
||||
onmouseenter={() => item.onHover?.(true)}
|
||||
onmouseleave={() => item.onHover?.(false)}
|
||||
>
|
||||
{#if item.icon}
|
||||
<item.icon size="16"></item.icon>
|
||||
{/if}
|
||||
<span class="flex-1">
|
||||
{item.label}
|
||||
</span>
|
||||
{#if item.right}
|
||||
<span class="text-xs text-hint">{item.right}</span>
|
||||
{/if}
|
||||
</button>
|
||||
{#if item.href}
|
||||
<a
|
||||
href={item.href}
|
||||
class="{rowClass} text-[color:inherit]"
|
||||
onclick={(e) => onRowClick(item, e)}
|
||||
onauxclick={(e) => {
|
||||
if (e.button === 1) onRowClick(item, e)
|
||||
}}
|
||||
onmouseenter={() => item.onHover?.(true)}
|
||||
onmouseleave={() => item.onHover?.(false)}
|
||||
>
|
||||
{@render rowContent(item)}
|
||||
</a>
|
||||
{:else}
|
||||
<button
|
||||
class={rowClass}
|
||||
onclick={(e) => onRowClick(item, e)}
|
||||
onmouseenter={() => item.onHover?.(true)}
|
||||
onmouseleave={() => item.onHover?.(false)}
|
||||
>
|
||||
{@render rowContent(item)}
|
||||
</button>
|
||||
{/if}
|
||||
</li>
|
||||
{/each}
|
||||
{#if items.length === 0}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import PathEditPopover from '$lib/components/PathEditPopover.svelte'
|
||||
import {
|
||||
dirKey,
|
||||
editPathFor,
|
||||
KIND_LABEL_LOWER,
|
||||
kindKey,
|
||||
leafKeyFor,
|
||||
@@ -106,6 +107,7 @@
|
||||
isCurrent={!segments}
|
||||
{currentItem}
|
||||
{workspaceId}
|
||||
itemHref={editPathFor}
|
||||
onPick={handlePickerSelect}
|
||||
/>
|
||||
{#if segments}
|
||||
@@ -121,6 +123,7 @@
|
||||
initialHighlight={dKey}
|
||||
{currentItem}
|
||||
{workspaceId}
|
||||
itemHref={editPathFor}
|
||||
onPick={handlePickerSelect}
|
||||
/>
|
||||
{/each}
|
||||
@@ -137,6 +140,7 @@
|
||||
isCurrent
|
||||
{currentItem}
|
||||
{workspaceId}
|
||||
itemHref={editPathFor}
|
||||
onPick={handlePickerSelect}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -109,7 +109,7 @@
|
||||
import FlowYamlEditor from './flows/header/FlowYamlEditor.svelte'
|
||||
import { type TriggerContext, type ScheduleTrigger } from './triggers'
|
||||
import type { SavedAndModifiedValue } from './common/confirmationModal/unsavedTypes'
|
||||
import DeployButton from './DeployButton.svelte'
|
||||
import DeployButton, { type DeployDropdownItem } from './DeployButton.svelte'
|
||||
import OpenInSessionButton from './sessions/OpenInSessionButton.svelte'
|
||||
import { invalidateWorkspacePaths } from './PathNameAutocomplete.svelte'
|
||||
import type { Trigger } from './triggers/utils'
|
||||
@@ -191,6 +191,7 @@
|
||||
onDeploy,
|
||||
onDeployError,
|
||||
onDetails,
|
||||
detailsHref,
|
||||
onHistoryRestore,
|
||||
onNavigate,
|
||||
onResetToDeployed,
|
||||
@@ -1293,42 +1294,44 @@
|
||||
]
|
||||
}
|
||||
|
||||
const dropdownItems: Array<{
|
||||
label: string
|
||||
onClick: () => void
|
||||
}> = []
|
||||
const showDetailsItem = !newFlow && savedFlow?.no_deployed !== true && !inSessionPane
|
||||
const showExtraDeployOptions = untrack(() => customUi).topBar?.extraDeployOptions != false
|
||||
const showForkItems = !untrack(() => newFlow) && !inSessionPane
|
||||
const showEditInFork =
|
||||
showForkItems && !isCloudHosted() && editInForkAllowed(opWorkspace, $userWorkspaces)
|
||||
|
||||
if (untrack(() => customUi).topBar?.extraDeployOptions != false) {
|
||||
// A function, so the hrefs follow `initialPath`, which the edit page sets once the draft loads.
|
||||
function dropdownItems(): DeployDropdownItem[] {
|
||||
const items: DeployDropdownItem[] = []
|
||||
if (!showExtraDeployOptions) return items
|
||||
// None of these belong to a session pane: each leaves the editor for a details page or
|
||||
// a new tab, which the session's own tabs already reach. The deploy button is then plain.
|
||||
if (!newFlow && savedFlow?.no_deployed !== true && !inSessionPane) {
|
||||
dropdownItems.push({
|
||||
label: 'Exit & see details',
|
||||
// Use the deployed path, not the live `$pathStore` — the latter
|
||||
// reflects local rename edits that haven't been deployed yet,
|
||||
// which would land the user on a 404 details page.
|
||||
onClick: () => onDetails?.({ path: initialPath })
|
||||
})
|
||||
if (showDetailsItem) {
|
||||
// Use the deployed path, not the live `$pathStore` — the latter
|
||||
// reflects local rename edits that haven't been deployed yet,
|
||||
// which would land the user on a 404 details page.
|
||||
items.push(
|
||||
detailsHref
|
||||
? { label: 'Exit & see details', href: detailsHref(initialPath) }
|
||||
: { label: 'Exit & see details', onClick: () => onDetails?.({ path: initialPath }) }
|
||||
)
|
||||
}
|
||||
|
||||
if (!untrack(() => newFlow) && !inSessionPane) {
|
||||
dropdownItems.push({
|
||||
if (showForkItems) {
|
||||
items.push({
|
||||
label: 'Fork',
|
||||
onClick: () => window.open(`/flows/add?template=${initialPath}`)
|
||||
href: `/flows/add?template=${initialPath}`,
|
||||
hrefTarget: '_blank'
|
||||
})
|
||||
}
|
||||
|
||||
if (
|
||||
!untrack(() => newFlow) &&
|
||||
!inSessionPane &&
|
||||
!isCloudHosted() &&
|
||||
editInForkAllowed(opWorkspace, $userWorkspaces)
|
||||
) {
|
||||
dropdownItems.push({
|
||||
if (showEditInFork) {
|
||||
items.push({
|
||||
label: editInForkLabel(opWorkspace, $userWorkspaces),
|
||||
onClick: () => openEditInFork('flow', initialPath, opWorkspace)
|
||||
})
|
||||
}
|
||||
return items
|
||||
}
|
||||
|
||||
/** Deployed versions for the diff picker, newest first. Best-effort: losing the
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { flowPathToHref } from '$lib/scripts'
|
||||
import { agentRunHref } from '$lib/components/flows/conversations/agentEditorChat'
|
||||
import { displayDate, truncateRev } from '$lib/utils'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import ScheduleEditor from '$lib/components/triggers/schedules/ScheduleEditor.svelte'
|
||||
import TimeAgo from './TimeAgo.svelte'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
@@ -79,12 +80,14 @@
|
||||
<Calendar size={SMALL_ICON_SIZE} class="min-w-3.5" />
|
||||
<span class="whitespace-nowrap">
|
||||
Schedule:
|
||||
<!-- svelte-ignore a11y_invalid_attribute -->
|
||||
<a
|
||||
href="#"
|
||||
href={`/schedules?workspace=${$workspaceStore}#${job.schedule_path}`}
|
||||
class="break-words text-blue-600 font-normal"
|
||||
onclick={() =>
|
||||
scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')}
|
||||
onclick={(e) => {
|
||||
if (isNewTabClick(e)) return
|
||||
e.preventDefault()
|
||||
scheduleEditor?.openEdit(job.schedule_path ?? '', job.job_kind == 'flow')
|
||||
}}
|
||||
>
|
||||
{truncateRev(job.schedule_path, 40)}
|
||||
</a>
|
||||
|
||||
@@ -12,7 +12,6 @@
|
||||
import type { WorkspaceComparison } from '$lib/gen'
|
||||
import { fetchWorkspaceComparison } from '$lib/workspaceComparison'
|
||||
import { Button } from './common'
|
||||
import { goto } from '$app/navigation'
|
||||
import { onDestroy, onMount, untrack } from 'svelte'
|
||||
import {
|
||||
homeActionsGathered,
|
||||
@@ -149,36 +148,24 @@
|
||||
}
|
||||
}
|
||||
|
||||
// Opens the direction the button offers, so the label and the list agree: a fork
|
||||
// with nothing to deploy lands on the update side, not on an empty deploy list.
|
||||
/** The compare page opened on one direction, for a badge that counts exactly that. The button
|
||||
* beside them still chooses on the reader's behalf; a badge means the one thing it names. */
|
||||
function openCompareDir(dir: 'deploy_to' | 'update') {
|
||||
if (!parentWorkspaceId || !$workspaceStore) return
|
||||
goto(
|
||||
function compareDirHref(dir: 'deploy_to' | 'update'): string | undefined {
|
||||
if (!parentWorkspaceId || !$workspaceStore) return undefined
|
||||
return (
|
||||
'/forks/compare?workspace_id=' +
|
||||
encodeURIComponent($workspaceStore) +
|
||||
(dir === 'update' ? '&dir=update' : ''),
|
||||
{ replaceState: true }
|
||||
encodeURIComponent($workspaceStore) +
|
||||
(dir === 'update' ? '&dir=update' : '')
|
||||
)
|
||||
}
|
||||
const deployToHref = $derived(compareDirHref('deploy_to'))
|
||||
const updateHref = $derived(compareDirHref('update'))
|
||||
|
||||
function openComparisonDrawer() {
|
||||
if (parentWorkspaceId && $workspaceStore) {
|
||||
const dir = hasAnswer && changesAhead === 0 ? '&dir=update' : ''
|
||||
goto('/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + dir, {
|
||||
replaceState: true
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
function openDraftCompare() {
|
||||
if ($workspaceStore) {
|
||||
goto('/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + '&mode=draft', {
|
||||
replaceState: true
|
||||
})
|
||||
}
|
||||
}
|
||||
const draftCompareHref = $derived(
|
||||
$workspaceStore
|
||||
? '/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + '&mode=draft'
|
||||
: undefined
|
||||
)
|
||||
|
||||
// Counted with the compare page's own predicate so the banner never advertises a
|
||||
// direction whose list is empty: the `ahead`/`behind` sums in the summary include
|
||||
@@ -189,6 +176,11 @@
|
||||
}
|
||||
const changesAhead = $derived(countDir(comparison, true))
|
||||
const changesBehind = $derived(countDir(comparison, false))
|
||||
// Opens the direction the button offers, so the label and the list agree: a fork
|
||||
// with nothing to deploy lands on the update side, not on an empty deploy list.
|
||||
const comparisonHref = $derived(
|
||||
compareDirHref(hasAnswer && changesAhead === 0 ? 'update' : 'deploy_to')
|
||||
)
|
||||
|
||||
// Folded into Home's ⋮ menu, the badges and the button are one row that says what they counted.
|
||||
const menuId = homeHeaderMenu.register(0, () => {
|
||||
@@ -197,7 +189,7 @@
|
||||
return [
|
||||
{
|
||||
displayName: `Review & deploy ${draftCount} draft${draftCount !== 1 ? 's' : ''}`,
|
||||
action: openDraftCompare
|
||||
href: draftCompareHref
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -214,7 +206,7 @@
|
||||
displayName:
|
||||
!hasAnswer || changesAhead > 0 ? 'Review changes' : `Review & Update ${currentNoun}`,
|
||||
description: hasAnswer && counts.length > 0 ? counts.join(' · ') : undefined,
|
||||
action: openComparisonDrawer
|
||||
href: comparisonHref
|
||||
}
|
||||
]
|
||||
})
|
||||
@@ -278,7 +270,7 @@
|
||||
color="green"
|
||||
small
|
||||
clickable
|
||||
onclick={() => openCompareDir('deploy_to')}
|
||||
href={deployToHref}
|
||||
title="{changesAhead} ahead of {parentWorkspaceId} — review what this {currentNoun} has to give"
|
||||
>
|
||||
<ArrowUp class="w-3 h-3 inline" />
|
||||
@@ -290,7 +282,7 @@
|
||||
color="blue"
|
||||
small
|
||||
clickable
|
||||
onclick={() => openCompareDir('update')}
|
||||
href={updateHref}
|
||||
title="{changesBehind} behind {parentWorkspaceId} — review what this {currentNoun} has yet to take"
|
||||
>
|
||||
<ArrowDown class="w-3 h-3 inline" />
|
||||
@@ -304,7 +296,7 @@
|
||||
color="orange"
|
||||
small
|
||||
clickable
|
||||
onclick={() => openCompareDir('deploy_to')}
|
||||
href={deployToHref}
|
||||
title="{conflicts} conflicting item{conflicts !== 1 ? 's' : ''} — review them"
|
||||
>
|
||||
<AlertTriangle class="w-3 h-3 inline" />
|
||||
@@ -322,7 +314,7 @@
|
||||
color="blue"
|
||||
small
|
||||
clickable
|
||||
onclick={openDraftCompare}
|
||||
href={draftCompareHref}
|
||||
title="{draftCount} draft{draftCount !== 1
|
||||
? 's'
|
||||
: ''} in this {currentNoun}, not deployed anywhere yet — review and deploy"
|
||||
@@ -338,7 +330,7 @@
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="sm"
|
||||
onclick={openDraftCompare}
|
||||
href={draftCompareHref}
|
||||
title={`Review and deploy this workspace's drafts`}
|
||||
>
|
||||
Review & deploy drafts
|
||||
@@ -347,7 +339,7 @@
|
||||
<Button
|
||||
variant="subtle"
|
||||
unifiedSize="sm"
|
||||
onclick={openComparisonDrawer}
|
||||
href={comparisonHref}
|
||||
title={hasAnswer
|
||||
? `${forkAheadBehindMessage(changesAhead, changesBehind)} ${parentWorkspaceId} over ${total} items`
|
||||
: `Review this ${currentNoun} against ${parentWorkspaceId}`}
|
||||
|
||||
@@ -158,9 +158,8 @@
|
||||
<Button
|
||||
unifiedSize="sm"
|
||||
endIcon={{ icon: ExternalLink }}
|
||||
on:click={() => {
|
||||
window.open(`/runs/${runnableId}`, '_blank')
|
||||
}}
|
||||
href={`/runs/${runnableId}`}
|
||||
target="_blank"
|
||||
>
|
||||
All runs
|
||||
</Button>
|
||||
|
||||
@@ -119,7 +119,7 @@
|
||||
import type { ScheduleTrigger, TriggerContext } from './triggers'
|
||||
import CaptureTable from './triggers/CaptureTable.svelte'
|
||||
import type { SavedAndModifiedValue } from './common/confirmationModal/unsavedTypes'
|
||||
import DeployButton from './DeployButton.svelte'
|
||||
import DeployButton, { type DeployDropdownItem } from './DeployButton.svelte'
|
||||
import { type Trigger, deployTriggers, handleSelectTriggerFromKind } from './triggers/utils'
|
||||
import DraftChangesConfirmationModal from './common/confirmationModal/DraftChangesConfirmationModal.svelte'
|
||||
import PerpetualRunsDeployModal from './scripts/PerpetualRunsDeployModal.svelte'
|
||||
@@ -172,6 +172,7 @@
|
||||
onDeploy,
|
||||
onDeployError,
|
||||
onSeeDetails,
|
||||
seeDetailsHref,
|
||||
onNavigate,
|
||||
onTestJob,
|
||||
disableAi,
|
||||
@@ -1245,22 +1246,21 @@
|
||||
initialPath: string,
|
||||
savedScript: ((Script | NewScript) & { no_deployed?: boolean }) | undefined
|
||||
) {
|
||||
let dropdownItems: { label: string; onClick: (deploymentMsg: string) => void }[] =
|
||||
let dropdownItems: DeployDropdownItem[] =
|
||||
initialPath != '' && customUi?.topBar?.extraDeployOptions != false
|
||||
? [
|
||||
...(!inSessionPane
|
||||
? [
|
||||
{
|
||||
label: 'Deploy & Stay here',
|
||||
onClick: (deploymentMsg) => {
|
||||
onClick: (deploymentMsg: string) => {
|
||||
handleEditScript(true, deploymentMsg)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Fork',
|
||||
onClick: () => {
|
||||
window.open(`/scripts/add?template=${initialPath}`)
|
||||
}
|
||||
href: `/scripts/add?template=${initialPath}`,
|
||||
hrefTarget: '_blank' as const
|
||||
},
|
||||
...(!isCloudHosted() && editInForkAllowed(opWorkspace, $userWorkspaces)
|
||||
? [
|
||||
@@ -1279,12 +1279,14 @@
|
||||
script.kind === 'script' &&
|
||||
!script.auto_kind
|
||||
? [
|
||||
{
|
||||
label: 'Exit & See details',
|
||||
onClick: () => {
|
||||
onSeeDetails?.({ path: initialPath })
|
||||
}
|
||||
}
|
||||
seeDetailsHref
|
||||
? { label: 'Exit & See details', href: seeDetailsHref(initialPath) }
|
||||
: {
|
||||
label: 'Exit & See details',
|
||||
onClick: () => {
|
||||
onSeeDetails?.({ path: initialPath })
|
||||
}
|
||||
}
|
||||
]
|
||||
: []),
|
||||
...(!inSessionPane && isWorkflowAsCode(script.content, script.language)
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
import ToggleButton from './common/toggleButton-v2/ToggleButton.svelte'
|
||||
import VersionListItem from './VersionListItem.svelte'
|
||||
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
const operatingWorkspace = useOperatingWorkspace()
|
||||
|
||||
@@ -98,7 +99,10 @@
|
||||
{#snippet action()}
|
||||
{#if openDetails}
|
||||
<Button
|
||||
on:click={() => {
|
||||
href={`/scripts/get/${version.script_hash}?workspace=${$operatingWorkspace}`}
|
||||
onClick={(e) => {
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
e?.preventDefault()
|
||||
dispatch('openDetails', { version: version.script_hash })
|
||||
}}
|
||||
class="mr-2 shrink-0 inline-flex gap-1 text-xs items-center"
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import { UserService, type GlobalUserInfo, type ExternalJwtToken, SettingService } from '$lib/gen'
|
||||
import type { GuestList } from '$lib/gen'
|
||||
import { Tab, Tabs } from '$lib/components/common'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import DataTable from '$lib/components/table/DataTable.svelte'
|
||||
import Head from '$lib/components/table/Head.svelte'
|
||||
import Cell from '$lib/components/table/Cell.svelte'
|
||||
@@ -629,8 +630,9 @@
|
||||
href="/workspace_settings?tab=users&workspace={workspace_id}"
|
||||
class="hover:underline"
|
||||
title={workspace_id}
|
||||
onclick={() => closeDrawer?.()}
|
||||
>{truncate(workspace_id, 20)}</a
|
||||
onclick={(e) => {
|
||||
if (!isNewTabClick(e)) closeDrawer?.()
|
||||
}}>{truncate(workspace_id, 20)}</a
|
||||
>
|
||||
{:else}
|
||||
its workspace
|
||||
@@ -641,7 +643,9 @@
|
||||
href="/groups"
|
||||
class="text-2xs text-tertiary mt-0.5 ml-1 hover:underline"
|
||||
title={groupRoleTooltip}
|
||||
onclick={() => closeDrawer?.()}
|
||||
onclick={(e) => {
|
||||
if (!isNewTabClick(e)) closeDrawer?.()
|
||||
}}
|
||||
>
|
||||
Set by instance group
|
||||
</a>
|
||||
@@ -657,7 +661,9 @@
|
||||
{
|
||||
displayName: 'Manage in workspace',
|
||||
icon: Settings,
|
||||
action: () => closeDrawer?.(),
|
||||
action: (e) => {
|
||||
if (!isNewTabClick(e)) closeDrawer?.()
|
||||
},
|
||||
href: `/workspace_settings?tab=users&workspace=${workspace_id}`
|
||||
}
|
||||
]}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
import { workspaceStore, userWorkspaces } from '$lib/stores'
|
||||
import { workspaceIsFork } from '$lib/utils/workspaceHierarchy'
|
||||
import { Badge, Button } from './common'
|
||||
import { goto } from '$app/navigation'
|
||||
import { useWorkspaceDrafts } from '$lib/workspaceDrafts.svelte'
|
||||
import PageHeaderContent from '$lib/components/PageHeaderContent.svelte'
|
||||
import { pageHeader, PHONE_BAR } from '$lib/components/pageHeaderRegistry.svelte'
|
||||
@@ -22,13 +21,11 @@
|
||||
const drafts = useWorkspaceDrafts(() => (!isFork ? ($workspaceStore ?? undefined) : undefined))
|
||||
const draftCount = $derived(drafts.count)
|
||||
|
||||
function openDraftCompare() {
|
||||
if ($workspaceStore) {
|
||||
goto('/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + '&mode=draft', {
|
||||
replaceState: true
|
||||
})
|
||||
}
|
||||
}
|
||||
const draftCompareHref = $derived(
|
||||
$workspaceStore
|
||||
? '/forks/compare?workspace_id=' + encodeURIComponent($workspaceStore) + '&mode=draft'
|
||||
: undefined
|
||||
)
|
||||
const phone = $derived(pageHeader.barWidth > 0 && pageHeader.barWidth < PHONE_BAR)
|
||||
|
||||
const menuId = homeHeaderMenu.register(-100, () =>
|
||||
@@ -36,7 +33,7 @@
|
||||
? [
|
||||
{
|
||||
displayName: `Review & deploy ${draftCount} draft${draftCount !== 1 ? 's' : ''}`,
|
||||
action: openDraftCompare
|
||||
href: draftCompareHref
|
||||
}
|
||||
]
|
||||
: []
|
||||
@@ -58,7 +55,7 @@
|
||||
btnClasses="wm-page-in"
|
||||
variant="subtle"
|
||||
unifiedSize="sm"
|
||||
onclick={openDraftCompare}
|
||||
href={draftCompareHref}
|
||||
title="Review & deploy drafts"
|
||||
>
|
||||
<Badge color="blue" small>{draftCount}</Badge>
|
||||
@@ -69,7 +66,7 @@
|
||||
<Badge color="blue" small>
|
||||
{draftCount} draft{draftCount !== 1 ? 's' : ''}
|
||||
</Badge>
|
||||
<Button variant="subtle" unifiedSize="sm" onclick={openDraftCompare}>
|
||||
<Button variant="subtle" unifiedSize="sm" href={draftCompareHref}>
|
||||
Review & deploy drafts
|
||||
</Button>
|
||||
</span>
|
||||
|
||||
@@ -28,6 +28,7 @@ in a live editor) are still navigable.
|
||||
} from '$lib/components/copilot/chat/global/userDraftAdapter'
|
||||
import { resource } from 'runed'
|
||||
import { useOperatingWorkspace } from '$lib/components/operatingWorkspace.svelte'
|
||||
import { withWorkspaceParam } from '$lib/components/sessions/sessionMode.svelte'
|
||||
|
||||
const operatingWorkspace = useOperatingWorkspace()
|
||||
|
||||
@@ -53,10 +54,14 @@ in a live editor) are still navigable.
|
||||
// Load items and drafts from this workspace; defaults to the operating workspace
|
||||
// (see `useOperatingWorkspace`).
|
||||
workspaceId?: string
|
||||
/** Where picking an item navigates, for a host whose pick is a navigation; rows then
|
||||
* open in a new tab on middle and ⌘/Ctrl-click. Stamped with the picker's workspace. */
|
||||
itemHref?: (item: WorkspaceItem) => string
|
||||
}
|
||||
|
||||
let {
|
||||
onPick,
|
||||
itemHref,
|
||||
kinds = ['flow', 'script', 'app'],
|
||||
initialScope,
|
||||
initialHighlight,
|
||||
@@ -174,4 +179,7 @@ in a live editor) are still navigable.
|
||||
else if (kinds.length === 1) loader.ensureLoaded(kinds[0])
|
||||
}}
|
||||
onFilterChange={loader.onFilterChange}
|
||||
leafHref={itemHref
|
||||
? (leaf) => withWorkspaceParam(itemHref(leaf.data), effectiveWorkspace)
|
||||
: undefined}
|
||||
/>
|
||||
|
||||
@@ -115,13 +115,17 @@
|
||||
onClick: undefined
|
||||
}
|
||||
} else {
|
||||
const href = resolvedPath ? `/apps/get/${resolvedPath}` : undefined
|
||||
return {
|
||||
onClick: () => {
|
||||
if (resolvedPath) {
|
||||
gotoFn?.(`/apps/get/${resolvedPath}`)
|
||||
}
|
||||
// A plain click goes through `gotoFn`, which an embedded app routes to its top window.
|
||||
onClick: (e?: Event) => {
|
||||
// Not `isNewTabClick`: `$lib/navigation` imports `$app/navigation`, which no app
|
||||
// component pulls in (the packaged `AppPreview` renders them outside SvelteKit).
|
||||
if (e instanceof MouseEvent && (e.ctrlKey || e.metaKey)) return
|
||||
e?.preventDefault()
|
||||
if (href) gotoFn?.(href)
|
||||
},
|
||||
href: undefined,
|
||||
href,
|
||||
target: undefined
|
||||
}
|
||||
}
|
||||
@@ -177,7 +181,7 @@
|
||||
}`}
|
||||
>
|
||||
<Button
|
||||
on:click={buttonProps.onClick ?? (() => {})}
|
||||
onClick={buttonProps.onClick}
|
||||
href={buttonProps.href}
|
||||
target={buttonProps.target ?? '_self'}
|
||||
color="light"
|
||||
|
||||
@@ -1450,9 +1450,8 @@
|
||||
? () => [
|
||||
{
|
||||
label: 'Fork',
|
||||
onClick: () => {
|
||||
window.open(`/apps/add?template=${encodeURIComponent($appPath)}`)
|
||||
}
|
||||
href: `/apps/add?template=${encodeURIComponent($appPath)}`,
|
||||
hrefTarget: '_blank'
|
||||
},
|
||||
...(!isCloudHosted() && editInForkAllowed($workspaceStore, $userWorkspaces)
|
||||
? [
|
||||
|
||||
@@ -276,10 +276,8 @@
|
||||
<div class="flex p-1 gap-2">
|
||||
<Button
|
||||
size="xs"
|
||||
on:click={() =>
|
||||
window.open(
|
||||
`${selected?.raw_app ? '/apps_raw' : '/apps'}/add?template_id=${selectedVersion?.version}`
|
||||
)}
|
||||
href={`${selected?.raw_app ? '/apps_raw' : '/apps'}/add?template_id=${selectedVersion?.version}`}
|
||||
target="_blank"
|
||||
>
|
||||
Restore as fork
|
||||
</Button>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { roleCapabilities, workspaceStore } from '$lib/stores'
|
||||
import { goto } from '$app/navigation'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import Button from '$lib/components/common/button/Button.svelte'
|
||||
import FolderPicker from '$lib/components/FolderPicker.svelte'
|
||||
import { AssetService, type ListPipelineFoldersResponse } from '$lib/gen'
|
||||
@@ -41,10 +42,14 @@
|
||||
(pipelines.current ?? []).filter((p) => p.folder !== currentFolder)
|
||||
)
|
||||
|
||||
function pipelineHref(folder: string): string {
|
||||
const modeQuery = mode !== 'view' ? `?mode=${mode}` : ''
|
||||
return `/pipeline/${encodeURIComponent(folder)}${modeQuery}`
|
||||
}
|
||||
|
||||
async function openExistingPipeline(folder: string) {
|
||||
onOpen?.()
|
||||
const modeQuery = mode !== 'view' ? `?mode=${mode}` : ''
|
||||
await goto(`/pipeline/${encodeURIComponent(folder)}${modeQuery}`)
|
||||
await goto(pipelineHref(folder))
|
||||
}
|
||||
|
||||
async function openPicked() {
|
||||
@@ -74,17 +79,21 @@
|
||||
{:else}
|
||||
<div class="flex flex-col border rounded-md overflow-hidden max-h-64 overflow-y-auto">
|
||||
{#each visiblePipelines as p (p.folder)}
|
||||
<button
|
||||
type="button"
|
||||
class="flex items-center justify-between px-3 py-2 border-b last:border-b-0 bg-surface hover:bg-surface-hover transition-colors text-left"
|
||||
onclick={() => openExistingPipeline(p.folder)}
|
||||
<a
|
||||
href={pipelineHref(p.folder)}
|
||||
class="flex items-center justify-between px-3 py-2 border-b last:border-b-0 bg-surface hover:bg-surface-hover transition-colors text-left text-[color:inherit]"
|
||||
onclick={(e) => {
|
||||
if (isNewTabClick(e)) return
|
||||
e.preventDefault()
|
||||
openExistingPipeline(p.folder)
|
||||
}}
|
||||
>
|
||||
<span class="font-mono text-sm">f/{p.folder}</span>
|
||||
<span class="text-2xs text-tertiary">
|
||||
{p.script_count}
|
||||
{p.script_count === 1 ? 'script' : 'scripts'}
|
||||
</span>
|
||||
</button>
|
||||
</a>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
description?: string
|
||||
onClick?: (e?: Event) => void
|
||||
href?: string
|
||||
hrefTarget?: Item['hrefTarget']
|
||||
icon?: any
|
||||
disabled?: boolean
|
||||
tooltip?: string
|
||||
@@ -165,6 +166,7 @@
|
||||
icon: item.icon,
|
||||
disabled: item.disabled ?? false,
|
||||
href: item.href,
|
||||
hrefTarget: item.hrefTarget,
|
||||
tooltip: item.tooltip
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -27,10 +27,12 @@
|
||||
groups: NavigationGroup[]
|
||||
selectedId: string
|
||||
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
|
||||
class?: string
|
||||
}
|
||||
|
||||
let { groups, selectedId, onNavigate, class: className = '' }: Props = $props()
|
||||
let { groups, selectedId, onNavigate, itemHref, class: className = '' }: Props = $props()
|
||||
</script>
|
||||
|
||||
<!-- Up/Down walks the items, wrapping at the ends. On the wrapper rather than on each
|
||||
@@ -57,7 +59,8 @@
|
||||
aiDescription={item.aiDescription}
|
||||
startIcon={item.icon ? { icon: item.icon } : undefined}
|
||||
btnClasses={'!justify-start text-left !w-full'}
|
||||
onClick={() => onNavigate(item.id)}
|
||||
href={itemHref?.(item.id)}
|
||||
onClick={itemHref ? undefined : () => onNavigate(item.id)}
|
||||
>
|
||||
<span class="truncate">{item.label}</span>
|
||||
<div class="ml-auto flex items-center gap-1">
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import YAML from 'yaml'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { yamlStringifyExceptKeys } from './utils'
|
||||
import { sliceModules } from '../flows/flowStateUtils.svelte'
|
||||
import { dfs } from '../flows/dfs'
|
||||
@@ -261,8 +262,8 @@ input_name2: expression2
|
||||
<a
|
||||
href="#user-settings"
|
||||
class="inline-flex flex-row items-center gap-1"
|
||||
onclick={() => {
|
||||
close()
|
||||
onclick={(e) => {
|
||||
if (!isNewTabClick(e)) close()
|
||||
}}
|
||||
>
|
||||
user settings
|
||||
|
||||
@@ -215,17 +215,16 @@
|
||||
return `/run/${job.jobId}?workspace=${job.workspace}`
|
||||
}
|
||||
|
||||
function openRun(job: ChatJob) {
|
||||
function openRun(job: ChatJob, e: MouseEvent) {
|
||||
// In /sessions the run opens in the preview pane; the global side-panel chat
|
||||
// has no runtime, so fall back to a new browser tab.
|
||||
// has no runtime, so the row's link opens it in a new browser tab.
|
||||
if (aiChatManager.openRunInPreview) {
|
||||
e.preventDefault()
|
||||
aiChatManager.openRunInPreview({
|
||||
jobId: job.jobId,
|
||||
workspace: job.workspace,
|
||||
label: job.label
|
||||
})
|
||||
} else {
|
||||
window.open(runHref(job), '_blank', 'noreferrer')
|
||||
}
|
||||
}
|
||||
|
||||
@@ -312,6 +311,7 @@
|
||||
itemKey={(job) => job.jobId}
|
||||
rowTitle={(job) => job.label}
|
||||
onPick={openRun}
|
||||
itemHref={runHref}
|
||||
placement={standalone ? 'top-end' : 'top-start'}
|
||||
usePointerDownOutside
|
||||
closeOnOtherPopoverOpen={!standalone}
|
||||
|
||||
@@ -494,9 +494,13 @@
|
||||
if (aiChatManager.openRunInPreview) {
|
||||
aiChatManager.openRunInPreview({ jobId: job.jobId, workspace: job.workspace, label })
|
||||
} else {
|
||||
window.open(`/run/${job.jobId}?workspace=${job.workspace}`, '_blank', 'noreferrer')
|
||||
window.open(runHref(job), '_blank', 'noreferrer')
|
||||
}
|
||||
}
|
||||
|
||||
function runHref(j: { jobId: string; workspace: string }): string {
|
||||
return `/run/${j.jobId}?workspace=${j.workspace}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- One readout rather than a badge beside a number: the colour says how the run went and the
|
||||
@@ -521,6 +525,7 @@
|
||||
card={{ kind: runnableKind, path }}
|
||||
title={previewTitle}
|
||||
onOpen={openPreview}
|
||||
href={previewTarget === 'run' && job ? runHref(job) : undefined}
|
||||
kindIcon={false}
|
||||
mode={previewTarget === 'deployed' ? 'view' : 'edit'}
|
||||
/>
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
import type { IconType } from '$lib/utils'
|
||||
import { runToolDisplayAction } from './createdResourceActions.svelte'
|
||||
import { openItemPreviewAction, type PreviewCardKind } from './shared'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
interface Props {
|
||||
card: { kind: PreviewCardKind | 'agent'; path: string }
|
||||
@@ -19,9 +20,12 @@
|
||||
* tabs use. Defaults to the editor: a card sits on a write-tool result, and the
|
||||
* draft it just wrote is what the reader is being offered. */
|
||||
mode?: 'edit' | 'view'
|
||||
/** The page the chip opens, when it is one: middle and ⌘/Ctrl-click then open it in a new
|
||||
* tab, while a plain click still opens it where `onOpen` puts it. */
|
||||
href?: string
|
||||
}
|
||||
|
||||
let { card, onOpen, title, kindIcon = true, mode = 'edit' }: Props = $props()
|
||||
let { card, onOpen, title, kindIcon = true, mode = 'edit', href }: Props = $props()
|
||||
|
||||
const kindLabel = $derived(card.kind === 'raw_app' ? 'app' : card.kind)
|
||||
|
||||
@@ -60,7 +64,14 @@
|
||||
(mode === 'view'
|
||||
? `Open the deployed ${kindLabel}: ${card.path}`
|
||||
: `Open ${kindLabel} preview: ${card.path}`)}
|
||||
onClick={open}
|
||||
{href}
|
||||
onClick={(e) => {
|
||||
if (href) {
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
e?.preventDefault()
|
||||
}
|
||||
open()
|
||||
}}
|
||||
startIcon={kindIcon
|
||||
? { icon: RowIcon as unknown as IconType, props: { kind: card.kind, size: 12 } }
|
||||
: undefined}
|
||||
|
||||
@@ -39,7 +39,10 @@
|
||||
type MenuItemButton = {
|
||||
label: string
|
||||
Icon: any
|
||||
onclick: (e: MouseEvent) => void
|
||||
onclick?: (e: MouseEvent) => void
|
||||
/** Renders a link, so the item opens in a new tab on middle/ctrl-click. */
|
||||
href?: string
|
||||
hrefTarget?: Item['hrefTarget']
|
||||
color?: 'red'
|
||||
disabled?: boolean
|
||||
}
|
||||
@@ -229,6 +232,8 @@
|
||||
displayName: item.label,
|
||||
icon: item.Icon,
|
||||
action: item.onclick,
|
||||
href: item.href,
|
||||
hrefTarget: item.hrefTarget,
|
||||
disabled: item.disabled,
|
||||
type: item.color === 'red' ? ('delete' as const) : ('action' as const),
|
||||
separatorTop: i === 0 && (menuButtons.length > 0 || (!wideRow && !!errorHandlerKind))
|
||||
|
||||
@@ -555,9 +555,8 @@
|
||||
menuItems.push({
|
||||
label: 'Audit logs',
|
||||
Icon: Eye,
|
||||
onclick: () => {
|
||||
onNavigate(`/audit_logs?resource=${flow?.path}`)
|
||||
}
|
||||
href: operatingHref(`/audit_logs?resource=${flow.path}`),
|
||||
onclick: interceptNav(onNavigate, `/audit_logs?resource=${flow.path}`)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -716,19 +716,16 @@
|
||||
menuItems.push({
|
||||
label: 'Audit logs',
|
||||
Icon: Eye,
|
||||
onclick: () => {
|
||||
onNavigate(`/audit_logs?resource=${script?.path}`)
|
||||
}
|
||||
href: operatingHref(`/audit_logs?resource=${script.path}`),
|
||||
onclick: interceptNav(onNavigate, `/audit_logs?resource=${script.path}`)
|
||||
})
|
||||
|
||||
if (!$disableHubStore) {
|
||||
menuItems.push({
|
||||
label: 'Publish to Hub',
|
||||
Icon: Globe2,
|
||||
onclick: () => {
|
||||
if (!script) return
|
||||
window.open(scriptToHubUrl(script, $hubBaseUrlStore).toString(), '_blank', 'noopener')
|
||||
}
|
||||
href: scriptToHubUrl(script, $hubBaseUrlStore).toString(),
|
||||
hrefTarget: '_blank'
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
/**
|
||||
* Route a link's plain left-click through the detail page's `onNavigate` instead of
|
||||
* letting the browser follow it. The detail pages keep real `href`s so a reader can
|
||||
@@ -10,8 +12,7 @@ export function interceptNav(
|
||||
url: string
|
||||
): (e?: Event) => void {
|
||||
return (e?: Event) => {
|
||||
const m = e as MouseEvent | undefined
|
||||
if (m && (m.metaKey || m.ctrlKey || m.shiftKey || m.altKey || (m.button ?? 0) !== 0)) return
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
e?.preventDefault()
|
||||
void onNavigate(url)
|
||||
}
|
||||
|
||||
@@ -58,6 +58,8 @@ export type FlowBuilderProps = {
|
||||
onDeploy?: ({ path }: { path: string }) => void
|
||||
onDeployError?: ({ error }: { error: any }) => void
|
||||
onDetails?: ({ path }: { path: string }) => void
|
||||
/** Makes "Exit & see details" a link, so it opens in a new tab on middle/ctrl-click. Wins over `onDetails`. */
|
||||
detailsHref?: (path: string) => string
|
||||
onHistoryRestore?: () => void
|
||||
onNavigate?: (item: WorkspaceItem) => void
|
||||
// Threaded to the `AutosaveIndicator` popover so its "Reset to
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { goto, isNewTabClick } from '$lib/navigation'
|
||||
|
||||
import { Button } from '$lib/components/common'
|
||||
import Drawer from '$lib/components/common/drawer/Drawer.svelte'
|
||||
@@ -36,14 +36,8 @@
|
||||
appTypeModalOpen = true
|
||||
}
|
||||
|
||||
function selectLowCode() {
|
||||
appTypeModalOpen = false
|
||||
goto('/apps/add')
|
||||
}
|
||||
|
||||
function selectFullCode() {
|
||||
appTypeModalOpen = false
|
||||
goto('/apps_raw/add')
|
||||
function closeUnlessNewTab(e: MouseEvent) {
|
||||
if (!isNewTabClick(e)) appTypeModalOpen = false
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -86,9 +80,10 @@
|
||||
<div class="flex flex-col gap-4 pr-4">
|
||||
<div class="grid grid-cols-2 gap-8">
|
||||
<!-- Low-code option -->
|
||||
<button
|
||||
<a
|
||||
href="/apps/add"
|
||||
class="flex flex-col items-center gap-3 p-6 rounded-lg border-2 border-gray-200 dark:border-gray-700 hover:border-orange-500 dark:hover:border-orange-400 hover:bg-orange-50 dark:hover:bg-orange-900/20 transition-all cursor-pointer group"
|
||||
onclick={selectLowCode}
|
||||
onclick={closeUnlessNewTab}
|
||||
>
|
||||
<div
|
||||
class="w-32 h-32 rounded-xl bg-orange-100 dark:bg-orange-900/40 flex items-center justify-center group-hover:bg-orange-200 dark:group-hover:bg-orange-800/50 transition-colors"
|
||||
@@ -104,11 +99,12 @@
|
||||
Better for simple apps or apps that require minimal customization.
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<button
|
||||
<a
|
||||
href="/apps_raw/add"
|
||||
class="relative flex flex-col items-center gap-3 p-6 rounded-lg border-2 border-gray-200 dark:border-gray-700 hover:border-purple-500 dark:hover:border-purple-400 hover:bg-purple-50 dark:hover:bg-purple-900/20 transition-all cursor-pointer group"
|
||||
onclick={selectFullCode}
|
||||
onclick={closeUnlessNewTab}
|
||||
>
|
||||
<div
|
||||
class="w-32 h-32 rounded-xl bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center group-hover:bg-purple-200 dark:group-hover:bg-purple-800/50 transition-colors"
|
||||
@@ -124,7 +120,7 @@
|
||||
Better for complex apps or apps that require full flexibility and control.
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { goto, isNewTabClick } from '$lib/navigation'
|
||||
import BarsStaggered from '$lib/components/icons/BarsStaggered.svelte'
|
||||
|
||||
import { Button } from '$lib/components/common'
|
||||
@@ -42,24 +42,8 @@
|
||||
flowModalOpen = true
|
||||
}
|
||||
|
||||
function selectFlowEditor() {
|
||||
flowModalOpen = false
|
||||
goto('/flows/add')
|
||||
}
|
||||
|
||||
function selectWacPython() {
|
||||
flowModalOpen = false
|
||||
goto('/scripts/add?wac=python')
|
||||
}
|
||||
|
||||
function selectWacTypescript() {
|
||||
flowModalOpen = false
|
||||
goto('/scripts/add?wac=typescript')
|
||||
}
|
||||
|
||||
function selectPipeline() {
|
||||
flowModalOpen = false
|
||||
goto('/pipeline')
|
||||
function closeUnlessNewTab(e: MouseEvent) {
|
||||
if (!isNewTabClick(e)) flowModalOpen = false
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -83,11 +67,11 @@
|
||||
},
|
||||
{
|
||||
label: 'Workflow-as-Code in TypeScript',
|
||||
onClick: () => selectWacTypescript()
|
||||
href: '/scripts/add?wac=typescript'
|
||||
},
|
||||
{
|
||||
label: 'Workflow-as-Code in Python',
|
||||
onClick: () => selectWacPython()
|
||||
href: '/scripts/add?wac=python'
|
||||
},
|
||||
{
|
||||
label: 'Import Workflow-as-Code',
|
||||
@@ -97,7 +81,7 @@
|
||||
},
|
||||
{
|
||||
label: 'Pipeline (alpha)',
|
||||
onClick: () => selectPipeline()
|
||||
href: '/pipeline'
|
||||
}
|
||||
]}
|
||||
>
|
||||
@@ -112,9 +96,10 @@
|
||||
<div class="flex flex-col gap-4 pr-4">
|
||||
<div class="grid grid-cols-2 gap-6">
|
||||
<!-- Flow Editor option -->
|
||||
<button
|
||||
<a
|
||||
href="/flows/add"
|
||||
class="flex flex-col items-center gap-3 p-6 rounded-lg border-2 border-gray-200 dark:border-gray-700 hover:border-blue-500 dark:hover:border-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 transition-all cursor-pointer group"
|
||||
onclick={selectFlowEditor}
|
||||
onclick={closeUnlessNewTab}
|
||||
>
|
||||
<div
|
||||
class="w-32 h-32 rounded-xl bg-blue-100 dark:bg-blue-900/40 flex items-center justify-center group-hover:bg-blue-200 dark:group-hover:bg-blue-800/50 transition-colors"
|
||||
@@ -128,7 +113,7 @@
|
||||
handling.
|
||||
</p>
|
||||
</div>
|
||||
</button>
|
||||
</a>
|
||||
|
||||
<!-- Workflow-as-Code option -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
@@ -160,9 +145,10 @@
|
||||
class="flex flex-col h-full transition-all duration-300"
|
||||
style="opacity: {wacHovered ? 1 : 0}; transform: scale({wacHovered ? 1 : 0.95})"
|
||||
>
|
||||
<button
|
||||
<a
|
||||
href="/scripts/add?wac=typescript"
|
||||
class="flex-1 flex items-center justify-center gap-3 p-4 hover:bg-purple-100 dark:hover:bg-purple-900/40 transition-colors border-b border-gray-200 dark:border-gray-700"
|
||||
onclick={selectWacTypescript}
|
||||
onclick={closeUnlessNewTab}
|
||||
>
|
||||
<div
|
||||
class="w-12 h-12 rounded-xl bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center"
|
||||
@@ -170,10 +156,11 @@
|
||||
<TypeScriptIcon width={24} height={24} />
|
||||
</div>
|
||||
<span class="font-semibold text-sm text-primary">TypeScript</span>
|
||||
</button>
|
||||
<button
|
||||
</a>
|
||||
<a
|
||||
href="/scripts/add?wac=python"
|
||||
class="flex-1 flex items-center justify-center gap-3 p-4 hover:bg-purple-100 dark:hover:bg-purple-900/40 transition-colors"
|
||||
onclick={selectWacPython}
|
||||
onclick={closeUnlessNewTab}
|
||||
>
|
||||
<div
|
||||
class="w-12 h-12 rounded-xl bg-purple-100 dark:bg-purple-900/40 flex items-center justify-center"
|
||||
@@ -181,7 +168,7 @@
|
||||
<PythonIcon width={24} height={24} />
|
||||
</div>
|
||||
<span class="font-semibold text-sm text-primary">Python</span>
|
||||
</button>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -205,11 +205,8 @@
|
||||
<Button
|
||||
size="sm"
|
||||
variant="accent"
|
||||
on:click={() =>
|
||||
window.open(
|
||||
`/flows/add?template_id=${selectedVersion?.id}&template=${path}&workspace=${$operatingWorkspace}`,
|
||||
'_blank'
|
||||
)}
|
||||
href={`/flows/add?template_id=${selectedVersion?.id}&template=${path}&workspace=${$operatingWorkspace}`}
|
||||
target="_blank"
|
||||
>
|
||||
Restore as fork
|
||||
</Button>
|
||||
|
||||
@@ -1,13 +1,4 @@
|
||||
import {
|
||||
Copy,
|
||||
Eye,
|
||||
FileUp,
|
||||
History,
|
||||
LayoutDashboard,
|
||||
List,
|
||||
Trash,
|
||||
UserPlus
|
||||
} from 'lucide-svelte'
|
||||
import { Copy, Eye, FileUp, History, LayoutDashboard, List, Trash, UserPlus } from 'lucide-svelte'
|
||||
import { DraftService, ResourceService, type AiAgent, type OpenFlow } from '$lib/gen'
|
||||
import { mintDraftPath } from '$lib/mintDraftPath'
|
||||
import { keepsManagedMemory } from './agentFormFields'
|
||||
@@ -122,7 +113,7 @@ export function agentMenuItems(agent: {
|
||||
// are filed under `<path>.chat` (agent_runs.rs) and listed by the agent's own chat.
|
||||
displayName: 'View runs',
|
||||
icon: List,
|
||||
action: () => goto(`/runs/${agent.path}?job_kinds=previews`)
|
||||
href: `/runs/${agent.path}?job_kinds=previews`
|
||||
},
|
||||
...(agent.noCode
|
||||
? []
|
||||
@@ -130,7 +121,7 @@ export function agentMenuItems(agent: {
|
||||
{
|
||||
displayName: 'Audit logs',
|
||||
icon: Eye,
|
||||
action: () => goto(`/audit_logs?resource=${agent.path}`)
|
||||
href: `/audit_logs?resource=${agent.path}`
|
||||
}
|
||||
]),
|
||||
{ displayName: 'Copy path', icon: Copy, action: () => copyToClipboard(agent.path) }
|
||||
|
||||
@@ -91,13 +91,10 @@
|
||||
})
|
||||
})
|
||||
|
||||
function reportIssue() {
|
||||
function reportIssueHref(): string {
|
||||
const targetHubBaseUrl =
|
||||
Number(hubVersionId) < PRIVATE_HUB_MIN_VERSION ? DEFAULT_HUB_BASE_URL : $hubBaseUrlStore
|
||||
window.open(
|
||||
`${targetHubBaseUrl}/from_version/${hubVersionId}?report_issue=${hubVersionId}`,
|
||||
'_blank'
|
||||
)
|
||||
return `${targetHubBaseUrl}/from_version/${hubVersionId}?report_issue=${hubVersionId}`
|
||||
}
|
||||
|
||||
// Every one of these acts on the referenced script rather than the step, so they share
|
||||
@@ -194,7 +191,8 @@
|
||||
displayName: 'Report issue',
|
||||
icon: Flag,
|
||||
separatorTop: items.length > 0,
|
||||
action: reportIssue
|
||||
href: reportIssueHref(),
|
||||
hrefTarget: '_blank'
|
||||
})
|
||||
}
|
||||
return items
|
||||
|
||||
@@ -8,6 +8,8 @@
|
||||
import AgentUsePanel from '$lib/components/flows/content/AgentUsePanel.svelte'
|
||||
import { SlackAgentsService } from '$lib/gen'
|
||||
import DetailPageHeader from '$lib/components/details/DetailPageHeader.svelte'
|
||||
import { interceptNav } from '$lib/components/details/interceptNav'
|
||||
import { useOperatingWorkspaceHref } from '$lib/components/operatingWorkspace.svelte'
|
||||
import OnBehalfOfBadge from '$lib/components/details/OnBehalfOfBadge.svelte'
|
||||
import ToggleButtonGroup from '$lib/components/common/toggleButton-v2/ToggleButtonGroup.svelte'
|
||||
import ToggleButton from '$lib/components/common/toggleButton-v2/ToggleButton.svelte'
|
||||
@@ -91,6 +93,7 @@
|
||||
let config = $derived(agent?.state?.args)
|
||||
let chatAvailable = $derived(keepsManagedMemory(config?.memory))
|
||||
const editRights = useEditRights(() => ws)
|
||||
const operatingHref = useOperatingWorkspaceHref()
|
||||
let canAuthor = $derived(editRights.roleCanAuthor('agent'))
|
||||
let canCode = $derived(editRights.capabilities.code)
|
||||
|
||||
@@ -237,7 +240,10 @@
|
||||
}).map((item) => ({
|
||||
label: item.displayName,
|
||||
Icon: item.icon,
|
||||
onclick: (e: MouseEvent) => item.action?.(e),
|
||||
href: item.href && operatingHref(item.href),
|
||||
onclick: item.href
|
||||
? interceptNav(onNavigate, item.href)
|
||||
: (e: MouseEvent) => item.action?.(e),
|
||||
disabled: item.disabled,
|
||||
color: item.type === 'delete' ? ('red' as const) : undefined
|
||||
}))
|
||||
|
||||
@@ -71,6 +71,13 @@
|
||||
|
||||
let diffDrawer: DiffDrawer | undefined = $state()
|
||||
let flowBuilder: FlowBuilder | undefined = $state(undefined)
|
||||
|
||||
// Follow the drawer's own selection, which the user may have moved since it opened.
|
||||
let editHref = $derived.by(() => {
|
||||
const stepId = flowBuilder?.getSelectedId() ?? selectedStepId
|
||||
const selected = stepId ? `?selected=${encodeURIComponent(stepId)}` : ''
|
||||
return `/flows/edit/${flowPath}${selected}`
|
||||
})
|
||||
</script>
|
||||
|
||||
<Drawer bind:this={flowEditorDrawer} size="100%">
|
||||
@@ -122,13 +129,10 @@
|
||||
{#snippet actions()}
|
||||
<Button
|
||||
variant="default"
|
||||
on:click={() => {
|
||||
// Follow the drawer's own selection, which the user may have moved since it opened.
|
||||
const stepId = flowBuilder?.getSelectedId() ?? selectedStepId
|
||||
const selected = stepId ? `?selected=${encodeURIComponent(stepId)}` : ''
|
||||
window.open(`/flows/edit/${flowPath}${selected}`, '_blank', 'noopener,noreferrer')
|
||||
flowEditorDrawer?.closeDrawer()
|
||||
}}
|
||||
href={editHref}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
onClick={() => flowEditorDrawer?.closeDrawer()}
|
||||
startIcon={{ icon: ExternalLink }}
|
||||
>
|
||||
Edit in new tab & close drawer
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
type Variant = {
|
||||
label: string
|
||||
icon: typeof PythonIcon
|
||||
onSelect: () => void
|
||||
href: string
|
||||
badge?: { label: string; class: string }
|
||||
/** opened in a new tab from a link beside the variant */
|
||||
docHref?: string
|
||||
@@ -100,7 +100,8 @@
|
||||
tagline: string
|
||||
description: string
|
||||
bullets: string[]
|
||||
onSelect: () => void
|
||||
/** the editor this option opens; unused when `variants` is set */
|
||||
href: string
|
||||
/** optional sub-choices shown in place of the single create button */
|
||||
variants?: Variant[]
|
||||
/** optional pill shown next to the label; class is the full static tailwind tone */
|
||||
@@ -136,7 +137,7 @@
|
||||
'Auto-generated UI from parameters',
|
||||
'Instant deploy & versioning'
|
||||
],
|
||||
onSelect: () => goto('/scripts/add')
|
||||
href: '/scripts/add'
|
||||
},
|
||||
...(HOME_SHOW_CREATE_FLOW
|
||||
? ([
|
||||
@@ -153,7 +154,7 @@
|
||||
'Branches, loops & error handling',
|
||||
'Suspend / approval steps'
|
||||
],
|
||||
onSelect: () => goto('/flows/add'),
|
||||
href: '/flows/add',
|
||||
extras: [{ label: 'Import flow', onSelect: () => openImport('flow') }]
|
||||
}
|
||||
] as Option[])
|
||||
@@ -169,7 +170,7 @@
|
||||
description:
|
||||
'Full control over the UI with React or Svelte and a powerful AI agent. Best for complex apps that need full flexibility.',
|
||||
bullets: ['React or Svelte', 'Full flexibility & control', 'AI-assisted authoring'],
|
||||
onSelect: () => goto('/apps_raw/add'),
|
||||
href: '/apps_raw/add',
|
||||
extras: [{ label: 'Import full-code app', onSelect: () => openImport('app-fullcode') }]
|
||||
}
|
||||
] as Option[])
|
||||
@@ -187,7 +188,7 @@
|
||||
'Reusable as a step in any flow',
|
||||
'Tools from scripts, flows and MCP'
|
||||
],
|
||||
onSelect: () => goto('/agents/add')
|
||||
href: '/agents/add'
|
||||
},
|
||||
...(HOME_SHOW_CREATE_FLOW
|
||||
? ([
|
||||
@@ -204,18 +205,18 @@
|
||||
'Full control via the SDK',
|
||||
'Versioned as a regular script'
|
||||
],
|
||||
onSelect: () => goto('/scripts/add?wac=typescript'),
|
||||
href: '/scripts/add?wac=typescript',
|
||||
badge: { label: 'Advanced', class: badgeAdvanced },
|
||||
variants: [
|
||||
{
|
||||
label: 'TypeScript',
|
||||
icon: TypeScriptIcon,
|
||||
onSelect: () => goto('/scripts/add?wac=typescript')
|
||||
href: '/scripts/add?wac=typescript'
|
||||
},
|
||||
{
|
||||
label: 'Python',
|
||||
icon: PythonIcon,
|
||||
onSelect: () => goto('/scripts/add?wac=python')
|
||||
href: '/scripts/add?wac=python'
|
||||
}
|
||||
],
|
||||
extras: [{ label: 'Import Workflow-as-Code', onSelect: () => openImport('wac') }]
|
||||
@@ -233,20 +234,20 @@
|
||||
'Partitioned & incremental',
|
||||
'Asset-aware lineage'
|
||||
],
|
||||
onSelect: () => goto('/pipeline'),
|
||||
href: '/pipeline',
|
||||
badge: { label: 'Alpha', class: badgeAlpha },
|
||||
variants: [
|
||||
{
|
||||
label: 'Windmill pipelines',
|
||||
icon: Workflow,
|
||||
badge: { label: 'Recommended', class: badgeRecommended },
|
||||
onSelect: () => goto('/pipeline')
|
||||
href: '/pipeline'
|
||||
},
|
||||
{
|
||||
label: 'dbt',
|
||||
icon: DbtIcon,
|
||||
docHref: DBT_DOCS,
|
||||
onSelect: () => goto('/scripts/add?lang=dbt'),
|
||||
href: '/scripts/add?lang=dbt',
|
||||
doc: {
|
||||
label: 'dbt',
|
||||
icon: DbtIcon,
|
||||
@@ -276,7 +277,7 @@
|
||||
description:
|
||||
'Assemble an internal UI from 60+ components wired to your scripts and flows. Best for simple apps or apps that need minimal customization.',
|
||||
bullets: ['60+ ready-made components', 'No code required', 'Backed by scripts & flows'],
|
||||
onSelect: () => goto('/apps/add'),
|
||||
href: '/apps/add',
|
||||
badge: { label: 'Legacy', class: badgeLegacy },
|
||||
extras: [{ label: 'Import low-code app', onSelect: () => openImport('app-lowcode') }]
|
||||
}
|
||||
@@ -671,10 +672,10 @@
|
||||
{#each option.variants ?? [] as variant (variant.label)}
|
||||
{@const VariantIcon = variant.icon}
|
||||
<div class="flex flex-row items-center gap-1">
|
||||
<button
|
||||
<a
|
||||
use:melt={$item}
|
||||
href={variant.href}
|
||||
class="flex flex-row flex-1 items-center gap-2.5 rounded-md px-2 py-1.5 text-left cursor-pointer transition-colors focus:outline-none data-[highlighted]:bg-surface-hover hover:bg-surface-hover"
|
||||
onclick={() => variant.onSelect()}
|
||||
onfocusin={() => (activeVariantDoc = variant.doc)}
|
||||
onpointerenter={() => (activeVariantDoc = variant.doc)}
|
||||
>
|
||||
@@ -690,7 +691,7 @@
|
||||
{variant.badge.label}
|
||||
</span>
|
||||
{/if}
|
||||
</button>
|
||||
</a>
|
||||
{#if variant.docHref}
|
||||
<a
|
||||
href={variant.docHref}
|
||||
@@ -723,15 +724,15 @@
|
||||
{:else if option.variants}
|
||||
{@render variantRow(option, ac, rowClass, $wacSubTrigger, $wacSubMenu, $wacSubOpen)}
|
||||
{:else}
|
||||
<button
|
||||
<a
|
||||
use:melt={$item}
|
||||
class={rowClass}
|
||||
href={option.href}
|
||||
class="{rowClass} text-[color:inherit]"
|
||||
onfocusin={() => highlightOption(option.key)}
|
||||
onpointerenter={() => highlightOption(option.key)}
|
||||
onclick={() => option.onSelect()}
|
||||
>
|
||||
{@render rowBody(option, ac)}
|
||||
</button>
|
||||
</a>
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { Pen, Trash, Users } from 'lucide-svelte'
|
||||
import { onMount, type Snippet } from 'svelte'
|
||||
import { page } from '$app/state'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
interface Props {
|
||||
/** Renders nothing, header included, when there are no groups. */
|
||||
@@ -41,10 +43,31 @@
|
||||
}
|
||||
|
||||
export function open(name: string) {
|
||||
handledName = name
|
||||
openName = name
|
||||
drawer?.openDrawer()
|
||||
}
|
||||
|
||||
// Deep link: #<name> opens that group's drawer. `open` pre-sets handledName, so a row
|
||||
// click that also sets the hash doesn't reopen it. Names are compared decoded since the
|
||||
// browser percent-encodes the hash.
|
||||
let handledName = ''
|
||||
$effect(() => {
|
||||
const hash = page.url.hash
|
||||
if (hash.length <= 1) {
|
||||
handledName = ''
|
||||
return
|
||||
}
|
||||
let name: string
|
||||
try {
|
||||
name = decodeURIComponent(hash.slice(1))
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
if (name === handledName || !groups || !drawer) return
|
||||
if (groups.some((g) => g.name === name)) open(name)
|
||||
})
|
||||
|
||||
export async function created(name: string) {
|
||||
await reload()
|
||||
open(name)
|
||||
@@ -108,7 +131,17 @@
|
||||
<Row hoverable on:click={() => open(group.name)}>
|
||||
<Cell first>
|
||||
<div class="flex flex-col min-w-0">
|
||||
<span class="text-emphasis text-xs font-semibold">{group.name}</span>
|
||||
<!-- The row opens the drawer on any click; the name is the link a new-tab click
|
||||
follows, so it keeps that click from the row. -->
|
||||
<a
|
||||
href="#{encodeURIComponent(group.name)}"
|
||||
class="text-emphasis text-xs font-semibold"
|
||||
onclick={(e) => {
|
||||
e.stopPropagation()
|
||||
if (isNewTabClick(e)) return
|
||||
open(group.name)
|
||||
}}>{group.name}</a
|
||||
>
|
||||
{#if group.summary}
|
||||
<span class="text-2xs font-normal text-secondary truncate" title={group.summary}>
|
||||
{group.summary}
|
||||
|
||||
@@ -178,6 +178,8 @@
|
||||
/** `Exit & see details`: see RawAppEditorHeader. */
|
||||
onDetails?: (e: { path: string }) => void
|
||||
/** See RawAppEditorHeader. */
|
||||
detailsHref?: (path: string) => string
|
||||
/** See RawAppEditorHeader. */
|
||||
onOpenFork?: (path: string) => void
|
||||
onResetToDeployed?: () => void | Promise<void>
|
||||
/** The app_version the draft forked from, for the deploy-time "new version
|
||||
@@ -251,6 +253,7 @@
|
||||
pendingDraftPath = $bindable(undefined),
|
||||
pendingDraftSettings = $bindable(),
|
||||
onDetails,
|
||||
detailsHref,
|
||||
onOpenFork,
|
||||
onResetToDeployed,
|
||||
loadedFromDraft = false,
|
||||
@@ -2742,6 +2745,7 @@ addEventListener('message', function (e) {
|
||||
{onNavigate}
|
||||
{onDeploy}
|
||||
{onDetails}
|
||||
{detailsHref}
|
||||
{onOpenFork}
|
||||
{onResetToDeployed}
|
||||
{loadedFromDraft}
|
||||
|
||||
@@ -208,6 +208,9 @@
|
||||
/** `Exit & see details`: leaves the editor for the app's deployed page. A session hosts that
|
||||
* page itself, so it flips the tab there rather than navigating out of the session. */
|
||||
onDetails?: (e: { path: string }) => void
|
||||
/** Makes `Exit & see details` a link, so it opens in a new tab on middle/ctrl-click. Wins
|
||||
* over `onDetails`. */
|
||||
detailsHref?: (path: string) => string
|
||||
/** Opens the draft `Fork` saved. Without it, the fork opens in a new browser tab; a
|
||||
* session opens it as one of its own tabs instead. */
|
||||
onOpenFork?: (path: string) => void
|
||||
@@ -263,6 +266,7 @@
|
||||
pendingDraftPath = $bindable(undefined),
|
||||
pendingDraftSettings = $bindable(),
|
||||
onDetails,
|
||||
detailsHref,
|
||||
onOpenFork,
|
||||
onResetToDeployed,
|
||||
loadedFromDraft = false,
|
||||
@@ -1347,10 +1351,12 @@
|
||||
...(newApp
|
||||
? []
|
||||
: [
|
||||
{
|
||||
label: 'Exit & see details',
|
||||
onClick: () => onDetails?.({ path: appPath })
|
||||
}
|
||||
detailsHref
|
||||
? { label: 'Exit & see details', href: detailsHref(appPath) }
|
||||
: {
|
||||
label: 'Exit & see details',
|
||||
onClick: () => onDetails?.({ path: appPath })
|
||||
}
|
||||
]),
|
||||
{
|
||||
label: 'Fork',
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getLocalDraftHint } from '$lib/localDraftHints.svelte'
|
||||
import { page } from '$app/state'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import AppConnect from '$lib/components/AppConnectDrawer.svelte'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import { Alert, Badge, Button, EmptyState, Skeleton, Tab, TabFade } from '$lib/components/common'
|
||||
@@ -84,7 +85,10 @@
|
||||
openAgentEditor
|
||||
} from '$lib/components/flows/agentEditorStore.svelte'
|
||||
import { copilotInfo } from '$lib/aiStore'
|
||||
import { setPageDrawerAnchor } from '$lib/components/sessions/pageDrawerSession'
|
||||
import {
|
||||
clearPageDrawerAnchor,
|
||||
setPageDrawerAnchor
|
||||
} from '$lib/components/sessions/pageDrawerSession'
|
||||
import { useHostedPage } from '$lib/components/hostedPage'
|
||||
import { RESOURCES_PATH } from '$lib/components/sessions/previewPaths'
|
||||
import GfmMarkdown from '$lib/components/GfmMarkdown.svelte'
|
||||
@@ -172,6 +176,23 @@
|
||||
resourceEditor?.initEdit?.(path)
|
||||
}
|
||||
}
|
||||
|
||||
function openResourceTypeViewer(name: string) {
|
||||
const rt = resourceTypes?.find((rt) => rt.name === name)
|
||||
if (!rt) {
|
||||
sendUserToast(`Resource type ${name} not found in workspace.`, true)
|
||||
return
|
||||
}
|
||||
resourceTypeViewerObj = {
|
||||
rt: rt.name,
|
||||
//@ts-ignore
|
||||
schema: rt.schema,
|
||||
description: rt.description ?? '',
|
||||
formatExtension: rt.format_extension,
|
||||
isFileset: rt.is_fileset ?? false
|
||||
}
|
||||
resourceTypeViewer?.openDrawer?.()
|
||||
}
|
||||
let shareModal: ShareModal | undefined = $state(undefined)
|
||||
let appConnect: AppConnect | undefined = $state(undefined)
|
||||
let supabaseConnect: SupabaseConnect | undefined = $state(undefined)
|
||||
@@ -704,15 +725,22 @@
|
||||
}
|
||||
})
|
||||
|
||||
// Deep link: #/resource/<path> opens that resource's edit drawer. Reactive
|
||||
// rather than onMount so a hash change on the already-mounted page (e.g. the
|
||||
// AI session preview re-pointing its tab) opens the drawer too. Row links
|
||||
// Deep link: #/resource/<path> opens that resource's edit drawer, #/resource_type/<name>
|
||||
// that type's viewer. Reactive rather than onMount so a hash change on the already-mounted
|
||||
// page (e.g. the AI session preview re-pointing its tab) opens the drawer too. Row links
|
||||
// pre-set handledHash: their onclick already opens the drawer.
|
||||
const RESOURCE_TYPE_HASH = '#/resource_type/'
|
||||
let handledHash = ''
|
||||
$effect(() => {
|
||||
// A host opens rows itself, and the document's hash is not this page's.
|
||||
if (hosted) return
|
||||
const hash = page.url.hash
|
||||
if (hash.startsWith(RESOURCE_TYPE_HASH)) {
|
||||
if (hash === handledHash || !resourceTypes) return
|
||||
handledHash = hash
|
||||
openResourceTypeViewer(hash.slice(RESOURCE_TYPE_HASH.length))
|
||||
return
|
||||
}
|
||||
if (!hash.startsWith('#/resource/')) {
|
||||
// Navigating away from a drawer target must clear the tracker, or
|
||||
// re-targeting the same item later would be skipped as already handled.
|
||||
@@ -844,7 +872,13 @@
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
<Drawer bind:this={resourceTypeViewer} size="800px">
|
||||
<Drawer
|
||||
bind:this={resourceTypeViewer}
|
||||
size="800px"
|
||||
on:close={() => {
|
||||
if (window.location.hash.startsWith(RESOURCE_TYPE_HASH)) clearPageDrawerAnchor(RESOURCES_PATH)
|
||||
}}
|
||||
>
|
||||
<DrawerContent title={resourceTypeViewerObj.rt} on:close={resourceTypeViewer.closeDrawer}>
|
||||
{#snippet titleExtra()}
|
||||
<IconedResourceType
|
||||
@@ -1219,7 +1253,8 @@
|
||||
<a
|
||||
class="break-all"
|
||||
href="#/resource/{path}"
|
||||
onclick={() => {
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
handledHash = `#/resource/${path}`
|
||||
openResourceEditor(path, resource_type)
|
||||
}}
|
||||
@@ -1254,25 +1289,11 @@
|
||||
</Cell>
|
||||
<Cell>
|
||||
<a
|
||||
href="#{name}"
|
||||
onclick={() => {
|
||||
const linkedRt = resourceTypes?.find((rt) => rt.name === resource_type)
|
||||
if (linkedRt) {
|
||||
resourceTypeViewerObj = {
|
||||
rt: linkedRt.name,
|
||||
//@ts-ignore
|
||||
schema: linkedRt.schema,
|
||||
description: linkedRt.description ?? '',
|
||||
formatExtension: linkedRt.format_extension,
|
||||
isFileset: linkedRt.is_fileset ?? false
|
||||
}
|
||||
resourceTypeViewer?.openDrawer?.()
|
||||
} else {
|
||||
sendUserToast(
|
||||
`Resource type ${resource_type} not found in workspace.`,
|
||||
true
|
||||
)
|
||||
}
|
||||
href="{RESOURCE_TYPE_HASH}{resource_type}"
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
handledHash = `${RESOURCE_TYPE_HASH}${resource_type}`
|
||||
openResourceTypeViewer(resource_type)
|
||||
}}
|
||||
>
|
||||
<IconedResourceType
|
||||
@@ -1506,23 +1527,16 @@
|
||||
</Head>
|
||||
<tbody class="divide-y bg-surface">
|
||||
{#if filteredResourceTypes}
|
||||
{#each filteredResourceTypes as { name, description, schema, workspace_id, format_extension, is_fileset }}
|
||||
{#each filteredResourceTypes as { name, description, workspace_id, format_extension, is_fileset }}
|
||||
{@const canWrite = workspace_id == $operatingWorkspace}
|
||||
<Row>
|
||||
<Cell first>
|
||||
<a
|
||||
href="#{name}"
|
||||
onclick={() => {
|
||||
resourceTypeViewerObj = {
|
||||
rt: name,
|
||||
//@ts-ignore
|
||||
schema: schema,
|
||||
description: description ?? '',
|
||||
formatExtension: format_extension,
|
||||
isFileset: is_fileset ?? false
|
||||
}
|
||||
|
||||
resourceTypeViewer?.openDrawer?.()
|
||||
href="{RESOURCE_TYPE_HASH}{name}"
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
handledHash = `${RESOURCE_TYPE_HASH}${name}`
|
||||
openResourceTypeViewer(name)
|
||||
}}
|
||||
>
|
||||
<IconedResourceType
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
isScriptPreview,
|
||||
type Item
|
||||
} from '$lib/utils'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import BarsStaggered from '$lib/components/icons/BarsStaggered.svelte'
|
||||
|
||||
import {
|
||||
@@ -744,6 +745,13 @@
|
||||
: `${stem}/get/${isScriptJob ? job?.script_hash : job?.script_path}`
|
||||
)
|
||||
const editHref = $derived(`${stem}/edit/${job?.script_path}?workspace=${workspaceId}`)
|
||||
// The run's args reach the editor through the in-memory store, never the URL: they can hold
|
||||
// secrets that must not land in history or access logs. A new tab can't read the store, so
|
||||
// it opens the editor without them, and the store is left alone for this tab's next editor.
|
||||
function seedEditArgs(e?: Event) {
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
$initialArgsStore = job?.args
|
||||
}
|
||||
const forkPreviewLabel = $derived(
|
||||
isHubFlowPreview
|
||||
? 'Fork flow into workspace'
|
||||
@@ -877,7 +885,7 @@
|
||||
displayName: 'Edit',
|
||||
icon: Pen,
|
||||
href: editHref,
|
||||
action: () => ($initialArgsStore = job?.args),
|
||||
action: seedEditArgs,
|
||||
disabled: !showEditButton,
|
||||
hide: !canEdit
|
||||
},
|
||||
@@ -1348,10 +1356,8 @@
|
||||
{#if canEdit || canEditInFork}
|
||||
{#if editRights.canEditItem(isScriptJob ? 'script' : 'flow', job?.script_path ?? '', {})}
|
||||
<Button
|
||||
href={`${stem}/edit/${job?.script_path}?workspace=${workspaceId}`}
|
||||
on:click={() => {
|
||||
$initialArgsStore = job?.args
|
||||
}}
|
||||
href={editHref}
|
||||
onClick={seedEditArgs}
|
||||
unifiedSize="sm"
|
||||
variant="default"
|
||||
disabled={!showEditButton}
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
import RightClickPopover from '../RightClickPopover.svelte'
|
||||
import DropdownMenu, { type Props as DropdownMenuProps } from '../DropdownMenu.svelte'
|
||||
import { clickOutside, isJobCancelable, isJobReRunnable, isJobResolvable } from '$lib/utils'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { useHostedPage } from '../hostedPage'
|
||||
import { useOperatingWorkspace } from '../operatingWorkspace.svelte'
|
||||
import { useRoleCapabilities } from '$lib/operatorWriteRights'
|
||||
@@ -210,9 +209,12 @@
|
||||
|
||||
// Under a host the link opens where it decides, in the workspace the run belongs to: the
|
||||
// document's own router would leave the host for the navigation workspace.
|
||||
function open(href: string) {
|
||||
if (!hosted) goto(href)
|
||||
else hosted.openLink(withWorkspaceParam(href, selectedWorkspace ?? $operatingWorkspace))
|
||||
function linkTo(href: string): { href: string } | { onClick: () => void } {
|
||||
if (!hosted) return { href }
|
||||
return {
|
||||
onClick: () =>
|
||||
hosted.openLink(withWorkspaceParam(href, selectedWorkspace ?? $operatingWorkspace))
|
||||
}
|
||||
}
|
||||
|
||||
let scrollToIndex = $state(0)
|
||||
@@ -285,7 +287,7 @@
|
||||
actions.push({
|
||||
label: 'Show run details',
|
||||
icon: ExternalLinkIcon,
|
||||
onClick: () => open(`/run/${selectedIds[0]}`)
|
||||
...linkTo(`/run/${selectedIds[0]}`)
|
||||
})
|
||||
const job = flatJobs?.find(
|
||||
(jobOrDate) => jobOrDate.type === 'job' && jobOrDate.job.id === selectedIds[0]
|
||||
@@ -295,20 +297,19 @@
|
||||
actions.push({
|
||||
label: 'Go to script page',
|
||||
icon: Code2Icon,
|
||||
onClick: () =>
|
||||
open(
|
||||
// A host addresses an item by its path, and pins a version in the query.
|
||||
hosted
|
||||
? `/scripts/get/${job.job.script_path}?version=${job.job.script_hash}`
|
||||
: `/scripts/get/${job.job.script_hash}`
|
||||
)
|
||||
...linkTo(
|
||||
// A host addresses an item by its path, and pins a version in the query.
|
||||
hosted
|
||||
? `/scripts/get/${job.job.script_path}?version=${job.job.script_hash}`
|
||||
: `/scripts/get/${job.job.script_hash}`
|
||||
)
|
||||
})
|
||||
}
|
||||
if (job.job.job_kind === 'flow') {
|
||||
actions.push({
|
||||
label: 'Go to flow page',
|
||||
icon: BarsStaggered,
|
||||
onClick: () => open(`/flows/get/${job.job.script_path}`)
|
||||
...linkTo(`/flows/get/${job.job.script_path}`)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
TriangleAlert,
|
||||
UserPlus
|
||||
} from 'lucide-svelte'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import FilterSearchbar, {
|
||||
hasActiveFilters,
|
||||
@@ -425,7 +425,8 @@
|
||||
|
||||
<a
|
||||
href="#{path}"
|
||||
onclick={() => {
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
handledHash = `#${path}`
|
||||
editSchedule(path, is_flow)
|
||||
}}
|
||||
@@ -584,10 +585,7 @@
|
||||
{
|
||||
displayName: `View ${is_flow ? 'Flow' : 'Script'}`,
|
||||
icon: Eye,
|
||||
action: () => {
|
||||
if (hosted) hosted.openLink(href)
|
||||
else goto(href)
|
||||
}
|
||||
...(hosted ? { action: () => hosted.openLink(href) } : { href })
|
||||
},
|
||||
{
|
||||
displayName: `Duplicate schedule`,
|
||||
|
||||
@@ -82,6 +82,8 @@ export interface ScriptBuilderProps {
|
||||
onDeployError?: (e: { path: string; error: any }) => void
|
||||
onHistoryRestore?: () => void
|
||||
onSeeDetails?: (e: { path: string }) => void
|
||||
/** Makes "Exit & See details" a link, so it opens in a new tab on middle/ctrl-click. Wins over `onSeeDetails`. */
|
||||
seeDetailsHref?: (path: string) => string
|
||||
onNavigate?: (item: WorkspaceItem) => void
|
||||
// Fired whenever a test run is started from the script editor, with the
|
||||
// preview job id. Used by whitelabel embedders to track test jobs.
|
||||
|
||||
@@ -78,10 +78,15 @@
|
||||
search_id: string
|
||||
label: string
|
||||
action: () => void
|
||||
href?: string
|
||||
icon?: any
|
||||
shortcutKey?: string
|
||||
disabled?: boolean
|
||||
}
|
||||
|
||||
function navTo(path: string) {
|
||||
return { href: path, action: (newtab: boolean = false) => gotoPage(path, newtab) }
|
||||
}
|
||||
let switchModeItems: quickMenuItem[] = [
|
||||
{
|
||||
search_id: 'switchto:run-search',
|
||||
@@ -106,77 +111,77 @@
|
||||
{
|
||||
search_id: 'nav:http_routes',
|
||||
label: 'Go to HTTP routes',
|
||||
action: (newtab: boolean = false) => gotoPage('/routes', newtab),
|
||||
...navTo('/routes'),
|
||||
icon: Route,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:web_sockets',
|
||||
label: 'Go to WebSockets',
|
||||
action: (newtab: boolean = false) => gotoPage('/websocket_triggers', newtab),
|
||||
...navTo('/websocket_triggers'),
|
||||
icon: Unplug,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:postgres_triggers',
|
||||
label: 'Go to Postgres triggers',
|
||||
action: (newtab: boolean = false) => gotoPage('/postgres_triggers', newtab),
|
||||
...navTo('/postgres_triggers'),
|
||||
icon: Database,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:kafka_triggers',
|
||||
label: 'Go to Kafka triggers' + (!$enterpriseLicense ? '' : ' (EE)'),
|
||||
action: (newtab: boolean = false) => gotoPage('/kafka_triggers', newtab),
|
||||
...navTo('/kafka_triggers'),
|
||||
icon: KafkaIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:nats_triggers',
|
||||
label: 'Go to NATS triggers' + (!$enterpriseLicense ? '' : ' (EE)'),
|
||||
action: (newtab: boolean = false) => gotoPage('/nats_triggers', newtab),
|
||||
...navTo('/nats_triggers'),
|
||||
icon: NatsIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:sqs_triggers',
|
||||
label: 'Go to SQS triggers' + (!$enterpriseLicense ? '' : ' (EE)'),
|
||||
action: (newtab: boolean = false) => gotoPage('/sqs_triggers', newtab),
|
||||
...navTo('/sqs_triggers'),
|
||||
icon: AwsIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:gcp_pub_sub',
|
||||
label: 'Go to GCP Pub/Sub' + (!$enterpriseLicense ? '' : ' (EE)'),
|
||||
action: (newtab: boolean = false) => gotoPage('/gcp_triggers', newtab),
|
||||
...navTo('/gcp_triggers'),
|
||||
icon: GoogleCloudIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:azure_event_grid',
|
||||
label: 'Go to Azure Event Grid' + (!$enterpriseLicense ? '' : ' (EE)'),
|
||||
action: (newtab: boolean = false) => gotoPage('/azure_triggers', newtab),
|
||||
...navTo('/azure_triggers'),
|
||||
icon: AzureIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:mqtt_triggers',
|
||||
label: 'Go to MQTT triggers',
|
||||
action: (newtab: boolean = false) => gotoPage('/mqtt_triggers', newtab),
|
||||
...navTo('/mqtt_triggers'),
|
||||
icon: MqttIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:amqp_triggers',
|
||||
label: 'Go to AMQP triggers',
|
||||
action: (newtab: boolean = false) => gotoPage('/amqp_triggers', newtab),
|
||||
...navTo('/amqp_triggers'),
|
||||
icon: AmqpIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
},
|
||||
{
|
||||
search_id: 'nav:email_triggers',
|
||||
label: 'Go to Email triggers',
|
||||
action: (newtab: boolean = false) => gotoPage('/email_triggers', newtab),
|
||||
...navTo('/email_triggers'),
|
||||
icon: MailIcon,
|
||||
disabled: !$roleCapabilities.visibility.triggers
|
||||
}
|
||||
@@ -186,49 +191,49 @@
|
||||
{
|
||||
search_id: 'nav:home',
|
||||
label: 'Go to Home',
|
||||
action: (newtab: boolean = false) => gotoPage('/', newtab),
|
||||
...navTo('/'),
|
||||
icon: HomeIcon,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
search_id: 'nav:runs',
|
||||
label: 'Go to Runs',
|
||||
action: (newtab: boolean = false) => gotoPage('/runs', newtab),
|
||||
...navTo('/runs'),
|
||||
icon: PlayIcon,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
search_id: 'nav:variables',
|
||||
label: 'Go to Variables',
|
||||
action: (newtab: boolean = false) => gotoPage('/variables', newtab),
|
||||
...navTo('/variables'),
|
||||
icon: DollarSignIcon,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
search_id: 'nav:resources',
|
||||
label: 'Go to Resources',
|
||||
action: (newtab: boolean = false) => gotoPage('/resources', newtab),
|
||||
...navTo('/resources'),
|
||||
icon: BoxesIcon,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
search_id: 'nav:schedules_triggers',
|
||||
label: 'Go to Schedules',
|
||||
action: (newtab: boolean = false) => gotoPage('/schedules', newtab),
|
||||
...navTo('/schedules'),
|
||||
icon: CalendarIcon,
|
||||
disabled: false
|
||||
},
|
||||
{
|
||||
search_id: 'nav:folders',
|
||||
label: 'Go to Folders',
|
||||
action: (newtab: boolean = false) => gotoPage('/folders', newtab),
|
||||
...navTo('/folders'),
|
||||
icon: FolderOpenIcon,
|
||||
disabled: !$roleCapabilities.visibility.folders
|
||||
},
|
||||
{
|
||||
search_id: 'nav:groups',
|
||||
label: 'Go to Groups',
|
||||
action: (newtab: boolean = false) => gotoPage('/groups', newtab),
|
||||
...navTo('/groups'),
|
||||
icon: UsersIcon,
|
||||
disabled: !$roleCapabilities.visibility.groups
|
||||
},
|
||||
@@ -236,7 +241,7 @@
|
||||
{
|
||||
search_id: 'nav:service_logs',
|
||||
label: 'Explore windmill service logs',
|
||||
action: (newtab: boolean = false) => gotoPage('/service_logs', newtab),
|
||||
...navTo('/service_logs'),
|
||||
shortcutKey: LOGS_PREFIX,
|
||||
icon: Logs,
|
||||
disabled: !$devopsRole
|
||||
@@ -436,28 +441,21 @@
|
||||
textInput?.focus()
|
||||
}
|
||||
|
||||
function gotoWindmillItemPage(e: TableAny, newtab: boolean = false) {
|
||||
let path: string
|
||||
function windmillItemPagePath(e: TableAny): string {
|
||||
switch (e.type) {
|
||||
case 'flow':
|
||||
path = `/flows/get/${e.path}`
|
||||
break
|
||||
return `/flows/get/${e.path}`
|
||||
case 'script':
|
||||
path = `/scripts/get/${e.path}`
|
||||
break
|
||||
return `/scripts/get/${e.path}`
|
||||
case 'app':
|
||||
path = `/apps/get/${e.path}`
|
||||
break
|
||||
return `/apps/get/${e.path}`
|
||||
case 'raw_app':
|
||||
path = `/apps_raw/get/${e.path}`
|
||||
break
|
||||
return `/apps_raw/get/${e.path}`
|
||||
case 'agent':
|
||||
path = `/agents/get/${e.path}`
|
||||
break
|
||||
return `/agents/get/${e.path}`
|
||||
default:
|
||||
path = '/'
|
||||
return '/'
|
||||
}
|
||||
gotoPage(path, newtab)
|
||||
}
|
||||
|
||||
function gotoPage(path: string, newtab: boolean = false) {
|
||||
@@ -758,6 +756,7 @@
|
||||
>
|
||||
{#each items as el}
|
||||
<QuickMenuItem
|
||||
href={el?.href}
|
||||
onselect={(shift) => el?.action(shift)}
|
||||
onhover={() => (selectedItem = el)}
|
||||
id={el?.search_id}
|
||||
@@ -780,8 +779,9 @@
|
||||
>
|
||||
{#each (itemMap[tab] ?? []).filter((e) => (combinedItems ?? []).includes(e)) as el}
|
||||
<QuickMenuItem
|
||||
href={windmillItemPagePath(el)}
|
||||
onselect={(shift) => {
|
||||
gotoWindmillItemPage(el, shift)
|
||||
gotoPage(windmillItemPagePath(el), shift)
|
||||
}}
|
||||
onhover={() => (selectedItem = el)}
|
||||
id={el?.search_id}
|
||||
@@ -832,11 +832,10 @@
|
||||
Service logs are only available to superadmins
|
||||
</Alert>
|
||||
{:else}
|
||||
{@const serviceLogsHref = `/service_logs?query=${encodeURIComponent(removePrefix(searchTerm, '!'))}`}
|
||||
<QuickMenuItem
|
||||
onselect={() =>
|
||||
gotoPage(
|
||||
`/service_logs?query=${encodeURIComponent(removePrefix(searchTerm, '!'))}`
|
||||
)}
|
||||
href={serviceLogsHref}
|
||||
onselect={(shift) => gotoPage(serviceLogsHref, shift)}
|
||||
id="goto_service_logs_search"
|
||||
hovered={true}
|
||||
label={searchTerm === '!'
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { isMac } from '$lib/utils'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { onDestroy, onMount, untrack } from 'svelte'
|
||||
import { twMerge } from 'tailwind-merge'
|
||||
|
||||
@@ -28,6 +29,8 @@
|
||||
hovered?: boolean
|
||||
id: string
|
||||
label?: string
|
||||
/** Renders the item as a link, so ctrl/cmd-, middle- and right-click open it in a new tab. */
|
||||
href?: string
|
||||
icon?: any
|
||||
shortcutKey?: string | undefined
|
||||
containerClass?: string | undefined
|
||||
@@ -44,6 +47,7 @@
|
||||
hovered = false,
|
||||
id,
|
||||
label = '',
|
||||
href = undefined,
|
||||
icon = undefined,
|
||||
shortcutKey = undefined,
|
||||
containerClass = undefined,
|
||||
@@ -68,12 +72,23 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Enter acts on the hovered item (window keydown), so the link stays out of the tab order:
|
||||
a focused link that isn't the hovered one would show a ring on the wrong item. -->
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<!-- svelte-ignore a11y_click_events_have_key_events -->
|
||||
<div
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'div'}
|
||||
{id}
|
||||
onclick={(e) => {
|
||||
{href}
|
||||
tabindex={href ? -1 : undefined}
|
||||
onclickcapture={(e: MouseEvent) => {
|
||||
e.stopImmediatePropagation()
|
||||
// The link only serves clicks the browser opens elsewhere (modified, middle, right); a
|
||||
// plain click still goes through onselect, which may select rather than navigate.
|
||||
// Capture, not a delegated onclick: the palette is portalled outside the app root, where
|
||||
// a delegated handler runs after SvelteKit's link handler has already followed the href.
|
||||
if (href && isNewTabClick(e)) return
|
||||
if (href) e.preventDefault()
|
||||
onselect(e.shiftKey || e.ctrlKey)
|
||||
}}
|
||||
onmouseenter={() => {
|
||||
@@ -83,7 +98,7 @@
|
||||
mouseMoved = false
|
||||
}}
|
||||
class={twMerge(
|
||||
`rounded-md w-full transition-all cursor-pointer ${hovered ? 'bg-surface-hover' : ''}`,
|
||||
`block rounded-md w-full text-[color:inherit] transition-all cursor-pointer ${hovered ? 'bg-surface-hover' : ''}`,
|
||||
containerClass
|
||||
)}
|
||||
>
|
||||
@@ -123,4 +138,4 @@
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
</svelte:element>
|
||||
|
||||
@@ -154,6 +154,7 @@
|
||||
{/if}
|
||||
{:else}
|
||||
<QuickMenuItem
|
||||
href={`/run/${r?.document.id[0]}`}
|
||||
onselect={(shift) => {
|
||||
selectedItem = r
|
||||
selectedWorkspace = r?.document.workspace_id[0]
|
||||
|
||||
@@ -79,6 +79,9 @@ section or the flat layout.
|
||||
/** The session chat, whose Use mode opens items in their viewer. Read from the
|
||||
* `aiChatManager` context when omitted. */
|
||||
chat?: { readonly workMode: AIWorkMode }
|
||||
/** 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
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -91,7 +94,8 @@ section or the flat layout.
|
||||
flush = false,
|
||||
workspaceId,
|
||||
artifacts,
|
||||
chat
|
||||
chat,
|
||||
targetHref
|
||||
}: Props = $props()
|
||||
|
||||
const kinds: Kind[] = ['flow', 'script', 'app']
|
||||
@@ -423,5 +427,6 @@ section or the flat layout.
|
||||
onFilterChange={loader.onFilterChange}
|
||||
leafAction={editAction}
|
||||
leafBadge={stateBadge}
|
||||
leafHref={targetHref ? (leaf) => targetHref(leaf.data) : undefined}
|
||||
{rootLoading}
|
||||
/>
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
import type { Snippet } from 'svelte'
|
||||
import Popover from '$lib/components/meltComponents/Popover.svelte'
|
||||
import SessionStatusToken, { TOKEN_TRIGGER_CLASS } from './SessionStatusToken.svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
|
||||
// Shared shell for the session status-line popovers (Edits / Artifacts / Jobs):
|
||||
// one trigger token, one header, one keyboard-navigable row list — so styling
|
||||
@@ -13,6 +14,7 @@
|
||||
items,
|
||||
itemKey,
|
||||
onPick,
|
||||
itemHref,
|
||||
rowTitle,
|
||||
row,
|
||||
actions,
|
||||
@@ -35,7 +37,10 @@
|
||||
items: T[]
|
||||
itemKey: (item: T) => string
|
||||
/** Primary row activation; the popover closes itself first. */
|
||||
onPick: (item: T) => void
|
||||
onPick: (item: T, e: MouseEvent) => void
|
||||
/** Makes a row a link opening this URL in a new tab, which middle and ⌘/Ctrl-click keep
|
||||
* doing; on a plain click `onPick` may `preventDefault()` to open it in place instead. */
|
||||
itemHref?: (item: T) => string | undefined
|
||||
rowTitle?: (item: T) => string
|
||||
/** Content of the row's primary button. */
|
||||
row: Snippet<[T]>
|
||||
@@ -59,17 +64,19 @@
|
||||
maxHeightClass?: string
|
||||
} = $props()
|
||||
|
||||
function pick(item: T) {
|
||||
function pick(item: T, e: MouseEvent) {
|
||||
open = false
|
||||
onPick(item)
|
||||
onPick(item, e)
|
||||
}
|
||||
|
||||
// Roving focus over the rows' primary buttons.
|
||||
let listRoot = $state<HTMLDivElement | undefined>(undefined)
|
||||
|
||||
function rowButtons(): HTMLButtonElement[] {
|
||||
function rowButtons(): HTMLElement[] {
|
||||
return listRoot
|
||||
? Array.from(listRoot.querySelectorAll<HTMLButtonElement>('button[data-status-row]'))
|
||||
? Array.from(
|
||||
listRoot.querySelectorAll<HTMLElement>('button[data-status-row], a[data-status-row]')
|
||||
)
|
||||
: []
|
||||
}
|
||||
|
||||
@@ -123,19 +130,28 @@
|
||||
<div class="flex min-h-0 flex-col" bind:this={listRoot} onkeydown={handleListKeydown}>
|
||||
<div role="list" class="{maxHeightClass} overflow-y-auto py-1">
|
||||
{#each items as item, index (itemKey(item))}
|
||||
{@const href = itemHref?.(item)}
|
||||
<div
|
||||
class="flex items-center gap-2 py-1 pl-3 pr-2 hover:bg-surface-hover focus-within:bg-surface-hover"
|
||||
role="listitem"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
<svelte:element
|
||||
this={href ? 'a' : 'button'}
|
||||
type={href ? undefined : 'button'}
|
||||
role={href ? 'link' : 'button'}
|
||||
{href}
|
||||
target={href ? '_blank' : undefined}
|
||||
rel={href ? 'noopener' : undefined}
|
||||
data-status-row
|
||||
class="flex min-w-0 flex-1 items-center gap-2 text-left font-normal focus:outline-none"
|
||||
class="flex min-w-0 flex-1 items-center gap-2 text-left font-normal focus:outline-none text-[color:inherit]"
|
||||
title={rowTitle?.(item)}
|
||||
onclick={() => pick(item)}
|
||||
onclick={(e: MouseEvent) => {
|
||||
if (href && isNewTabClick(e)) return
|
||||
pick(item, e)
|
||||
}}
|
||||
>
|
||||
{@render row(item)}
|
||||
</button>
|
||||
</svelte:element>
|
||||
{#if actions}
|
||||
<div class="flex shrink-0 items-center gap-1.5">
|
||||
{@render actions(item)}
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
workspaceSubtreeRows
|
||||
} from '$lib/utils/workspaceHierarchy'
|
||||
import { useForkableWorkspaces } from '$lib/utils/useForkableWorkspaces.svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { canCreateFork } from '$lib/utils/editInFork'
|
||||
import { forkAccentStyle } from '$lib/utils/forkColor'
|
||||
import { WorkspaceService } from '$lib/gen'
|
||||
@@ -553,7 +554,9 @@
|
||||
<div class="my-1 border-t border-border-light shrink-0"></div>
|
||||
<a
|
||||
href={settingsHref}
|
||||
onclick={() => (dropdownOpen = false)}
|
||||
onclick={(e) => {
|
||||
if (!isNewTabClick(e)) dropdownOpen = false
|
||||
}}
|
||||
class={`${rowBase} shrink-0 hover:bg-surface-hover`}
|
||||
>
|
||||
<Settings size={14} class="shrink-0 text-tertiary" />
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { preventDefault } from 'svelte/legacy'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { superadminSettingsHref } from './settings'
|
||||
|
||||
import Toggle from '$lib/components/Toggle.svelte'
|
||||
import { SettingService } from '$lib/gen'
|
||||
@@ -147,7 +148,14 @@
|
||||
<div class="w-full">
|
||||
<Alert title="No critical alert channels are set up" type="warning" size="xs">
|
||||
Go to the
|
||||
<a href="/#superadmin-settings" onclick={preventDefault(goToCoreTab)}>Instance settings</a>
|
||||
<a
|
||||
href="/{superadminSettingsHref('general')}"
|
||||
onclick={(e) => {
|
||||
if (isNewTabClick(e)) return
|
||||
e.preventDefault()
|
||||
goToCoreTab()
|
||||
}}>Instance settings</a
|
||||
>
|
||||
page to configure critical alert channels.
|
||||
</Alert>
|
||||
</div>
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
ShieldCheck
|
||||
} from 'lucide-svelte'
|
||||
import AccessDrawer from '../AccessDrawer.svelte'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { type Item } from '$lib/utils'
|
||||
import { logout } from '$lib/logoutKit'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
@@ -190,7 +189,7 @@
|
||||
{
|
||||
displayName: 'Instance settings',
|
||||
icon: Settings,
|
||||
action: () => goto(SUPERADMIN_SETTINGS_HASH)
|
||||
href: SUPERADMIN_SETTINGS_HASH
|
||||
}
|
||||
]
|
||||
: [])
|
||||
@@ -233,7 +232,7 @@
|
||||
{
|
||||
displayName: 'Account settings',
|
||||
icon: Settings,
|
||||
action: () => goto(USER_SETTINGS_HASH)
|
||||
href: USER_SETTINGS_HASH
|
||||
},
|
||||
// A superadmin who is not a member has no `usr` row, so there is no access to list.
|
||||
...($userStore && !$userStore.non_member
|
||||
@@ -251,7 +250,7 @@
|
||||
{
|
||||
displayName: 'Take the tour',
|
||||
icon: GraduationCap,
|
||||
action: () => goto(`/?${TOUR_PARAM}=${TOUR_PARAM_VALUE}`)
|
||||
href: `/?${TOUR_PARAM}=${TOUR_PARAM_VALUE}`
|
||||
}
|
||||
]
|
||||
: []),
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
<script lang="ts">
|
||||
import { resource } from 'runed'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
import { AlertTriangle, Sparkles } from 'lucide-svelte'
|
||||
import { UserService, WorkspaceService } from '$lib/gen'
|
||||
@@ -372,9 +372,10 @@
|
||||
{#if $userStore?.is_admin}
|
||||
<Button
|
||||
unifiedSize="md"
|
||||
onclick={() => {
|
||||
href="/workspace_settings?tab=premium"
|
||||
onClick={(e) => {
|
||||
if (e instanceof MouseEvent && isNewTabClick(e)) return
|
||||
open = false
|
||||
goto('/workspace_settings?tab=premium')
|
||||
}}
|
||||
>
|
||||
{$isPremiumStore ? 'See billing' : 'See plans'}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { logout } from '$lib/logoutKit'
|
||||
import {
|
||||
userStore,
|
||||
@@ -169,9 +168,7 @@
|
||||
{#if $userStore?.is_admin}
|
||||
<MenuItem
|
||||
class={twMerge(itemClass, 'py-2')}
|
||||
onClick={() => {
|
||||
goto('/workspace_settings?tab=premium')
|
||||
}}
|
||||
href="/workspace_settings?tab=premium"
|
||||
{item}
|
||||
>
|
||||
Upgrade
|
||||
@@ -180,9 +177,7 @@
|
||||
{:else}
|
||||
<MenuItem
|
||||
class={twMerge(itemClass, 'py-2')}
|
||||
onClick={() => {
|
||||
goto('/workspace_settings?tab=premium')
|
||||
}}
|
||||
href="/workspace_settings?tab=premium"
|
||||
{item}
|
||||
>
|
||||
Premium plan
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
import { EXECUTIONS_HINT } from './executionsHint'
|
||||
import WorkspaceIcon from '$lib/components/workspace/WorkspaceIcon.svelte'
|
||||
import { fixupUrlAfterWorkspaceSwitch } from './workspaceSwitchUrl'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { switchWorkspace } from '$lib/storeUtils'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
@@ -680,9 +679,7 @@
|
||||
'data-[highlighted]:bg-gray-100 data-[highlighted]:text-gray-900',
|
||||
highlightedId === ACTION_PREFIX + 'upgrade' && 'bg-gray-100 text-gray-900'
|
||||
)}
|
||||
onClick={() => {
|
||||
goto('/workspace_settings?tab=premium')
|
||||
}}
|
||||
href="/workspace_settings?tab=premium"
|
||||
{item}
|
||||
>
|
||||
Upgrade
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
import { latestRequest } from '$lib/utils/latestRequest'
|
||||
import { getLocalDraftHint } from '$lib/localDraftHints.svelte'
|
||||
import { enterpriseLicense, usedTriggerKinds, workspaceStore } from '$lib/stores'
|
||||
import { goto, setQuery } from '$lib/navigation'
|
||||
import { isNewTabClick, setQuery } from '$lib/navigation'
|
||||
import { isCloudHosted } from '$lib/cloud'
|
||||
import { ALL_DEPLOYABLE, isDeployable } from '$lib/utils_deployable'
|
||||
import {
|
||||
@@ -146,11 +146,6 @@
|
||||
else editor?.openEdit(path, isFlow)
|
||||
}
|
||||
|
||||
function openLink(href: string) {
|
||||
if (hosted) hosted.openLink(href)
|
||||
else goto(href)
|
||||
}
|
||||
|
||||
async function getDeployUiSettings() {
|
||||
if (!$enterpriseLicense) {
|
||||
deployUiSettings = ALL_DEPLOYABLE
|
||||
@@ -714,6 +709,7 @@
|
||||
<a
|
||||
href="#{path}"
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
if (hosted) e.preventDefault()
|
||||
openEdit(path, is_flow)
|
||||
}}
|
||||
@@ -793,7 +789,7 @@
|
||||
{
|
||||
displayName: `View ${is_flow ? 'Flow' : 'Script'}`,
|
||||
icon: Eye,
|
||||
action: () => openLink(href)
|
||||
...(hosted ? { action: () => hosted.openLink(href) } : { href })
|
||||
},
|
||||
...(canEdit && !draft_only && mode !== 'suspended'
|
||||
? [
|
||||
|
||||
@@ -432,11 +432,8 @@
|
||||
runnableConfig.kind !== mapJobKindToRunnableKind(job.job_kind) ||
|
||||
runnableConfig.path !== job.script_path}
|
||||
|
||||
<Row
|
||||
hoverable
|
||||
on:click={() => window.open(`/run/${job.id}?workspace=${workspace}`, '_blank')}
|
||||
>
|
||||
<Cell class="w-12 sm:pl-3" shouldStopPropagation>
|
||||
<Row>
|
||||
<Cell class="w-12 sm:pl-3">
|
||||
<div class="h-4 w-4">
|
||||
<input
|
||||
type="checkbox"
|
||||
@@ -448,7 +445,15 @@
|
||||
</div>
|
||||
</Cell>
|
||||
|
||||
<Cell wrap>{displayDate(job.created_at)}</Cell>
|
||||
<Cell wrap>
|
||||
<a
|
||||
href={`/run/${job.id}?workspace=${workspace}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
title="Open run in a new tab"
|
||||
class="text-accent hover:underline">{displayDate(job.created_at)}</a
|
||||
>
|
||||
</Cell>
|
||||
|
||||
<Cell wrap class="flex flex-row gap-2 items-center">
|
||||
{@render runnable({
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
import Dropdown from '$lib/components/DropdownV2.svelte'
|
||||
import { Eye, Pen, RefreshCw, Trash } from 'lucide-svelte'
|
||||
import ConfirmationModal from '$lib/components/common/confirmationModal/ConfirmationModal.svelte'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import Alert from '$lib/components/common/alert/Alert.svelte'
|
||||
import GoogleDriveIcon from '$lib/components/icons/GoogleDriveIcon.svelte'
|
||||
import GoogleCalendarIcon from '$lib/components/icons/GoogleCalendarIcon.svelte'
|
||||
@@ -119,8 +119,11 @@
|
||||
<RowIcon kind={isFlow ? 'flow' : 'script'} />
|
||||
|
||||
<a
|
||||
href="#{trigger.external_id}"
|
||||
onclick={() => onEdit?.(trigger)}
|
||||
href="#{encodeURIComponent(trigger.external_id)}"
|
||||
onclick={(e) => {
|
||||
if (isNewTabClick(e)) return
|
||||
onEdit?.(trigger)
|
||||
}}
|
||||
class="min-w-0 grow hover:underline decoration-gray-400"
|
||||
>
|
||||
<div class="text-emphasis flex-wrap text-left text-xs font-semibold mb-1 truncate">
|
||||
@@ -185,9 +188,7 @@
|
||||
{
|
||||
displayName: `View ${isFlow ? 'Flow' : 'Script'}`,
|
||||
icon: Eye,
|
||||
action: () => {
|
||||
goto(href)
|
||||
}
|
||||
href
|
||||
},
|
||||
{
|
||||
displayName: 'Delete',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { getLocalDraftHint } from '$lib/localDraftHints.svelte'
|
||||
import { isNewTabClick } from '$lib/navigation'
|
||||
import CenteredPage from '$lib/components/CenteredPage.svelte'
|
||||
import {
|
||||
Alert,
|
||||
@@ -455,7 +456,8 @@
|
||||
<a
|
||||
class="break-all"
|
||||
id="edit-{path}"
|
||||
onclick={() => {
|
||||
onclick={(e) => {
|
||||
if (!hosted && isNewTabClick(e)) return
|
||||
handledHash = `#${path}`
|
||||
editVariable(path)
|
||||
}}
|
||||
|
||||
@@ -3,7 +3,7 @@ import { describe, it, expect, vi } from 'vitest'
|
||||
const goto = vi.hoisted(() => vi.fn(async (_path: string) => {}))
|
||||
vi.mock('$app/navigation', () => ({ goto: (path: string) => goto(path) }))
|
||||
|
||||
import { buildFilterUrl, setQuery } from './navigation'
|
||||
import { buildFilterUrl, isNewTabClick, setQuery } from './navigation'
|
||||
|
||||
// Parse the app path the builder returns against a dummy origin so we can
|
||||
// assert on pathname / searchParams / hash without caring about ordering.
|
||||
@@ -78,3 +78,32 @@ describe('setQuery', () => {
|
||||
expect(u.searchParams.get('kind')).toBe('script')
|
||||
})
|
||||
})
|
||||
|
||||
describe('isNewTabClick', () => {
|
||||
// MouseEvent is not in vitest's node environment; the predicate only reads these fields.
|
||||
const click = (init: Partial<MouseEvent>) =>
|
||||
({
|
||||
ctrlKey: false,
|
||||
metaKey: false,
|
||||
shiftKey: false,
|
||||
altKey: false,
|
||||
button: 0,
|
||||
...init
|
||||
}) as MouseEvent
|
||||
|
||||
it('leaves a plain primary click to the in-page handler', () => {
|
||||
expect(isNewTabClick(click({}))).toBe(false)
|
||||
})
|
||||
|
||||
it('hands modified and non-primary clicks to the browser', () => {
|
||||
for (const init of [
|
||||
{ ctrlKey: true },
|
||||
{ metaKey: true },
|
||||
{ shiftKey: true },
|
||||
{ altKey: true },
|
||||
{ button: 1 }
|
||||
]) {
|
||||
expect(isNewTabClick(click(init))).toBe(true)
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
@@ -3,6 +3,15 @@ import { serializeParam } from '$lib/utils/serializeParam'
|
||||
|
||||
export { goto }
|
||||
|
||||
/**
|
||||
* Whether the browser handles a click on an `<a href>` itself, opening it elsewhere (new tab,
|
||||
* new window, download): a modified or non-primary click. A link whose `onclick` also opens
|
||||
* something in place (a drawer) must skip that work then.
|
||||
*/
|
||||
export function isNewTabClick(e: MouseEvent): boolean {
|
||||
return e.ctrlKey || e.metaKey || e.shiftKey || e.altKey || e.button !== 0
|
||||
}
|
||||
|
||||
/**
|
||||
* Build an in-app deep-link to `pathname` with query-param filters, encoded exactly
|
||||
* as the pages write them (via `serializeParam`) so `useUrlSyncedFilterInstance`
|
||||
|
||||
@@ -70,7 +70,7 @@
|
||||
} from '$lib/stores'
|
||||
import CenteredModal from '$lib/components/CenteredModal.svelte'
|
||||
import { afterNavigate, beforeNavigate } from '$app/navigation'
|
||||
import { goto } from '$lib/navigation'
|
||||
import { goto, isNewTabClick } from '$lib/navigation'
|
||||
import { registerToolDisplayActionHandler } from '$lib/components/copilot/chat/createdResourceActions.svelte'
|
||||
import type UserSettings from '$lib/components/UserSettings.svelte'
|
||||
import type SuperadminSettings from '$lib/components/SuperadminSettings.svelte'
|
||||
@@ -1323,7 +1323,8 @@ outside this layout, and their shortcut must reopen the URL that is their creden
|
||||
isCollapsed={collapsed}
|
||||
aiId="sidebar-menu-link-runs"
|
||||
aiDescription="Button to navigate to runs"
|
||||
onclick={() => {
|
||||
onclick={(e) => {
|
||||
if (isNewTabClick(e)) return
|
||||
setTimeout(() => {
|
||||
window.dispatchEvent(new Event('popstate'))
|
||||
}, 100)
|
||||
|
||||
@@ -688,7 +688,7 @@
|
||||
bind:this={rawAppEditor}
|
||||
ownsPageHeader
|
||||
compact={page.url.searchParams.get('view') === 'preview'}
|
||||
onDetails={(e) => goto(`/apps_raw/get/${e.path}?workspace=${$workspaceStore}`)}
|
||||
detailsHref={(path) => `/apps_raw/get/${path}?workspace=${$workspaceStore}`}
|
||||
onSavedNewAppPath={(savedPath) => {
|
||||
draftSync.remove()
|
||||
goto(`/apps_raw/edit/${savedPath}`)
|
||||
|
||||
@@ -598,9 +598,7 @@
|
||||
if ($workspaceStore) invalidate($workspaceStore, 'flow')
|
||||
goto(`/flows/get/${e.path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
onDetails={(e) => {
|
||||
goto(`/flows/get/${e.path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
detailsHref={(path) => `/flows/get/${path}?workspace=${$workspaceStore}`}
|
||||
onHistoryRestore={() => {
|
||||
loadFlow()
|
||||
}}
|
||||
|
||||
@@ -45,7 +45,36 @@
|
||||
let loading = $state(true)
|
||||
let serviceAvailable: boolean | undefined = $state(undefined)
|
||||
let serviceSupported = $state(true)
|
||||
let editor: NativeTriggerEditor
|
||||
let editor: NativeTriggerEditor | undefined = $state()
|
||||
|
||||
// Deep link: #<external_id> opens that trigger's editor. Opening a trigger pre-sets
|
||||
// handledId: a row link opens the editor itself, before the hash moves. Ids are compared
|
||||
// decoded since the browser percent-encodes the hash.
|
||||
let handledId = ''
|
||||
$effect(() => {
|
||||
const hash = page.url.hash
|
||||
if (hash.length <= 1) {
|
||||
handledId = ''
|
||||
return
|
||||
}
|
||||
let externalId: string
|
||||
try {
|
||||
externalId = decodeURIComponent(hash.slice(1))
|
||||
} catch {
|
||||
return
|
||||
}
|
||||
if (externalId === handledId || !editor) return
|
||||
const trigger = triggers.find((t) => t.external_id === externalId)
|
||||
if (trigger) {
|
||||
handledId = externalId
|
||||
editor.openEdit(trigger.external_id, trigger.is_flow)
|
||||
}
|
||||
})
|
||||
|
||||
function openEditor(trigger: TriggerW) {
|
||||
handledId = trigger.external_id
|
||||
editor?.openEdit(trigger.external_id, trigger.is_flow)
|
||||
}
|
||||
|
||||
let filteredItems: TriggerW[] = $state([])
|
||||
let items: TriggerW[] = $state([])
|
||||
@@ -287,7 +316,7 @@
|
||||
service={serviceName}
|
||||
triggers={items.slice(0, nbDisplayed)}
|
||||
{loading}
|
||||
onEdit={(trigger) => editor?.openEdit(trigger.external_id, trigger.is_flow)}
|
||||
onEdit={openEditor}
|
||||
onRecreate={(trigger) => editor?.openRecreate(trigger)}
|
||||
onSync={syncTriggers}
|
||||
onUpdate={loadTriggers}
|
||||
|
||||
@@ -2623,11 +2623,11 @@
|
||||
// Keep the current mode across folder switches (view is the
|
||||
// param-less default).
|
||||
const modeQuery = mode !== 'view' ? `?mode=${mode}` : ''
|
||||
const items = otherPipelineFolders.map((p) => ({
|
||||
const items: Item[] = otherPipelineFolders.map((p) => ({
|
||||
displayName: `f/${p.folder}`,
|
||||
icon: Folder,
|
||||
disabled: false,
|
||||
action: () => goto(`/pipeline/${encodeURIComponent(p.folder)}${modeQuery}`)
|
||||
href: `/pipeline/${encodeURIComponent(p.folder)}${modeQuery}`
|
||||
}))
|
||||
items.push({
|
||||
displayName: 'Choose another folder…',
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
<Alert type="error" title="Could not connect">{error}</Alert>
|
||||
{#if returnTo}
|
||||
<div class="flex justify-center pt-4">
|
||||
<Button variant="default" unifiedSize="md" onclick={() => goto(returnTo!)}>Go back</Button>
|
||||
<Button variant="default" unifiedSize="md" href={returnTo}>Go back</Button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
@@ -614,9 +614,7 @@
|
||||
if ($workspaceStore) invalidate($workspaceStore, 'script')
|
||||
goto(`/scripts/get/${e.hash}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
onSeeDetails={(e) => {
|
||||
goto(`/scripts/get/${e.path}?workspace=${$workspaceStore}`)
|
||||
}}
|
||||
seeDetailsHref={(path) => `/scripts/get/${path}?workspace=${$workspaceStore}`}
|
||||
onNavigate={(item) => goto(editPathFor(item))}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -1298,7 +1298,7 @@
|
||||
>
|
||||
<p class="text-primary font-medium">AI Sessions are hidden in this workspace</p>
|
||||
<p>A workspace admin hid AI sessions in the workspace settings.</p>
|
||||
<Button unifiedSize="sm" onclick={() => goto('/')}>Back to workspace</Button>
|
||||
<Button unifiedSize="sm" href="/">Back to workspace</Button>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
|
||||
import CenteredModal from '$lib/components/CenteredModal.svelte'
|
||||
import { Button } from '$lib/components/common'
|
||||
import { workspaceStore } from '$lib/stores'
|
||||
|
||||
async function startSetup(advanced = false): Promise<void> {
|
||||
// /user/* pages sit outside the (logged) layout, so a `?workspace=` param is not read there.
|
||||
function selectAdminsWorkspace(): void {
|
||||
$workspaceStore = 'admins'
|
||||
goto(advanced ? '/user/instance_settings?mode=full' : '/user/instance_settings')
|
||||
}
|
||||
|
||||
async function decline(): Promise<void> {
|
||||
goto('/user/workspaces')
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -21,10 +15,20 @@
|
||||
settings or the advanced setup for full control.
|
||||
</p>
|
||||
<div class="flex flex-row justify-between pt-4 gap-x-1">
|
||||
<Button color="light" variant="contained" unifiedSize="md" on:click={decline}>Skip</Button>
|
||||
<Button color="light" variant="contained" unifiedSize="md" href="/user/workspaces">Skip</Button>
|
||||
<div class="flex items-center gap-2">
|
||||
<Button variant="default" unifiedSize="md" on:click={() => startSetup(true)}>Advanced setup</Button>
|
||||
<Button variant="accent" unifiedSize="md" on:click={() => startSetup()}>Quick setup</Button>
|
||||
<Button
|
||||
variant="default"
|
||||
unifiedSize="md"
|
||||
href="/user/instance_settings?mode=full"
|
||||
onClick={selectAdminsWorkspace}>Advanced setup</Button
|
||||
>
|
||||
<Button
|
||||
variant="accent"
|
||||
unifiedSize="md"
|
||||
href="/user/instance_settings"
|
||||
onClick={selectAdminsWorkspace}>Quick setup</Button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</CenteredModal>
|
||||
|
||||
@@ -1719,6 +1719,11 @@
|
||||
page: () => WORKSPACE_SETTINGS_PATH + window.location.search,
|
||||
workspaceId: $workspaceStore ?? undefined
|
||||
})
|
||||
function tabHref(id: string): string {
|
||||
const params = new URLSearchParams($page.url.searchParams)
|
||||
params.set('tab', id)
|
||||
return `?${params.toString()}`
|
||||
}
|
||||
</script>
|
||||
|
||||
<CenteredPage wrapperClasses="pb-0 h-full" handleOverflow={false} class="flex flex-col h-full">
|
||||
@@ -1750,11 +1755,8 @@
|
||||
<SidebarNavigation
|
||||
groups={navigationGroups}
|
||||
selectedId={tab}
|
||||
onNavigate={(id) => {
|
||||
const params = new URLSearchParams($page.url.searchParams)
|
||||
params.set('tab', id)
|
||||
goto(`?${params.toString()}`)
|
||||
}}
|
||||
onNavigate={(id) => goto(tabHref(id))}
|
||||
itemHref={tabHref}
|
||||
/>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -1822,7 +1824,7 @@
|
||||
<Button
|
||||
variant="default"
|
||||
startIcon={{ icon: Target }}
|
||||
onclick={() => goto('/forks/compare?mode=fork')}
|
||||
href="/forks/compare?mode=fork"
|
||||
>
|
||||
Merge into another workspace
|
||||
</Button>
|
||||
@@ -2881,10 +2883,10 @@ export async function main(
|
||||
{#if pageHeader.actionFold >= 1}
|
||||
<DropdownV2
|
||||
size="sm"
|
||||
items={[{ displayName: 'Instance settings', action: () => goto('#superadmin-settings') }]}
|
||||
items={[{ displayName: 'Instance settings', href: '#superadmin-settings' }]}
|
||||
/>
|
||||
{:else}
|
||||
<Button variant="default" unifiedSize="sm" on:click={() => goto('#superadmin-settings')}>
|
||||
<Button variant="default" unifiedSize="sm" href="#superadmin-settings">
|
||||
Instance settings
|
||||
</Button>
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import Button from '$lib/components/common/button/Button.svelte'
|
||||
import { sendUserToast } from '$lib/toast'
|
||||
import { UserService } from '$lib/gen'
|
||||
@@ -63,7 +62,7 @@
|
||||
Please check your email and follow the instructions to reset your password.
|
||||
</p>
|
||||
<div class="pt-4">
|
||||
<Button variant="accent" on:click={() => goto('/user/login')}>Back to login</Button>
|
||||
<Button variant="accent" href="/user/login">Back to login</Button>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
@@ -85,7 +84,7 @@
|
||||
<Button on:click={requestPasswordReset} variant="accent" disabled={!email || loading}>
|
||||
{loading ? 'Sending...' : 'Send reset link'}
|
||||
</Button>
|
||||
<Button variant="subtle" on:click={() => goto('/user/login')}>Back to login</Button>
|
||||
<Button variant="subtle" href="/user/login">Back to login</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { Button } from '$lib/components/common'
|
||||
import CenteredModal from '$lib/components/CenteredModal.svelte'
|
||||
@@ -19,5 +18,5 @@
|
||||
title="Sign-in link unavailable"
|
||||
subtitle="{message} Sign-in links work once and for a few minutes: ask for a new one from where you got this link, or sign in another way."
|
||||
>
|
||||
<Button variant="accent" unifiedSize="lg" onClick={() => goto('/user/login')}>Go to login</Button>
|
||||
<Button variant="accent" unifiedSize="lg" href="/user/login">Go to login</Button>
|
||||
</CenteredModal>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$lib/navigation'
|
||||
import { tick } from 'svelte'
|
||||
import { page } from '$app/state'
|
||||
import Button from '$lib/components/common/button/Button.svelte'
|
||||
@@ -86,9 +85,7 @@
|
||||
<div class="text-center space-y-4">
|
||||
<p class="text-red-500">Invalid or missing reset token.</p>
|
||||
<div class="pt-4">
|
||||
<Button variant="accent" on:click={() => goto('/user/forgot-password')}>
|
||||
Request New Reset Link
|
||||
</Button>
|
||||
<Button variant="accent" href="/user/forgot-password">Request New Reset Link</Button>
|
||||
</div>
|
||||
</div>
|
||||
{:else if success}
|
||||
@@ -96,7 +93,7 @@
|
||||
<p class="text-secondary"> Your password has been reset successfully. </p>
|
||||
<p class="text-secondary text-sm"> You can now log in with your new password. </p>
|
||||
<div class="pt-4">
|
||||
<Button variant="accent" on:click={() => goto('/user/login')}>Go to login</Button>
|
||||
<Button variant="accent" href="/user/login">Go to login</Button>
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
@@ -146,7 +143,7 @@
|
||||
>
|
||||
{loading ? 'Resetting...' : 'Reset password'}
|
||||
</Button>
|
||||
<Button variant="subtle" on:click={() => goto('/user/login')}>Back to login</Button>
|
||||
<Button variant="subtle" href="/user/login">Back to login</Button>
|
||||
</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user