refactor(routing): admin overview canonical URL is /admin/dashboard

The admin ops/health board now lives at /admin/dashboard (adminPath
('overview') emits it; the topbar Admin link points there). Bare /admin
still resolves to the same board — no redirect, both paths render it.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
librelad 2026-05-28 23:41:30 +01:00
parent 1a0d5e9a8a
commit ba3f71cf7a
2 changed files with 4 additions and 3 deletions

View File

@ -45,7 +45,7 @@
</svg> </svg>
App Center App Center
</a> </a>
<a href="/admin" class="nav-item" id="nav-config"> <a href="/admin/dashboard" class="nav-item" id="nav-config">
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"> <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path> <path d="M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.77-3.77a6 6 0 0 1-7.94 7.94l-6.91 6.91a2.12 2.12 0 0 1-3-3l6.91-6.91a6 6 0 0 1 7.94-7.94l-3.76 3.76z"></path>
</svg> </svg>

View File

@ -550,7 +550,7 @@ class LibrePortalSPAClean {
// Admin area path helpers (shared by the SPA, sidebar, overview, ssh page). // Admin area path helpers (shared by the SPA, sidebar, overview, ssh page).
// Map a category to its path-based URL, and parse a path back to a category. // Map a category to its path-based URL, and parse a path back to a category.
window.adminPath = function (category) { window.adminPath = function (category) {
if (!category || category === 'overview') return '/admin'; if (!category || category === 'overview') return '/admin/dashboard'; // the admin board
if (category === 'system') return '/admin/system'; // stats, not config if (category === 'system') return '/admin/system'; // stats, not config
if (category === 'ssh-access') return '/admin/tools/ssh-access'; if (category === 'ssh-access') return '/admin/tools/ssh-access';
if (category === 'peers') return '/admin/tools/peers'; if (category === 'peers') return '/admin/tools/peers';
@ -558,7 +558,8 @@ window.adminPath = function (category) {
}; };
window.adminCategoryFromPath = function (pathname) { window.adminCategoryFromPath = function (pathname) {
const segs = String(pathname || '').replace(/^\/admin\/?/, '').split('/').filter(Boolean); const segs = String(pathname || '').replace(/^\/admin\/?/, '').split('/').filter(Boolean);
if (!segs.length || segs[0] === 'overview') return 'overview'; // Bare /admin and /admin/dashboard both resolve to the overview board.
if (!segs.length || segs[0] === 'overview' || segs[0] === 'dashboard') return 'overview';
if (segs[0] === 'config') return segs[1] || 'general'; if (segs[0] === 'config') return segs[1] || 'general';
if (segs[0] === 'tools') return segs[1] || 'overview'; if (segs[0] === 'tools') return segs[1] || 'overview';
return segs[0]; return segs[0];