Watch
0
0
Fork
You've already forked hyperhive
0

swarm-ui: the moved tabs' redirects come from one table, with tests

The four tab moves each hand-wrote a redirect route. They are one table now,
MOVED_ROUTES, and movedHref says where an old address goes with its query
kept; /builds?run= still lands on the build's card. The builds page's own
redirect helper is gone.
This commit is contained in:
iris 2026-10-26 22:48:45 +01:00 • committed by mara
commit c28ca7aab5

View file

@ -27,3 +27,22 @@ export function visibleNavItems<T extends { href: string }>(
if (!hideDeveloper) return items;
return items.filter((item) => !DEVELOPER_ROUTES.includes(item.href));
}
// Tabs that were folded into another one. Each old address redirects to its
// new tab, so a bookmark or a link made before the move still lands. The
// builds page's `?run=` query rides along, which a swarm-builder commit
// status link relies on.
export const MOVED_ROUTES: Readonly<Record<string, string>> = {
"/alerts": "/reports",
"/issues": "/reports",
"/builds": "/jobs",
"/review": "/jobs",
"/schedules": "/messages",
};
/** Where an old address goes, keeping its query; `null` for any other path. */
export function movedHref(path: string, search: string): string | null {
const to = MOVED_ROUTES[path];
if (to === undefined) return null;
return search === "" ? to : `${to}?${search}`;
}