From 2eaa5857a143a99d56b70aedd298297b56cf45fe Mon Sep 17 00:00:00 2001 From: librelad Date: Fri, 29 May 2026 22:28:19 +0100 Subject: [PATCH] =?UTF-8?q?feat(webui):=20phase=200a=20=E2=80=94=20feature?= =?UTF-8?q?-module=20kernel=20scaffold=20(passive)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds the foundation of the feature-module architecture (docs/frontend-modularization.md) as inert, additive code: - kernel/feature-registry.js: window.LP.features — runtime register(), manifest loader, route-table + nav builders. - features/manifest.dev.json: hand-committed manifest mirroring spa.js setupRoutes() exactly (route -> handler + navId). - index.html loads the kernel before spa.js. Zero behaviour change: nothing consults the registry yet. Phase 0b flips routing to be registry-driven with the spa.js Map as fallback. Co-Authored-By: Claude Opus 4.8 Signed-off-by: librelad --- .../frontend/features/manifest.dev.json | 65 +++++++++++++ containers/libreportal/frontend/index.html | 4 + .../frontend/kernel/feature-registry.js | 93 +++++++++++++++++++ 3 files changed, 162 insertions(+) create mode 100644 containers/libreportal/frontend/features/manifest.dev.json create mode 100644 containers/libreportal/frontend/kernel/feature-registry.js diff --git a/containers/libreportal/frontend/features/manifest.dev.json b/containers/libreportal/frontend/features/manifest.dev.json new file mode 100644 index 0000000..cdd5bd5 --- /dev/null +++ b/containers/libreportal/frontend/features/manifest.dev.json @@ -0,0 +1,65 @@ +{ + "version": 1, + "note": "Phase-0 hand-committed manifest. Mirrors spa.js setupRoutes() exactly. Will be replaced by the generated /data/webui/generated/features.json once the scan generator lands (see docs/frontend-modularization.md). 'handler' names the LibrePortalSPAClean method that still does the rendering during the strangler migration; 'navId' is the existing topbar element id for active-state highlighting.", + "features": [ + { + "id": "dashboard", + "routes": ["/", "/dashboard"], + "handler": "handleDashboard", + "navId": "nav-dashboard", + "nav": { "label": "Dashboard", "order": 10 } + }, + { + "id": "apps", + "routes": ["/apps", "/apps*"], + "handler": "handleApps", + "navId": "nav-app-center", + "nav": { "label": "App Center", "order": 20 } + }, + { + "id": "app-detail", + "routes": ["/app", "/app*"], + "handler": "handleAppDetail", + "navId": "nav-app-center" + }, + { + "id": "admin", + "routes": ["/admin", "/admin*"], + "handler": "handleAdmin", + "navId": "nav-config", + "nav": { "label": "Admin", "order": 40 } + }, + { + "id": "config-redirect", + "routes": ["/config", "/config*"], + "handler": "handleConfigRedirect", + "navId": "nav-config" + }, + { + "id": "tasks", + "routes": ["/tasks", "/tasks*"], + "handler": "handleTasks", + "navId": "nav-tasks", + "nav": { "label": "Tasks", "order": 60 } + }, + { + "id": "backup", + "routes": ["/backup", "/backup*"], + "handler": "handleBackup", + "navId": "nav-backup", + "nav": { "label": "Backups", "order": 50 } + }, + { + "id": "peers", + "routes": ["/peers", "/peers*"], + "handler": "handlePeers", + "navId": "nav-config" + }, + { + "id": "ssh", + "routes": ["/ssh", "/ssh*"], + "handler": "handleSsh", + "navId": "nav-config" + } + ] +} diff --git a/containers/libreportal/frontend/index.html b/containers/libreportal/frontend/index.html index 1d31063..d40c5ee 100755 --- a/containers/libreportal/frontend/index.html +++ b/containers/libreportal/frontend/index.html @@ -102,6 +102,10 @@ + +