Files
boc/landvex-all/admin/rivp-dashboard.html
T
Bernt 6989a98d75 feat: Passwordless cross-device authentication
- Arkitektur: docs/auth/passwordless-architecture.md
- Backend: iom/quixzoom-auth-service/ (FastAPI + Redis)
- Webb: quixzoom-market-pages/se/login/ (QR-kod + polling)
- App: iom/quixzoom-app/src/features/auth/ (push + deep links)

Flöde: QR-kod → app-godkännande → webb-inloggad
2026-07-07 07:11:50 +00:00

196 lines
6.3 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>RIVP Pilot 1 — Live Dashboard</title>
<link rel="stylesheet" href="/assets/css/landvex-complete.css">
<style>
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Inter', sans-serif; background: #000; color: #fff; line-height: 1.6; }
.header { background: #0a0a0a; border-bottom: 1px solid #333; padding: 24px; display: flex; justify-content: space-between; align-items: center; }
.header h1 { font-size: 1.5rem; color: #00d4ff; }
.header .live { background: #1a3a1a; color: #4ade80; padding: 24px; border-radius: var(--radius-sm); font-size: 0.8rem; font-weight: 600; }
.main { padding: 40px; max-width: 1400px; margin: 0 auto; }
.metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; margin-bottom: 32px; }
.metric { background: #111; border: 1px solid #333; border-radius: var(--radius-md); padding: 20px; text-align: center; }
.metric-value { font-size: 2.5rem; font-weight: 700; color: #00d4ff; }
.metric-label { font-size: 0.85rem; color: #888; margin-top: 4px; }
.section { background: #111; border: 1px solid #333; border-radius: var(--radius-md); padding: 24px; margin-bottom: 24px; }
.section h2 { font-size: 1.2rem; margin-bottom: 24px; color: #00d4ff; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 12px; color: #888; font-size: 0.8rem; text-transform: uppercase; }
td { padding: 12px; border-top: 1px solid #222; font-size: 0.9rem; }
.severity-low { color: #4ade80; }
.severity-medium { color: #fbbf24; }
.severity-high { color: #f87171; }
.severity-critical { color: #ef4444; font-weight: 600; }
.confidence-bar { background: #222; height: 8px; border-radius: var(--radius-sm); overflow: hidden; width: 100px; }
.confidence-fill { height: 100%; background: linear-gradient(90deg, #ef4444, #fbbf24, #4ade80); }
</style>
</head>
<body>
<div class="header">
<div>
<h1>RIVP Pilot 1</h1>
</div>
<div class="live"> LIVE DATA</div>
</div>
<div class="main">
<div class="metrics" id="metrics">
<div class="metric">
<div class="metric-value" id="total-roads"></div>
<div class="metric-label">Roads Monitored</div>
</div>
<div class="metric">
<div class="metric-value" id="total-obs"></div>
<div class="metric-label">Observations</div>
</div>
<div class="metric">
<div class="metric-value" id="avg-confidence"></div>
<div class="metric-label">Avg Confidence</div>
</div>
<div class="metric">
<div class="metric-value" id="verified"></div>
<div class="metric-label">Verified</div>
</div>
<div class="metric">
<div class="metric-value" id="critical"></div>
<div class="metric-label">Critical Issues</div>
</div>
</div>
<div class="section">
<h2>Recent Observations</h2>
<table>
<thead>
<tr>
<th>Road</th>
<th>County</th>
<th>Type</th>
<th>Severity</th>
<th>Confidence</th>
<th>Source</th>
<th>Date</th>
</tr>
</thead>
<tbody id="observations-table">
<tr><td colspan="7">Loading...</td></tr>
</tbody>
</table>
</div>
<div class="section">
<h2>Top Counties by Observation Count</h2>
<table>
<thead>
<tr>
<th>County</th>
<th>Roads</th>
<th>Observations</th>
</tr>
</thead>
<tbody id="counties-table">
<tr><td colspan="3">Loading...</td></tr>
</tbody>
</table>
</div>
</div>
<script>
async function loadDashboard() {
try {
const response = await fetch('/api/v1/rivp-pilot1/public/dashboard');
const data = await response.json();
document.getElementById('total-roads').textContent = data.roads.total;
document.getElementById('total-obs').textContent = data.observations.total;
document.getElementById('avg-confidence').textContent = (data.observations.average_confidence * 100).toFixed(0) + '%';
document.getElementById('verified').textContent = data.observations.verification[1] || 0;
document.getElementById('critical').textContent = data.observations.by_severity.critical || 0;
} catch (e) {
console.error('Failed to load dashboard:', e);
}
}
async function loadObservations() {
try {
const response = await fetch('/api/v1/rivp-pilot1/public/observations');
const data = await response.json();
const tbody = document.getElementById('observations-table');
tbody.innerHTML = data.observations.slice(0, 20).map(obs => `
<tr>
<td>${obs.road_name}</td>
<td>${obs.county}</td>
<td>${obs.observation_type}</td>
<td class="severity-${obs.severity}">${obs.severity}</td>
<td>
<div class="confidence-bar">
<div class="confidence-fill"></div>
</div>
${(obs.confidence * 100).toFixed(0)}%
</td>
<td>${obs.source}</td>
<td>${obs.detected_date}</td>
</tr>
`).join('');
} catch (e) {
console.error('Failed to load observations:', e);
}
}
async function loadCounties() {
try {
const response = await fetch('/api/v1/rivp-pilot1/public/roads');
const data = await response.json();
// Count observations per county
const countyObs = {};
data.roads.forEach(road => {
if (!countyObs[road.county]) {
countyObs[road.county] = { roads: 0, observations: 0 };
}
countyObs[road.county].roads++;
countyObs[road.county].observations += road.observation_count;
});
const sorted = Object.entries(countyObs)
.sort((a, b) => b[1].observations - a[1].observations)
.slice(0, 10);
const tbody = document.getElementById('counties-table');
tbody.innerHTML = sorted.map(([county, stats]) => `
<tr>
<td>${county}</td>
<td>${stats.roads}</td>
<td>${stats.observations}</td>
</tr>
`).join('');
} catch (e) {
console.error('Failed to load counties:', e);
}
}
// Load all data
loadDashboard();
loadObservations();
loadCounties();
// Refresh every 30 seconds
setInterval(() => {
loadDashboard();
loadObservations();
}, 30000);
</script>
</body>
</html>