remove default_view
This commit is contained in:
@@ -19,7 +19,6 @@ export interface StatusPageRow {
|
||||
show_powered_by: boolean;
|
||||
show_response_time:boolean;
|
||||
show_cert_expiry: boolean;
|
||||
default_window: Window;
|
||||
display_mode: "compact" | "expanded";
|
||||
bar_frequency: BucketType;
|
||||
bar_count: number;
|
||||
@@ -56,7 +55,7 @@ export interface MonitorRow {
|
||||
// maintenance rather than an outage.
|
||||
current_state: "up" | "down" | "unknown" | "paused";
|
||||
region_states: Array<{ region: string; state: "up" | "down" | "unknown"; updated_at: string | null }>;
|
||||
uptime_pct: number | null; // for the page's default_window
|
||||
uptime_pct: number | null;
|
||||
uptime: MultiWindowUptime; // 24h / 7d / 30d / 90d row
|
||||
buckets: Array<{ start: string; total: number; up: number; avg_latency: number | null }>; // bar chart input
|
||||
avg_latency: number | null;
|
||||
@@ -498,7 +497,7 @@ export async function loadMonitorDetail(slug: string, monitorId: string, window?
|
||||
`;
|
||||
if (!link) return null;
|
||||
|
||||
const win = (window ?? page.default_window) as Window;
|
||||
const win = (window ?? '24h') as Window;
|
||||
// Reuse the bulk loader with a single-monitor list - keeps the bucket/state
|
||||
// logic in one place. Cheap because we're querying for one ID. We also need
|
||||
// the page's groups so we can redact the monitor's group_id (UUID → public
|
||||
@@ -571,7 +570,6 @@ export interface PublicPageView {
|
||||
show_powered_by: boolean;
|
||||
show_response_time: boolean;
|
||||
show_cert_expiry: boolean;
|
||||
default_window: Window;
|
||||
display_mode: "compact" | "expanded";
|
||||
bar_frequency: BucketType;
|
||||
bar_count: number;
|
||||
@@ -611,7 +609,6 @@ function redactPageForPublic(p: StatusPageRow): PublicPageView {
|
||||
show_powered_by: p.show_powered_by,
|
||||
show_response_time: p.show_response_time,
|
||||
show_cert_expiry: p.show_cert_expiry,
|
||||
default_window: p.default_window,
|
||||
display_mode: p.display_mode,
|
||||
bar_frequency: p.bar_frequency,
|
||||
bar_count: p.bar_count,
|
||||
@@ -648,7 +645,7 @@ function redactGroupsAndMonitors(
|
||||
export async function loadPagePayload(slug: string, window?: Window): Promise<PagePayload | null> {
|
||||
const page = await loadStatusPage(slug);
|
||||
if (!page) return null;
|
||||
const win = (window ?? page.default_window) as Window;
|
||||
const win = (window ?? '24h') as Window;
|
||||
const [rawGroups, rawMonitors, incidents] = await Promise.all([
|
||||
loadGroups(page.id),
|
||||
loadMonitors(page.id, win, page.display_mode, page.bar_frequency, page.bar_count),
|
||||
|
||||
@@ -143,7 +143,7 @@ async function renderJson(slug: string, request: Request, win?: Window): Promise
|
||||
// fall back to HTML scraping (which gets the password form, also a 401-ish
|
||||
// signal but more expensive to parse and less stable).
|
||||
if (!page || !isAuthorised(page, request)) return jsonNotFound();
|
||||
const cacheKey = `payload:${slug}:${win ?? page.default_window}`;
|
||||
const cacheKey = `payload:${slug}:${win ?? '24h'}`;
|
||||
const payload = await cached(cacheKey, 15, () => loadPagePayload(slug, win));
|
||||
if (!payload) return jsonNotFound();
|
||||
// Password-protected JSON must be private - same reasoning as renderHtml.
|
||||
|
||||
@@ -207,8 +207,7 @@
|
||||
<span class="maintenance-pill" title="This service is paused for maintenance - checks are not running.">Maintenance</span>
|
||||
<% } else { %>
|
||||
<% if (page.show_response_time && m.avg_latency != null) { %><span><%= m.avg_latency %>ms</span><% } %>
|
||||
<% const winKey = page.default_window === '24h' ? 'd24' : page.default_window === '7d' ? 'd7' : page.default_window === '30d' ? 'd30' : 'd90'; %>
|
||||
<span class="uptime-pct <%= uptimeBand(u[winKey]) %>"><%= fmtUptime(u[winKey]) %></span>
|
||||
<span class="uptime-pct <%= uptimeBand(m.uptime_pct) %>"><%= fmtUptime(m.uptime_pct) %></span>
|
||||
<% } %>
|
||||
<svg class="chev" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><polyline points="9 18 15 12 9 6"/></svg>
|
||||
</div>
|
||||
@@ -286,7 +285,7 @@
|
||||
</main>
|
||||
|
||||
<div id="bar-tooltip" role="tooltip"></div>
|
||||
<script>window.PINGQL_PAGE = <%~ JSON.stringify({ slug: page.slug, default_window: page.default_window, bar_frequency: page.bar_frequency, show_response_time: !!page.show_response_time }) %>;</script>
|
||||
<script>window.PINGQL_PAGE = <%~ JSON.stringify({ slug: page.slug, bar_frequency: page.bar_frequency, show_response_time: !!page.show_response_time }) %>;</script>
|
||||
<script src="/_static/expand.js?v=<%= it.expandJsHash %>" defer></script>
|
||||
|
||||
<% if (page.auto_refresh_s > 0) { %>
|
||||
|
||||
Reference in New Issue
Block a user