From 92df07008df7057ff37d3f1ac6ba782de02572a6 Mon Sep 17 00:00:00 2001 From: Ross Edfort Date: Wed, 11 Oct 2023 10:18:40 -0600 Subject: [PATCH] stay on batch operations page when switching namespaces --- src/routes/(app)/+layout.svelte | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/routes/(app)/+layout.svelte b/src/routes/(app)/+layout.svelte index 03391687b..8f5564a72 100644 --- a/src/routes/(app)/+layout.svelte +++ b/src/routes/(app)/+layout.svelte @@ -69,11 +69,24 @@ }; function getCurrentHref(namespace: string) { - const onSchedulesPage = $page.url.pathname.endsWith('schedules'); - const href = onSchedulesPage - ? routeForSchedules({ namespace }) - : routeForWorkflows({ namespace }); - return href; + const namespacePages = [ + { + subPath: 'schedules', + fullRoute: routeForSchedules({ namespace }), + }, + { + subPath: 'batch-operations', + fullRoute: routeForBatchOperations({ namespace }), + }, + ]; + + for (const { subPath, fullRoute } of namespacePages) { + if ($page.url.pathname.endsWith(subPath)) { + return fullRoute; + } + } + + return routeForWorkflows({ namespace }); } const logout = () => {