From e63baf2fbd2be7a681a418f1896568a6d77f2383 Mon Sep 17 00:00:00 2001 From: AlbertoV Date: Sat, 5 Sep 2026 01:02:23 +0200 Subject: [PATCH 1/2] fix: preserve legacy console route suffixes --- ui/src/main.js | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/ui/src/main.js b/ui/src/main.js index 27c3b21..ac67122 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -32,17 +32,23 @@ async function resolveApplication(to) { // Unreachable API: send it to `default`, which is where the flat control // route would have looked anyway, and let the page report the failure. } - return `/apps/${encodeURIComponent(application)}/graphs/${encodeURIComponent(name)}` + return graphLocation(application, name, to) } /* The target shapes, kept as addresses and answered by the graph pages. A `/lanes/:lane` link becomes the graph with that path selected, because a lane is a path now and the page can show it. */ -function toGraph(to) { - const { app, name, lane, path } = to.params +function graphLocation(app, name, to) { + const { lane, path } = to.params + const base = `/apps/${encodeURIComponent(app)}/graphs/${encodeURIComponent(name)}` const p = lane || path - const q = p ? `?path=${encodeURIComponent(p)}` : '' - return `/apps/${encodeURIComponent(app)}/graphs/${encodeURIComponent(name)}${q}` + if (p) return `${base}?path=${encodeURIComponent(p)}` + if (to.path.endsWith('/edit')) return `${base}/edit` + return base +} + +function toGraph(to) { + return graphLocation(to.params.app, to.params.name, to) } const router = createRouter({ @@ -65,7 +71,7 @@ const router = createRouter({ // ---- the target addresses, answered by the graph pages. { path: '/apps/:app/targets/:name', component: NeverRendered, beforeEnter: toGraph, meta: { nav: 'targets' } }, - { path: '/apps/:app/targets/:name/edit', component: NeverRendered, beforeEnter: (to) => `/apps/${to.params.app}/graphs/${to.params.name}/edit`, meta: { nav: 'targets' } }, + { path: '/apps/:app/targets/:name/edit', component: NeverRendered, beforeEnter: toGraph, meta: { nav: 'targets' } }, { path: '/apps/:app/targets/:name/lanes/:lane', component: NeverRendered, beforeEnter: toGraph, meta: { nav: 'targets' } }, { path: '/apps/:app/targets/:name/budgets/:budget', component: NeverRendered, beforeEnter: toGraph, meta: { nav: 'targets' } }, From f7838049df3f54463787cf08be2754123cc8994f Mon Sep 17 00:00:00 2001 From: AlbertoV Date: Sat, 5 Sep 2026 17:35:46 +0200 Subject: [PATCH 2/2] fix(console): read the edit suffix from the route, not from the URL `graphLocation` decided the suffix with `to.path.endsWith('/edit')`, which is the concrete URL and therefore carries user data. `ok_name` admits `edit` as a graph name, so `/apps/a/targets/edit` and `/targets/edit` both end with `/edit` while naming no suffix at all: that graph was redirected to `/apps/a/graphs/edit/edit`, the editor, instead of to its detail page. The matched record's `path` is the pattern the router registered and cannot contain a name, so it answers the question the URL was being asked. Claude-Session: https://claude.ai/code/session_012K8u7BEJyd6nDNMCQAgH3z --- ui/src/main.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui/src/main.js b/ui/src/main.js index ac67122..8b68bc1 100644 --- a/ui/src/main.js +++ b/ui/src/main.js @@ -43,7 +43,11 @@ function graphLocation(app, name, to) { const base = `/apps/${encodeURIComponent(app)}/graphs/${encodeURIComponent(name)}` const p = lane || path if (p) return `${base}?path=${encodeURIComponent(p)}` - if (to.path.endsWith('/edit')) return `${base}/edit` + /* The suffix comes from the ROUTE PATTERN, never from `to.path`. `ok_name` + admits `edit` as a graph name, so `/targets/edit` ends with `/edit` while + naming no suffix at all — reading the concrete URL sends that graph to the + editor instead of to its detail page. The pattern is static. */ + if (to.matched.at(-1)?.path.endsWith('/edit')) return `${base}/edit` return base }