diff --git a/config.php b/config.php index d51e600..4c5c3bc 100644 --- a/config.php +++ b/config.php @@ -1,7 +1,7 @@ healthy" shows a + * green dot even if it contains degraded/warning events along the way. + * Returns null when no state-change event is present; callers fall + * back to dominantSev in that case (e.g. rollout-only clusters). */ +function clusterOutcomeSev(events) { + for (const e of events) { + const m = /->\s*(\w+)\s*$/.exec(e.message || ''); + if (!m) continue; + switch (m[1]) { + case 'healthy': return 'recovered'; + case 'degraded': return 'warning'; + case 'unavailable': return 'error'; + } + } + return null; +} + function sameDay(a, b) { const da = new Date(a), db = new Date(b); return da.getFullYear() === db.getFullYear() @@ -336,7 +356,7 @@ function renderTimeline() { let lastDate = null; body.innerHTML = clusters.map(cluster => { - const sev = dominantSev(cluster.events); + const sev = clusterOutcomeSev(cluster.events) || dominantSev(cluster.events); const showDate = !lastDate || !sameDay(lastDate, cluster.ts); lastDate = cluster.ts; const d = new Date(cluster.ts);