mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-11-29 00:07:30 +00:00
fix: name only draft-only items by their draft path in composer pickers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9e2c8772f0
commit
62c72946d6
@@ -28,6 +28,7 @@ Content is materialized at message-prep time by `AIChatManager` — see PR #9216
|
||||
import type { DrillBranch, DrillIcon, DrillLeaf, DrillNode } from '$lib/components/drillPicker'
|
||||
import {
|
||||
workspaceItemDisplayPath,
|
||||
workspaceItemMentionPath,
|
||||
type WorkspaceItem,
|
||||
type WorkspaceItemKind
|
||||
} from '$lib/components/workspacePicker'
|
||||
@@ -301,7 +302,7 @@ Content is materialized at message-prep time by `AIChatManager` — see PR #9216
|
||||
const element: WorkspaceScriptElement & { deletable: boolean } = {
|
||||
type: 'workspace_script',
|
||||
path: d.path,
|
||||
title: workspaceItemDisplayPath(d),
|
||||
title: workspaceItemMentionPath(d),
|
||||
summary: d.summary,
|
||||
deletable: true
|
||||
}
|
||||
@@ -310,7 +311,7 @@ Content is materialized at message-prep time by `AIChatManager` — see PR #9216
|
||||
const element: WorkspaceFlowElement & { deletable: boolean } = {
|
||||
type: 'workspace_flow',
|
||||
path: d.path,
|
||||
title: workspaceItemDisplayPath(d),
|
||||
title: workspaceItemMentionPath(d),
|
||||
summary: d.summary,
|
||||
deletable: true
|
||||
}
|
||||
@@ -320,7 +321,7 @@ Content is materialized at message-prep time by `AIChatManager` — see PR #9216
|
||||
const element: WorkspaceAppElement & { deletable: boolean } = {
|
||||
type: 'workspace_app',
|
||||
path: d.path,
|
||||
title: workspaceItemDisplayPath(d),
|
||||
title: workspaceItemMentionPath(d),
|
||||
summary: d.summary,
|
||||
deletable: true
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ at the workspace root because the parent menu item already names the scope.
|
||||
import type { DrillBranch, DrillLeaf, DrillNode } from '$lib/components/drillPicker'
|
||||
import {
|
||||
workspaceItemDisplayPath,
|
||||
workspaceItemMentionPath,
|
||||
type WorkspaceItem,
|
||||
type WorkspaceItemKind
|
||||
} from '$lib/components/workspacePicker'
|
||||
@@ -64,7 +65,7 @@ at the workspace root because the parent menu item already names the scope.
|
||||
return {
|
||||
type: 'workspace_script',
|
||||
path: item.path,
|
||||
title: workspaceItemDisplayPath(item),
|
||||
title: workspaceItemMentionPath(item),
|
||||
summary: item.summary,
|
||||
deletable: true
|
||||
} satisfies WorkspaceScriptElement & { deletable: boolean }
|
||||
@@ -73,7 +74,7 @@ at the workspace root because the parent menu item already names the scope.
|
||||
return {
|
||||
type: 'workspace_flow',
|
||||
path: item.path,
|
||||
title: workspaceItemDisplayPath(item),
|
||||
title: workspaceItemMentionPath(item),
|
||||
summary: item.summary,
|
||||
deletable: true
|
||||
} satisfies WorkspaceFlowElement & { deletable: boolean }
|
||||
@@ -82,7 +83,7 @@ at the workspace root because the parent menu item already names the scope.
|
||||
return {
|
||||
type: 'workspace_app',
|
||||
path: item.path,
|
||||
title: workspaceItemDisplayPath(item),
|
||||
title: workspaceItemMentionPath(item),
|
||||
summary: item.summary,
|
||||
deletable: true
|
||||
} satisfies WorkspaceAppElement & { deletable: boolean }
|
||||
@@ -140,7 +141,8 @@ at the workspace root because the parent menu item already names the scope.
|
||||
onPick={handlePick}
|
||||
{leafIcon}
|
||||
{branchIcon}
|
||||
leafSecondary={(leaf, scope) => relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data), scope)}
|
||||
leafSecondary={(leaf, scope) =>
|
||||
relativizeWorkspacePath(workspaceItemDisplayPath(leaf.data), scope)}
|
||||
onScopeChange={handleScopeChange}
|
||||
onFilterChange={loader.onFilterChange}
|
||||
rootLoading={WORKSPACE_KINDS.some((k) => !loader.loaded[k] && loader.loadingKind[k])}
|
||||
|
||||
@@ -29,6 +29,15 @@ export function workspaceItemDisplayPath(item: Pick<WorkspaceItem, 'path' | 'dra
|
||||
return item.draftPath ?? item.path
|
||||
}
|
||||
|
||||
/** The name an `@` mention gives the item. Only a draft-only item is named by its draft
|
||||
* path: a deployed item keeps its path while its draft renames it, the way the chat's
|
||||
* answer links name it. */
|
||||
export function workspaceItemMentionPath(
|
||||
item: Pick<WorkspaceItem, 'path' | 'draftPath' | 'draftOnly'>
|
||||
): string {
|
||||
return item.draftOnly ? workspaceItemDisplayPath(item) : item.path
|
||||
}
|
||||
|
||||
/** Display label for kinds — used in the picker rows and search section headers. */
|
||||
export const KIND_LABEL: Record<WorkspaceItemKind, string> = {
|
||||
flow: 'Flows',
|
||||
|
||||
Reference in New Issue
Block a user