MuhammadMahmoud commited on
Commit
898be0f
·
1 Parent(s): e4eb9cd

enhance responsive

Browse files
Files changed (1) hide show
  1. app/static/dashboard.html +22 -14
app/static/dashboard.html CHANGED
@@ -843,15 +843,22 @@
843
  .charts-grid { grid-template-columns: 1fr; }
844
  }
845
  @media (max-width: 768px) {
846
- body { flex-direction: column; overflow: auto; }
847
- .sb { width: 100%; height: auto; flex-direction: column; border-right: none; border-bottom: 1px solid var(--b); }
848
- .sb-body { overflow: visible; }
849
- .main { overflow: visible; }
850
- .kpi-grid { grid-template-columns: repeat(2, 1fr); }
851
- .topbar { flex-direction: column; gap: 12px; align-items: stretch; }
852
- .topbar-right { justify-content: space-between; flex-wrap: wrap; }
853
- .content { padding: 16px; }
854
- table { display: block; overflow-x: auto; white-space: nowrap; }
 
 
 
 
 
 
 
855
  }
856
  </style>
857
  </head>
@@ -945,8 +952,8 @@
945
  <div class="badge">
946
  <i class="ph-fill ph-shield-check" style="color:var(--ok);font-size:14px"></i> Secure
947
  </div>
948
- <div class="badge">Sync: <span id="syncTime" class="mono" style="margin-left:4px">Never</span></div>
949
- <button class="btn btn-acc" style="padding:5px 12px" onclick="fetchAll()"><i class="ph-bold ph-arrows-clockwise"></i> Refresh</button>
950
  </div>
951
  </header>
952
  <div class="refresh-bar">
@@ -1170,7 +1177,6 @@
1170
  document.getElementById('authOverlay').classList.remove('on');
1171
  document.getElementById('mainContent').style.display = 'block';
1172
  try { initCharts(); } catch(e) { console.error('Chart init error:', e); }
1173
- fetchAll();
1174
  fetchEnv();
1175
  initSSE();
1176
  renderAlerts(); // Fetch alerts immediately once
@@ -1329,7 +1335,8 @@
1329
  const s = typeof m.success_rate === 'number' ? m.success_rate : 100;
1330
  const sc = s >= 95 ? 't-ok' : s >= 70 ? 't-warn' : 't-crit';
1331
  const calls = m.total_calls || 0, errs = m.total_errors || 0;
1332
- tb.innerHTML += `<tr style="opacity:${ban ? .6 : 1}">
 
1333
  <td>
1334
  <div class="tag" style="${ban ? 'text-decoration:line-through;color:var(--tm)' : ''}">${name}</div>
1335
  <div class="t-mute" style="font-size:11px;margin-top:4px">${m.provider || 'n/a'} • ${m.status || 'unknown'}</div>
@@ -1476,9 +1483,10 @@
1476
  if (r.status === 401) { logout(); return; }
1477
  const d = await r.json();
1478
  const modelsPayload = (d.models && Object.keys(d.models).length) ? d.models : (LAST_MODELS || {});
 
1479
  renderSys(d.system || {}, d.redis || null, d.cost || null);
1480
  renderProviders(d.providers || {}, d.breakers || {});
1481
- renderModels(d.models);
1482
  } catch(e) {}
1483
  }
1484
  }
 
843
  .charts-grid { grid-template-columns: 1fr; }
844
  }
845
  @media (max-width: 768px) {
846
+ body { flex-direction: column; overflow: auto; height: auto; }
847
+ .sb { width: 100%; height: auto; flex-direction: column; border-right: none; border-bottom: 1px solid rgba(255,255,255,0.06); }
848
+ .sb-brand { justify-content: center; }
849
+ .sb-body { overflow: visible; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; padding: 12px; }
850
+ .sb-footer { padding: 12px; flex-direction: row; justify-content: space-between; }
851
+ .main { overflow: visible; width: 100%; }
852
+ .kpi-grid { grid-template-columns: 1fr; }
853
+ .topbar { flex-direction: column; gap: 12px; align-items: stretch; padding: 16px; }
854
+ .topbar-right { justify-content: space-between; flex-wrap: wrap; gap: 8px; }
855
+ .content { padding: 12px; gap: 16px; }
856
+ table { display: block; overflow-x: auto; white-space: nowrap; width: 100%; }
857
+ .grid2 { grid-template-columns: 1fr; }
858
+ .sec-title { flex-direction: column; align-items: flex-start !important; gap: 12px; }
859
+ .modal-box { width: 92%; max-height: 90vh; overflow-y: auto; padding: 24px; }
860
+ .btns { flex-wrap: wrap; }
861
+ .chart-wrap { height: 180px !important; }
862
  }
863
  </style>
864
  </head>
 
952
  <div class="badge">
953
  <i class="ph-fill ph-shield-check" style="color:var(--ok);font-size:14px"></i> Secure
954
  </div>
955
+ <div class="badge">Sync: <span id="syncTime" class="mono" style="margin-left:4px">Connecting...</span></div>
956
+ <button class="btn btn-acc" style="padding:5px 12px" onclick="initSSE()"><i class="ph-bold ph-arrows-clockwise"></i> Force Sync</button>
957
  </div>
958
  </header>
959
  <div class="refresh-bar">
 
1177
  document.getElementById('authOverlay').classList.remove('on');
1178
  document.getElementById('mainContent').style.display = 'block';
1179
  try { initCharts(); } catch(e) { console.error('Chart init error:', e); }
 
1180
  fetchEnv();
1181
  initSSE();
1182
  renderAlerts(); // Fetch alerts immediately once
 
1335
  const s = typeof m.success_rate === 'number' ? m.success_rate : 100;
1336
  const sc = s >= 95 ? 't-ok' : s >= 70 ? 't-warn' : 't-crit';
1337
  const calls = m.total_calls || 0, errs = m.total_errors || 0;
1338
+ const tooltip = `Provider: ${m.provider || 'n/a'}\nTotal Calls: ${calls}\nSuccess Rate: ${s.toFixed(1)}%\nAvg Latency: ${m.avg_latency_ms || 0}ms\nStatus: ${m.status || 'unknown'}`;
1339
+ tb.innerHTML += `<tr style="opacity:${ban ? .6 : 1}" title="${tooltip}">
1340
  <td>
1341
  <div class="tag" style="${ban ? 'text-decoration:line-through;color:var(--tm)' : ''}">${name}</div>
1342
  <div class="t-mute" style="font-size:11px;margin-top:4px">${m.provider || 'n/a'} • ${m.status || 'unknown'}</div>
 
1483
  if (r.status === 401) { logout(); return; }
1484
  const d = await r.json();
1485
  const modelsPayload = (d.models && Object.keys(d.models).length) ? d.models : (LAST_MODELS || {});
1486
+ try { sessionStorage.setItem('awn_models', JSON.stringify(modelsPayload)); LAST_MODELS = modelsPayload; } catch(e){}
1487
  renderSys(d.system || {}, d.redis || null, d.cost || null);
1488
  renderProviders(d.providers || {}, d.breakers || {});
1489
+ renderModels(modelsPayload);
1490
  } catch(e) {}
1491
  }
1492
  }