<% const page = it.page; const monitors = it.monitors; const groups = it.groups; const incidents = it.incidents; const themeClass = page.theme === 'dark' ? 'dark' : page.theme === 'light' ? 'light' : ''; // Group monitors. group_id null = "ungrouped". const grouped = {}; for (const m of monitors) { const key = m.group_id || ''; if (!grouped[key]) grouped[key] = []; grouped[key].push(m); } const groupOrder = [...groups.map(g => g.id), '']; function fmtPct(p) { if (p == null) return '—'; return p === 100 ? '100%' : p.toFixed(2) + '%'; } function statusLabel(s) { if (s === 'up') return 'Operational'; if (s === 'down') return 'Down'; return 'Unknown'; } function statusColor(s) { if (s === 'up') return 'var(--bar-up)'; if (s === 'down') return 'var(--bar-down)'; return 'var(--muted)'; } function bucketColor(b) { if (!b || b.total === 0) return 'var(--bar-empty)'; if (b.up === b.total) return 'var(--bar-up)'; if (b.up === 0) return 'var(--bar-down)'; return 'var(--bar-partial)'; } function uptimeBand(p) { if (p == null) return 'empty'; if (p >= 99.9) return 'good'; if (p >= 99.0) return 'warn'; return 'bad'; } function fmtUptime(p) { if (p == null) return '—'; if (p === 100) return '100%'; return p.toFixed(2) + '%'; } // Overall status: down if any monitor is down, degraded if any partial, else up. let overall = 'up'; for (const m of monitors) { const partial = m.region_states.some(r => r.state === 'down') && m.region_states.some(r => r.state === 'up'); if (m.current_state === 'down') { overall = 'down'; break; } if (partial && overall !== 'down') overall = 'degraded'; } const overallText = overall === 'up' ? 'All systems operational' : overall === 'degraded' ? 'Some systems degraded' : 'Major outage in progress'; const overallColor = overall === 'up' ? 'var(--bar-up)' : overall === 'degraded' ? 'var(--bar-partial)' : 'var(--bar-down)'; %> <%= page.title %> <% if (page.description) { %><% } %> <% if (!page.index_search) { %><% } %> <% if (page.description) { %><% } %> <% if (page.og_image_url) { %><% } %> <% if (page.analytics_html) { %><%~ page.analytics_html %><% } %>

<%= page.title %>

<% if (page.description) { %>
<%= page.description %>
<% } %>
<%= overallText %>
<% if (incidents.active.length > 0) { %>
<% incidents.active.forEach(function(i) { %>
<%= i.title %>
<%= i.status %> · started <%= new Date(i.started_at).toLocaleString() %>
<% if (i.latest_update_html) { %>
<%~ i.latest_update_html %>
<% } %>
<% }); %>
<% } %> <% const isCompact = page.display_mode === 'compact'; const windowLabel = page.default_window === '24h' ? 'Last 24 hours' : page.default_window === '7d' ? 'Last 7 days' : page.default_window === '30d' ? 'Last 30 days' : 'Last 90 days'; %> <% groupOrder.forEach(function(gid) { const list = grouped[gid]; if (!list || list.length === 0) return; const groupName = gid ? (groups.find(g => g.id === gid)?.name || '') : ''; %> <% if (groupName) { %>
<%= groupName %>
<% } %>
<% list.forEach(function(m) { const buckets = m.buckets || []; const hasData = buckets.some(b => b.total > 0); const u = m.uptime || { d24: null, d7: null, d30: null, d90: null }; %> <% if (isCompact) { %>
<% } else { %>
<%= m.display_name %>
<% if (page.show_response_time && m.avg_latency != null) { %><%= m.avg_latency %>ms<% } %> <%= fmtUptime(u[page.default_window === '24h' ? 'd24' : page.default_window === '7d' ? 'd7' : page.default_window === '30d' ? 'd30' : 'd90']) %>
<% buckets.forEach(function(b) { %>
<% }); %>
<%= windowLabel %> <%= hasData ? 'uptime over window' : 'awaiting data' %>
24h
<%= fmtUptime(u.d24) %>
7d
<%= fmtUptime(u.d7) %>
30d
<%= fmtUptime(u.d30) %>
90d
<%= fmtUptime(u.d90) %>
<% if (m.region_states && m.region_states.length > 1) { %>
<% m.region_states.forEach(function(r) { %> <%= r.region %> <% }); %>
<% } %>
<% } %> <% }); %>
<% }); %> <% if (incidents.recent.length > 0) { %>

Past incidents

<% incidents.recent.forEach(function(i) { %>
<%= i.title %>
<%= i.status %> · <%= new Date(i.started_at).toLocaleDateString() %>
<% }); %>
<% } %>
<% if (isCompact) { %> <% } %> <% if (page.auto_refresh_s > 0) { %> <% } %>