fix(frontend): FlowMetadata view link targets the job's workspace

The "view script/flow" link in FlowMetadata still used flowPathToHref (which
resolves the active workspace) for flows and a bare /scripts/get for scripts,
so for a foreign-workspace job it pointed at the active workspace. Make it
hub-aware and use the job's workspace (job.workspace_id ?? $workspaceStore),
matching JobDetailHeader. Hub paths stay workspace-free.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Diego Imbert
2026-06-02 14:01:30 +02:00
co-authored by Claude Opus 4.8
parent a4634f3e70
commit 0664c52936
@@ -97,11 +97,15 @@
{/if}
{#if (job && job.job_kind == 'flow') || job?.job_kind == 'script'}
{@const stem = `${job?.job_kind}s`}
{@const isScript = job?.job_kind === 'script'}
{@const viewHref = isScript
? `${base}/${stem}/get/${job?.script_hash}`
: flowPathToHref(job?.script_path ?? '')}
{@const jobWorkspace = job?.workspace_id ?? $workspaceStore}
{@const viewHref = (job?.script_path ?? '').startsWith('hub/')
? isScript
? `${base}/scripts/get/${job?.script_hash}`
: flowPathToHref(job?.script_path ?? '')
: isScript
? `${base}/scripts/get/${job?.script_hash}?workspace=${jobWorkspace}`
: `${base}/flows/get/${job?.script_path}?workspace=${jobWorkspace}`}
<div class="flex flex-row gap-2 items-center">
{#if isScript}
<Code2 size={SMALL_ICON_SIZE} class="min-w-3.5" />