Compare commits

..

No commits in common. "43710d0d6bfd07b17d3f37c74bd112742ddc1443" and "1cead7fc898fe27d8229034cb68d5c2712db20d5" have entirely different histories.

3 changed files with 7 additions and 29 deletions

View File

@ -97,14 +97,13 @@
<script src="/js/system/setup-wizard.js"></script> <script src="/js/system/setup-wizard.js"></script>
<script src="/js/system/setup-completion-watcher.js"></script> <script src="/js/system/setup-completion-watcher.js"></script>
<script src="/js/system/system-orchestrator.js"></script> <script src="/js/system/system-orchestrator.js"></script>
<!-- <script src="/js/components/backup/backup-page.js"></script>
Page-specific controllers are loaded on demand by spa.js / config-manager.js <script src="/js/components/backup/backup-app-card.js"></script>
when the user navigates to the relevant route. Keeping them out of the <script src="/js/components/ssh/ssh-page.js"></script>
initial <script> block trims ~200 KB raw (~50 KB gzipped) off the cold-load <script src="/js/components/peers/peers-page.js"></script>
cost AND avoids parsing them up front on the dashboard, which most users <script src="/js/components/admin/charts.js"></script>
land on. Each handler's loadScript() call is idempotent — subsequent <script src="/js/components/admin/admin-overview.js"></script>
navigations to the same route are free. <script src="/js/components/admin/admin-system.js"></script>
-->
<script src="/js/spa.js"></script> <script src="/js/spa.js"></script>
</body> </body>
</html> </html>

View File

@ -32,21 +32,9 @@ if (typeof window.ConfigManager === 'undefined') {
// the first call, so the config-category path below is a cache hit. // the first call, so the config-category path below is a cache hit.
try { await this.core.loadConfig(category); } catch (e) {} try { await this.core.loadConfig(category); } catch (e) {}
// Tool controllers are loaded on demand — they're not in index.html's
// initial <script> block (Phase B of the WebUI lazy-load work). Falls
// back gracefully if window.spaClean isn't around for some reason
// (e.g. legacy bootstrap path).
const lazyLoad = (src) =>
window.spaClean?.loadScript ? window.spaClean.loadScript(src) : Promise.resolve();
// Overview is the Admin landing — an ops/health board, not a config form. // Overview is the Admin landing — an ops/health board, not a config form.
if (category === 'overview') { if (category === 'overview') {
try { this.sidebar.populateSidebar(); } catch (e) {} try { this.sidebar.populateSidebar(); } catch (e) {}
// charts.js is the chart-rendering helper admin-overview pulls in.
await Promise.all([
lazyLoad('/js/components/admin/admin-overview.js'),
lazyLoad('/js/components/admin/charts.js')
]);
if (typeof AdminOverview !== 'undefined') { if (typeof AdminOverview !== 'undefined') {
window.adminOverview = new AdminOverview('config-section'); window.adminOverview = new AdminOverview('config-section');
await window.adminOverview.init(); await window.adminOverview.init();
@ -60,7 +48,6 @@ if (typeof window.ConfigManager === 'undefined') {
// a config category — render its own controller into the main pane. // a config category — render its own controller into the main pane.
if (category === 'ssh-access') { if (category === 'ssh-access') {
try { this.sidebar.populateSidebar(); } catch (e) {} try { this.sidebar.populateSidebar(); } catch (e) {}
await lazyLoad('/js/components/ssh/ssh-page.js');
if (typeof SshPage !== 'undefined') { if (typeof SshPage !== 'undefined') {
window.sshPage = new SshPage('config-section'); window.sshPage = new SshPage('config-section');
await window.sshPage.init(); await window.sshPage.init();
@ -76,7 +63,6 @@ if (typeof window.ConfigManager === 'undefined') {
// we inject its content template, then init PeersPage. // we inject its content template, then init PeersPage.
if (category === 'peers') { if (category === 'peers') {
try { this.sidebar.populateSidebar(); } catch (e) {} try { this.sidebar.populateSidebar(); } catch (e) {}
await lazyLoad('/js/components/peers/peers-page.js');
try { try {
const html = await fetch('/html/peers-content.html').then(r => r.text()); const html = await fetch('/html/peers-content.html').then(r => r.text());
configSection.innerHTML = html; configSection.innerHTML = html;
@ -97,7 +83,6 @@ if (typeof window.ConfigManager === 'undefined') {
// own controller, like SSH Access above. // own controller, like SSH Access above.
if (category === 'system') { if (category === 'system') {
try { this.sidebar.populateSidebar(); } catch (e) {} try { this.sidebar.populateSidebar(); } catch (e) {}
await lazyLoad('/js/components/admin/admin-system.js');
if (typeof AdminSystem !== 'undefined') { if (typeof AdminSystem !== 'undefined') {
window.adminSystem = new AdminSystem('config-section'); window.adminSystem = new AdminSystem('config-section');
await window.adminSystem.init(); await window.adminSystem.init();

View File

@ -260,12 +260,6 @@ class LibrePortalSPAClean {
async handleBackup() { async handleBackup() {
try { try {
// backup-page.js + backup-app-card.js are loaded on first navigation.
// loadScript is idempotent — subsequent /backup navigations are no-ops.
await Promise.all([
this.loadScript('/js/components/backup/backup-page.js'),
this.loadScript('/js/components/backup/backup-app-card.js')
]);
const html = await this.fetchContent('/html/backup-content.html'); const html = await this.fetchContent('/html/backup-content.html');
this.loadContent(html, 'Backups'); this.loadContent(html, 'Backups');
if (typeof BackupPage !== 'undefined') { if (typeof BackupPage !== 'undefined') {