From b7d1ae78db1f3942cbd66dfb4f89959b3a51410a Mon Sep 17 00:00:00 2001 From: Riz Ashraf Date: Sun, 27 Sep 2026 09:19:01 +0100 Subject: [PATCH] Auto-refresh tab content on switch --- server/src/dashboard.html | 135 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) diff --git a/server/src/dashboard.html b/server/src/dashboard.html index 5d8290c..b355191 100644 --- a/server/src/dashboard.html +++ b/server/src/dashboard.html @@ -478,6 +478,12 @@ + + + + + + @@ -529,6 +535,50 @@ +
+
+

Tech Debt

+
+

Resolved Error Patterns

+
+
+
+ +
+
+

Architecture Decision Records

+
+
+
+ +
+
+

Context Workspaces

+
+
+
+ +
+
+

Handoff Memos & Milestones

+
+
+
+ +
+
+

Snippets Library

+
+
+
+ +
+
+

PR Checklists

+
+
+
+
@@ -549,9 +599,16 @@ // Resize graph when becoming visible again network.redraw(); network.fit(); + loadGraph(); } else if (tabId === 'activity-tab') { const feed = document.getElementById('activity-feed'); feed.scrollTop = feed.scrollHeight; + } else if (tabId === 'task-tab') { + loadTasks(); + } else if (tabId === 'sticky-tab') { + loadStickyNotes(); + } else { + loadAllExtras(); } } @@ -986,6 +1043,82 @@ } } + async function loadGenericList(endpoint, containerId, formatter) { + try { + const res = await fetch(endpoint); + const data = await res.json(); + const container = document.getElementById(containerId); + if (!container) return; + + if (!data || data.length === 0) { + container.innerHTML = '
No items recorded.
'; + return; + } + + container.innerHTML = data.map(item => { + const date = item.timestamp ? new Date(item.timestamp * 1000).toLocaleString() : ''; + return `
+
${date}
+ ${formatter(item)} +
`; + }).join(''); + } catch (err) { + console.error(`Failed to load ${endpoint}`, err); + } + } + + function loadAllExtras() { + loadGenericList('/api/tech_debts', 'techdebt-container', item => ` + ${item.title} +
${item.description}
+
+ Severity: ${item.severity || 'Medium'} + Status: ${item.status || 'open'} +
+ `); + + loadGenericList('/api/error_fixes', 'errorfixes-container', item => ` + ${item.error_message || 'Error'} +
Fix: ${item.fix_description || ''}
+
Files: ${(item.files_changed || []).join(', ')}
+ `); + + loadGenericList('/api/adrs', 'adrs-container', item => ` + ${item.title} +
Context: ${item.context || ''}
+
Decision: ${item.decision || ''}
+
Consequences: ${item.consequences || ''}
+ `); + + loadGenericList('/api/context_workspaces', 'workspaces-container', item => ` + ${item.name} +
${item.description || ''}
+
${(item.paths || []).join(', ')}
+ `); + + loadGenericList('/api/handoff_memos', 'memos-container', item => ` + Memo from ${item.author || 'System'} +
${item.content || item.summary || ''}
+ `); + + loadGenericList('/api/snippets', 'snippets-container', item => ` + ${item.description || 'Snippet'} +
Language: ${item.language || 'txt'} | Tags: ${(item.tags || []).join(', ')}
+
${item.content || item.code || ''}
+ `); + + loadGenericList('/api/pr_checklists', 'pr-container', item => ` + ${item.name || 'Checklist'} +
    + ${(item.items || []).map(i => { + const check = i.is_completed ? '☑' : '☐'; + const strike = i.is_completed ? 'text-decoration:line-through; color:var(--text-secondary);' : ''; + return `
  • ${check} ${i.description}
  • `; + }).join('')} +
+ `); + } + async function loadVersion() { try { const res = await fetch('/api/version'); @@ -1005,6 +1138,7 @@ loadTasks(); loadStickyNotes(); loadActivityHistory(); + loadAllExtras(); setupWS(); // Listen to theme toggle changes to update graph font colors @@ -1015,6 +1149,7 @@ loadGraph(); loadTasks(); loadStickyNotes(); + loadAllExtras(); }, 5000);