ui: major UX polish and bug fixes for dashboard

- Added global loading spinner and page transitions.
- Improved sidebar with tooltips and persistent collapsed state.
- Fixed chart memory leaks by properly destroying instances on page change.
- Unified WebSocket event handling and status indicators.
- Refined stat cards, tables, and modal interactions.
- Added real backend integration for logout and session management.
This commit is contained in:
2026-02-26 15:48:01 -05:00
parent b52e0e3af0
commit 2c5a6a596b
6 changed files with 202 additions and 51 deletions

View File

@@ -255,10 +255,44 @@ class OverviewPage {
window.wsManager.subscribe('requests', (event) => {
// Hot-reload stats and table when a new request comes in
this.loadStats();
this.loadRecentRequests();
this.addToRecentRequests(event);
});
}
addToRecentRequests(request) {
const tableBody = document.querySelector('#recent-requests tbody');
if (!tableBody) return;
// Remove empty message if present
if (tableBody.querySelector('.text-center')) {
tableBody.innerHTML = '';
}
const time = luxon.DateTime.fromISO(request.timestamp || new Date().toISOString()).toFormat('HH:mm:ss');
const statusClass = request.status === 'success' ? 'success' : 'danger';
const statusIcon = request.status === 'success' ? 'check-circle' : 'exclamation-circle';
const row = document.createElement('tr');
row.innerHTML = `
<td>${time}</td>
<td><span class="badge-client">${request.client_id}</span></td>
<td>${request.provider}</td>
<td><code class="code-sm">${request.model}</code></td>
<td>${(request.total_tokens || request.tokens || 0).toLocaleString()}</td>
<td>
<span class="status-badge ${statusClass}">
<i class="fas fa-${statusIcon}"></i>
${request.status}
</span>
</td>
`;
tableBody.insertBefore(row, tableBody.firstChild);
if (tableBody.children.length > 10) {
tableBody.lastElementChild.remove();
}
}
showError(message) {
const container = document.getElementById('overview-stats');
if (container) {