aboutsummaryrefslogtreecommitdiff
path: root/modules/core/terminal.js
diff options
context:
space:
mode:
Diffstat (limited to 'modules/core/terminal.js')
-rw-r--r--modules/core/terminal.js42
1 files changed, 31 insertions, 11 deletions
diff --git a/modules/core/terminal.js b/modules/core/terminal.js
index 425c5d6..c586538 100644
--- a/modules/core/terminal.js
+++ b/modules/core/terminal.js
@@ -479,6 +479,16 @@
this.hideAutocomplete();
}
});
+ // 2026-10-22: dashboard.html wrote this key on ⟳ Refresh and nothing listened.
+ window.addEventListener('storage', function (ev) {
+ if (ev.key !== 'webx11_dashboard_data_request') return;
+ const aiMod = this.moduleManager && this.moduleManager.modules
+ ? this.moduleManager.modules.WebX11AIAssistantModule : null;
+ if (aiMod && typeof aiMod._collectDashboardData === 'function') {
+ aiMod._collectDashboardData();
+ }
+ }.bind(this));
+
window.addEventListener('online', () => this.updateNetworkStatus());
window.addEventListener('offline', () => this.updateNetworkStatus());
document.getElementById('file-upload-input').addEventListener('change', (e) => {
@@ -1575,18 +1585,28 @@
if (cmd === 'smart-prompt') { const val = args[0] && args[0] === 'off' ? 'off' : 'on'; localStorage.setItem('webx11_smart_prompt', val); this.print('Smart prompt ' + val, 'success'); this.updatePrompt(); return; }
if (cmd === 'mem') { this.printMemoryStats(); return; }
if (cmd === 'dashboard') {
- // Collect dashboard data and open the dashboard page
- const aiMod = this.moduleManager?.modules?.WebX11AIAssistantModule;
- if (aiMod && typeof aiMod._collectDashboardData === 'function') {
- aiMod._collectDashboardData().then(function() {
- this.print('📊 Dashboard data collected — opening dashboard...', 'success');
- window.open('/spaces/newos4/downloads/dashboard.html', 'newOS4 Dashboard', 'width=1200,height=800');
- }.bind(this));
- } else {
- // Fallback: just open the page (it will try localStorage)
- this.print('📊 Opening dashboard...', 'info');
- window.open('/spaces/newos4/downloads/dashboard.html', 'newOS4 Dashboard', 'width=1200,height=800');
+ const aiMod = this.moduleManager && this.moduleManager.modules
+ ? this.moduleManager.modules.WebX11AIAssistantModule : null;
+ const collect = function () {
+ if (aiMod && typeof aiMod._collectDashboardData === 'function') return aiMod._collectDashboardData();
+ return Promise.resolve(null);
+ };
+ if (args.indexOf('--stop') !== -1) {
+ if (this._dashTimer) { clearInterval(this._dashTimer); this._dashTimer = null; this.print('📊 Dashboard watch stopped', 'info'); }
+ else this.print('📊 Dashboard watch is not running', 'warning');
+ return;
}
+ if (args.indexOf('--watch') !== -1) {
+ if (this._dashTimer) clearInterval(this._dashTimer);
+ collect();
+ this._dashTimer = setInterval(collect, 5000);
+ this.print('📊 Dashboard watch on (5s) — open the dashboard tab; `dashboard --stop` to stop', 'success');
+ return;
+ }
+ collect().then(function () {
+ this.print('📊 Dashboard data collected — opening dashboard...', 'success');
+ window.open('/spaces/newos4/downloads/dashboard.html', 'newOS4 Dashboard', 'width=1200,height=800');
+ }.bind(this));
return;
}
if (cmd === 'config') {