From 7050130055a99f271047764c67a2ea92ded14f5d Mon Sep 17 00:00:00 2001 From: Balazs Tasi Date: Wed, 29 Apr 2026 10:11:36 +0200 Subject: [PATCH] fix: aggregate timeline status badges Show one badge per status in incident timeline cards and append the total count for repeated statuses. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- site/app.js | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/site/app.js b/site/app.js index b49304a..42957de 100644 --- a/site/app.js +++ b/site/app.js @@ -129,6 +129,21 @@ const formatTime = (date) => const incidentStartDate = (incident) => incident.downtime_start ? new Date(incident.downtime_start) : new Date(incident.published_at); +const summarizeStatuses = (statuses = []) => { + const counts = new Map(); + const ordered = []; + + statuses.filter(Boolean).forEach((status) => { + if (!counts.has(status)) ordered.push(status); + counts.set(status, (counts.get(status) || 0) + 1); + }); + + return ordered.map((status) => { + const count = counts.get(status); + return count > 1 ? `${status} (${count})` : status; + }); +}; + const parseJSONL = (text) => text .split(/\r?\n/) @@ -1265,7 +1280,7 @@ const renderIncidentCard = (incident, compact = false) => { const timeline = document.createElement('div'); timeline.className = 'timeline'; - (incident.status_sequence || []).forEach((status) => { + summarizeStatuses(incident.status_sequence).forEach((status) => { const pill = document.createElement('span'); pill.textContent = status; timeline.appendChild(pill);