diff --git a/frontend/src/lib/components/runs/JobDetailFieldConfig.ts b/frontend/src/lib/components/runs/JobDetailFieldConfig.ts index b324fe335e..dd80f94832 100644 --- a/frontend/src/lib/components/runs/JobDetailFieldConfig.ts +++ b/frontend/src/lib/components/runs/JobDetailFieldConfig.ts @@ -287,10 +287,17 @@ export const fieldConfigs: Record = { field: 'script_path', label: 'Path', getValue: (job) => job.script_path || null, - getHref: (job, _workspaceId) => { + getHref: (job, workspaceId) => { if (!job.script_path) return null const isScript = job.job_kind === 'script' - return isScript ? `/scripts/get/${job.script_hash}` : flowPathToHref(job.script_path) + // Hub scripts/flows live outside any workspace; everything else must + // target the job's workspace (passed in as workspaceId), not the active. + if (job.script_path.startsWith('hub/')) { + return isScript ? `/scripts/get/${job.script_hash}` : flowPathToHref(job.script_path) + } + return isScript + ? `/scripts/get/${job.script_hash}?workspace=${workspaceId}` + : `/flows/get/${job.script_path}?workspace=${workspaceId}` } }, diff --git a/frontend/src/lib/components/runs/RunsTable.svelte b/frontend/src/lib/components/runs/RunsTable.svelte index b6c38bd380..891f2732b3 100644 --- a/frontend/src/lib/components/runs/RunsTable.svelte +++ b/frontend/src/lib/components/runs/RunsTable.svelte @@ -259,27 +259,31 @@ let cancellable = selectedIdsPossibleActions.cancellableJobIds.length const actions: DropdownMenuProps['items'] = [] if (selectedIds.length === 1) { - actions.push({ - label: 'Show run details', - icon: ExternalLinkIcon, - onClick: () => goto(`/run/${selectedIds[0]}`) - }) const job = flatJobs?.find( (jobOrDate) => jobOrDate.type === 'job' && jobOrDate.job.id === selectedIds[0] ) + // Jobs in the runs table can belong to a workspace other than the active + // one, so target the job's own workspace (not the active one). + const jobWorkspace = + (job?.type === 'job' ? job.job.workspace_id : undefined) ?? $workspaceStore + actions.push({ + label: 'Show run details', + icon: ExternalLinkIcon, + onClick: () => goto(`/run/${selectedIds[0]}?workspace=${jobWorkspace}`) + }) if (job?.type === 'job') { if (job.job.job_kind === 'script') { actions.push({ label: 'Go to script page', icon: Code2Icon, - onClick: () => goto(`/scripts/get/${job.job.script_hash}`) + onClick: () => goto(`/scripts/get/${job.job.script_hash}?workspace=${jobWorkspace}`) }) } if (job.job.job_kind === 'flow') { actions.push({ label: 'Go to flow page', icon: BarsStaggered, - onClick: () => goto(`/flows/get/${job.job.script_path}`) + onClick: () => goto(`/flows/get/${job.job.script_path}?workspace=${jobWorkspace}`) }) } }