Final structural phase — the catch-all core/ui/ is gone and core/boot/ keeps
only the genuine bootstrap pipeline:
core/ui/eo-modal.js, confirmation-dialog.js -> core/overlays/
core/ui/notifications.js -> core/notifications/
core/ui/topbar.{js,html}, mobile-menu.js -> core/topbar/
core/ui/update-notifier.js -> core/update-notifier/
core/ui/backup-app-card.js -> core/backup-card/ (shared widget)
core/boot/controls/ -> core/forms/controls/
core/boot/setup/ -> core/setup/
core/boot/loading-ui.js -> core/loading/
core/boot/auth-manager.js -> core/boot/auth/
Each subsystem now owns its JS + CSS together (topbar.js beside topbar.css,
auth-manager beside login.css, etc.). Path-only moves; rewrote literals in
index.html, system-loader.js (confirmation/notifications/topbar/mobile-menu/
update-notifier/apps bundles), topbar.js's internal fetch('/core/topbar/
topbar.html'), and all THREE backup-app-card loaders (system-loader, backup/
index.js, spa.js). core/boot now = system-loader, system-orchestrator, auth/.
All 24 referenced paths resolve; full node --check sweep clean.
Signed-off-by: librelad <librelad@digitalangels.vip>
58 lines
2.9 KiB
JavaScript
58 lines
2.9 KiB
JavaScript
// features/backup/index.js — Backup Center as a self-contained feature module.
|
|
//
|
|
// FIRST page migrated to the feature-module contract (docs/frontend-modularization.md).
|
|
// The kernel drives mount()/unmount() for the /backup route instead of
|
|
// spa.js's handleBackup(). The heavy controller (backup-page.js, ~129KB) is
|
|
// still lazy-loaded on first mount, so cold-load cost is unchanged.
|
|
//
|
|
// Snap-out demo: deleting this folder removes the backup route's module
|
|
// registration; the manifest entry then falls back to the legacy handler
|
|
// (and, once handleBackup is retired, to the kernel's not-found route). The
|
|
// full decomposition of backup-page.js into per-tab modules is Phase 5.
|
|
LP.features.register({
|
|
id: 'backup',
|
|
routes: ['/backup', '/backup*'],
|
|
// Controllers the feature needs; lazy-loaded on first mount (idempotent).
|
|
// Controllers, organised by sub-system (tabs). core/ first: schema + base
|
|
// class + the shared data/cron, then each tab's prototype-augment clusters.
|
|
scripts: [
|
|
'/components/backup/core/js/backup-schema.js',
|
|
'/components/backup/core/js/backup-page.js', // base: class + constructor + init/switchTab/render
|
|
'/components/backup/core/js/backup-fetch-client.js',
|
|
'/components/backup/core/js/backup-cron-schedule.js',
|
|
'/components/backup/dashboard/js/backup-dashboard.js',
|
|
'/components/backup/snapshots/js/backup-snapshots.js',
|
|
'/components/backup/snapshots/js/backup-snapshot-actions.js',
|
|
'/components/backup/locations/js/backup-locations.js',
|
|
'/components/backup/locations/js/backup-location-fields.js',
|
|
'/components/backup/locations/js/backup-location-modal.js',
|
|
'/components/backup/locations/js/backup-ssh-key.js',
|
|
'/components/backup/migrate/js/backup-migrate.js',
|
|
'/components/backup/configuration/js/backup-configuration.js',
|
|
'/components/backup/configuration/js/backup-retention-presets.js',
|
|
'/components/backup/configuration/js/backup-engine-details.js',
|
|
'/core/backup-card/backup-app-card.js',
|
|
],
|
|
|
|
async mount(ctx) {
|
|
await ctx.loadScripts(this.scripts);
|
|
const html = await ctx.loadFragment('/components/backup/core/html/backup-content.html');
|
|
ctx.setContent(html, 'Backups');
|
|
if (typeof BackupPage === 'undefined') {
|
|
throw new Error('BackupPage controller failed to load');
|
|
}
|
|
window.backupPage = new BackupPage();
|
|
await window.backupPage.init();
|
|
},
|
|
|
|
async unmount(ctx) {
|
|
// Best-effort teardown. BackupPage self-guards stale work via
|
|
// (window.backupPage === this), so nulling the global neutralises any
|
|
// pending task-refresh repaint; we also drop its coordinator registration.
|
|
// A proper dispose() (removing the leaked document listeners) lands with
|
|
// the Phase 5 backup decomposition.
|
|
try { ctx.services.tasks.refresh && ctx.services.tasks.refresh.unregister('backups'); } catch (_) {}
|
|
window.backupPage = null;
|
|
},
|
|
});
|