6989a98d75
- 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
229 lines
7.7 KiB
HTML
229 lines
7.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>LIFE Live — Real-Time Data</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; }
|
|
.live-indicator { display: flex; align-items: center; gap: 16px; }
|
|
.pulse { width: 8px; height: 8px; background: #4ade80; border-radius: var(--radius-full); animation: pulse 2s infinite; }
|
|
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }
|
|
.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; }
|
|
.metric-value { font-size: 2.5rem; font-weight: 700; color: #00d4ff; }
|
|
.metric-label { font-size: 0.85rem; color: #888; margin-top: 4px; }
|
|
.metric-change { font-size: 0.75rem; margin-top: 4px; }
|
|
.change-up { color: #4ade80; }
|
|
.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; }
|
|
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 16px; }
|
|
.source { background: #1a1a1a; border-radius: var(--radius-md); padding: 12px; text-align: center; }
|
|
.source-name { font-size: 0.8rem; color: #888; }
|
|
.source-value { font-size: 1.5rem; font-weight: 700; color: #fff; margin-top: 4px; }
|
|
.source-status { font-size: 0.7rem; color: #4ade80; margin-top: 4px; }
|
|
.alert { background: #1a1a1a; border-left: 3px solid #f87171; padding: 24px; margin-bottom: 8px; border-radius: 0 8px 8px 0; }
|
|
.alert-critical { border-left-color: #ef4444; }
|
|
.alert-high { border-left-color: #f87171; }
|
|
.alert-type { font-weight: 600; }
|
|
.alert-location { color: #888; font-size: 0.85rem; }
|
|
.alert-time { color: #666; font-size: 0.75rem; }
|
|
table { width: 100%; border-collapse: collapse; }
|
|
th { text-align: left; padding: 12px; color: #888; font-size: 0.8rem; }
|
|
td { padding: 12px; border-top: 1px solid #222; font-size: 0.9rem; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="header">
|
|
<div>
|
|
<h1>LIFE Live</h1>
|
|
</div>
|
|
<div class="live-indicator">
|
|
<div class="pulse"></div>
|
|
<span>LIVE DATA</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="main">
|
|
|
|
<div class="metrics">
|
|
<div class="metric">
|
|
<div class="metric-value" id="total-roads">—</div>
|
|
<div class="metric-label">Roads Monitored</div>
|
|
<div class="metric-change change-up" id="roads-change">+0 today</div>
|
|
</div>
|
|
<div class="metric">
|
|
<div class="metric-value" id="total-obs">—</div>
|
|
<div class="metric-label">Total Observations</div>
|
|
<div class="metric-change change-up" id="obs-change">+0 today</div>
|
|
</div>
|
|
<div class="metric">
|
|
<div class="metric-value" id="today-obs">—</div>
|
|
<div class="metric-label">Observations Today</div>
|
|
<div class="metric-change change-up">Real-time</div>
|
|
</div>
|
|
<div class="metric">
|
|
<div class="metric-value" id="last-hour">—</div>
|
|
<div class="metric-label">Last Hour</div>
|
|
<div class="metric-change change-up">Active</div>
|
|
</div>
|
|
<div class="metric">
|
|
<div class="metric-value" id="latency">—</div>
|
|
<div class="metric-label">Reality Latency</div>
|
|
<div class="metric-change">hours</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Data Sources</h2>
|
|
<div class="source-grid" id="sources">
|
|
<div class="source">
|
|
<div class="source-name">Trafikverket</div>
|
|
<div class="source-value" id="src-trafikverket">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
<div class="source">
|
|
<div class="source-name">SMHI</div>
|
|
<div class="source-value" id="src-smhi">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
<div class="source">
|
|
<div class="source-name">Satellite</div>
|
|
<div class="source-value" id="src-satellite">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
<div class="source">
|
|
<div class="source-name">quiXzoom</div>
|
|
<div class="source-value" id="src-quixzoom">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
<div class="source">
|
|
<div class="source-name">Manual</div>
|
|
<div class="source-value" id="src-manual">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
<div class="source">
|
|
<div class="source-name">Sensor</div>
|
|
<div class="source-value" id="src-sensor">—</div>
|
|
<div class="source-status"> Active</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Active Alerts</h2>
|
|
<div id="alerts">
|
|
<div>Loading alerts...</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="section">
|
|
<h2>Recent Observations</h2>
|
|
<table>
|
|
<thead>
|
|
<tr>
|
|
<th>Time</th>
|
|
<th>Road</th>
|
|
<th>Type</th>
|
|
<th>Severity</th>
|
|
<th>Source</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody id="recent-obs">
|
|
<tr><td colspan="5">Loading...</td></tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<script>
|
|
async function loadStatus() {
|
|
try {
|
|
const response = await fetch('/api/v1/live/public/status');
|
|
const data = await response.json();
|
|
|
|
document.getElementById('total-roads').textContent = data.data_freshness.total_roads;
|
|
document.getElementById('total-obs').textContent = data.data_freshness.total_observations;
|
|
document.getElementById('today-obs').textContent = data.data_freshness.observations_today;
|
|
document.getElementById('last-hour').textContent = data.data_freshness.observations_last_hour;
|
|
document.getElementById('latency').textContent = data.data_freshness.reality_latency_hours.toFixed(1);
|
|
|
|
// Update sources
|
|
for (const [source, count] of Object.entries(data.sources)) {
|
|
const el = document.getElementById('src-' + source);
|
|
if (el) el.textContent = count;
|
|
}
|
|
|
|
} catch (e) {
|
|
console.error('Failed to load status:', e);
|
|
}
|
|
}
|
|
|
|
async function loadAlerts() {
|
|
try {
|
|
const response = await fetch('/api/v1/live/public/alerts');
|
|
const data = await response.json();
|
|
|
|
const container = document.getElementById('alerts');
|
|
if (data.alerts.length === 0) {
|
|
container.innerHTML = '<div>No active alerts</div>';
|
|
return;
|
|
}
|
|
|
|
container.innerHTML = data.alerts.slice(0, 5).map(alert => `
|
|
<div class="alert alert-${alert.severity}">
|
|
<div class="alert-type">${alert.observation_type.toUpperCase()}</div>
|
|
<div class="alert-location">${alert.road_name} • ${alert.county}</div>
|
|
<div class="alert-time">${alert.detected_date} • Confidence: ${(alert.confidence * 100).toFixed(0)}%</div>
|
|
</div>
|
|
`).join('');
|
|
|
|
} catch (e) {
|
|
console.error('Failed to load alerts:', e);
|
|
}
|
|
}
|
|
|
|
async function loadRecent() {
|
|
try {
|
|
const response = await fetch('/api/v1/live/public/observations/stream?limit=10');
|
|
const data = await response.json();
|
|
|
|
const tbody = document.getElementById('recent-obs');
|
|
tbody.innerHTML = data.observations.map(obs => `
|
|
<tr>
|
|
<td>${obs.detected_date}</td>
|
|
<td>${obs.road_name}</td>
|
|
<td>${obs.observation_type}</td>
|
|
<td>${obs.severity}</td>
|
|
<td>${obs.source}</td>
|
|
</tr>
|
|
`).join('');
|
|
|
|
} catch (e) {
|
|
console.error('Failed to load recent:', e);
|
|
}
|
|
}
|
|
|
|
// Load all data
|
|
loadStatus();
|
|
loadAlerts();
|
|
loadRecent();
|
|
|
|
// Refresh every 10 seconds
|
|
setInterval(() => {
|
|
loadStatus();
|
|
loadAlerts();
|
|
loadRecent();
|
|
}, 10000);
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|