Preserve originating views through detail navigation
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { safeReturnHref, returnLabel } from '$lib/navigation-context.js';
|
||||
import { onDestroy, onMount, untrack } from 'svelte';
|
||||
import { page } from '$app/stores';
|
||||
import type { PageData } from './$types';
|
||||
@@ -38,7 +39,7 @@
|
||||
const outcome = $derived(detail ? provisioningOutcome(detail) : null);
|
||||
const returnTo = $derived.by(() => {
|
||||
const requested = $page.url.searchParams.get('returnTo');
|
||||
if (requested) return provisioningReturn(requested);
|
||||
if (requested) { const href = safeReturnHref(requested, '/provisioning'); return { href, label: returnLabel(href) }; }
|
||||
if (detail?.collection) return { href: `/collections/launches/${encodeURIComponent(detail.collection.id)}`, label: `Back to ${detail.collection.name}` };
|
||||
if (detail?.sources.length === 1 && detail.sources[0].href) return { href: detail.sources[0].href, label: `Back to ${detail.sources[0].label}` };
|
||||
return provisioningReturn(null);
|
||||
@@ -86,7 +87,7 @@
|
||||
|
||||
<div class="page">
|
||||
<SectionHeader title={deployment ? `${actionLabels[deployment.action]} · ${serverTitle(deployment.server)}` : 'Provisioning operation'} subtitle={deployment?.server}>
|
||||
{#snippet crumbs()}<Breadcrumbs items={[{ label: 'Provisioning', href: returnTo.href.startsWith('/provisioning') ? returnTo.href : '/provisioning' }, { label: 'Operation' }]} />{/snippet}
|
||||
{#snippet crumbs()}<Breadcrumbs items={[{ label: 'Provisioning', href: '/provisioning' }, { label: 'Operation' }]} />{/snippet}
|
||||
{#snippet actions()}{#if serverHref}<Button href={serverHref}>View server</Button>{/if}{/snippet}
|
||||
</SectionHeader>
|
||||
<div class="identity-row">
|
||||
|
||||
Reference in New Issue
Block a user