wire client

This commit is contained in:
Alex Holliday committed 2026-08-17 14:56:53 -07:00
1 parent 506133af29
commit c15d6e0851
11 files changed
+189 -116

No files matched your search

@@ -87,6 +87,16 @@ const StatusPageView = () => {
const location = useLocation(); const location = useLocation();
const [searchParams, setSearchParams] = useSearchParams(); const [searchParams, setSearchParams] = useSearchParams();
const onRangeChange = (next: StatusPageRange) => {
const updated = new URLSearchParams(searchParams);
if (next === "latest") {
updated.delete("range");
} else {
updated.set("range", next);
}
setSearchParams(updated, { replace: true });
};
const onCustomDomainHost = isCustomDomainHost(); const onCustomDomainHost = isCustomDomainHost();
const isPublic = const isPublic =
onCustomDomainHost || location.pathname.startsWith(PUBLIC_STATUS_PAGE_PREFIX); onCustomDomainHost || location.pathname.startsWith(PUBLIC_STATUS_PAGE_PREFIX);
@@ -160,6 +170,9 @@ const StatusPageView = () => {
statusPage={statusPage} statusPage={statusPage}
monitors={monitors} monitors={monitors}
config={themeConfig} config={themeConfig}
range={range}
onRangeChange={onRangeChange}
bucketTimezone={data.bucketTimezone ?? "Etc/UTC"}
/> />
</StatusPageThemeProvider> </StatusPageThemeProvider>
); );
@@ -4,8 +4,10 @@ import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus";
import { BOLD_SANS_STACK, MONO_STACK } from "../shared/fontStacks"; import { BOLD_SANS_STACK, MONO_STACK } from "../shared/fontStacks";
import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; import { MAX_RECENT_CHECKS } from "@/Types/Monitor";
export type BoldHeatCell = "fast" | "med" | "slow" | "down" | "empty"; import type { BarKind, HeatCellKind } from "../shared/ChartCells";
export type BoldBarKind = "up" | "down" | "empty";
export type BoldHeatCell = HeatCellKind;
export type BoldBarKind = BarKind;
export type BoldGaugeFill = "ok" | "warm" | "hot"; export type BoldGaugeFill = "ok" | "warm" | "hot";
export interface BoldStyles { export interface BoldStyles {
@@ -55,6 +57,7 @@ export const boldStyles = (
fast: tokens.up, fast: tokens.up,
med: `color-mix(in srgb, ${tokens.up} 70%, #ffffff 30%)`, med: `color-mix(in srgb, ${tokens.up} 70%, #ffffff 30%)`,
slow: tokens.warn, slow: tokens.warn,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
@@ -62,12 +65,14 @@ export const boldStyles = (
fast: `0 0 6px color-mix(in srgb, ${tokens.up} 18%, transparent)`, fast: `0 0 6px color-mix(in srgb, ${tokens.up} 18%, transparent)`,
med: `0 0 6px color-mix(in srgb, ${tokens.up} 18%, transparent)`, med: `0 0 6px color-mix(in srgb, ${tokens.up} 18%, transparent)`,
slow: `0 0 6px color-mix(in srgb, ${tokens.warn} 20%, transparent)`, slow: `0 0 6px color-mix(in srgb, ${tokens.warn} 20%, transparent)`,
degraded: `0 0 6px color-mix(in srgb, ${tokens.degraded} 20%, transparent)`,
down: `0 0 6px color-mix(in srgb, ${tokens.down} 20%, transparent)`, down: `0 0 6px color-mix(in srgb, ${tokens.down} 20%, transparent)`,
empty: "none", empty: "none",
}; };
const barBg: Record<BoldBarKind, string> = { const barBg: Record<BoldBarKind, string> = {
up: tokens.up, up: tokens.up,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
@@ -8,8 +8,10 @@ import {
} from "../shared/fontStacks"; } from "../shared/fontStacks";
import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; import { MAX_RECENT_CHECKS } from "@/Types/Monitor";
export type EditorialHeatCell = "fast" | "med" | "slow" | "down" | "empty"; import type { BarKind, HeatCellKind } from "../shared/ChartCells";
export type EditorialBarKind = "up" | "down" | "empty";
export type EditorialHeatCell = HeatCellKind;
export type EditorialBarKind = BarKind;
export type EditorialGaugeFill = "ok" | "warm" | "hot"; export type EditorialGaugeFill = "ok" | "warm" | "hot";
export interface EditorialStyles { export interface EditorialStyles {
@@ -59,12 +61,14 @@ export const editorialStyles = (
fast: tokens.up, fast: tokens.up,
med: `color-mix(in srgb, ${tokens.up} 60%, ${tokens.bg})`, med: `color-mix(in srgb, ${tokens.up} 60%, ${tokens.bg})`,
slow: tokens.warn, slow: tokens.warn,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
const barBg: Record<EditorialBarKind, string> = { const barBg: Record<EditorialBarKind, string> = {
up: tokens.up, up: tokens.up,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
@@ -5,8 +5,10 @@ import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus";
import { MONO_STACK, SANS_STACK } from "../shared/fontStacks"; import { MONO_STACK, SANS_STACK } from "../shared/fontStacks";
import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; import { MAX_RECENT_CHECKS } from "@/Types/Monitor";
export type ModernHeatCell = "fast" | "med" | "slow" | "down" | "empty"; import type { BarKind, HeatCellKind } from "../shared/ChartCells";
export type ModernBarKind = "up" | "down" | "empty";
export type ModernHeatCell = HeatCellKind;
export type ModernBarKind = BarKind;
export type ModernGaugeFill = "ok" | "warm" | "hot"; export type ModernGaugeFill = "ok" | "warm" | "hot";
export interface ModernStyles { export interface ModernStyles {
@@ -86,12 +88,14 @@ export const modernStyles = (
fast: `linear-gradient(180deg, ${tokens.up}, ${tokens.upStrong})`, fast: `linear-gradient(180deg, ${tokens.up}, ${tokens.upStrong})`,
med: `linear-gradient(180deg, color-mix(in srgb, ${tokens.up} 70%, #ffffff 30%), ${tokens.up})`, med: `linear-gradient(180deg, color-mix(in srgb, ${tokens.up} 70%, #ffffff 30%), ${tokens.up})`,
slow: `linear-gradient(180deg, ${tokens.warn}, ${tokens.degraded})`, slow: `linear-gradient(180deg, ${tokens.warn}, ${tokens.degraded})`,
degraded: `linear-gradient(180deg, ${tokens.degraded}, color-mix(in srgb, ${tokens.degraded} 70%, #000000 30%))`,
down: `linear-gradient(180deg, ${tokens.down}, color-mix(in srgb, ${tokens.down} 70%, #000000 30%))`, down: `linear-gradient(180deg, ${tokens.down}, color-mix(in srgb, ${tokens.down} 70%, #000000 30%))`,
empty: tokens.border, empty: tokens.border,
}; };
const barBg: Record<ModernBarKind, string> = { const barBg: Record<ModernBarKind, string> = {
up: tokens.up, up: tokens.up,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
@@ -3,8 +3,10 @@ import type { StatusPageThemeTokens } from "../tokens";
import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus"; import { type OverallTone, toneColor, toneSoft } from "../shared/overallStatus";
import { MONO_STACK, SANS_STACK } from "../shared/fontStacks"; import { MONO_STACK, SANS_STACK } from "../shared/fontStacks";
export type RefinedHeatCell = "fast" | "med" | "slow" | "down" | "empty"; import type { BarKind, HeatCellKind } from "../shared/ChartCells";
export type RefinedBarKind = "up" | "down" | "empty";
export type RefinedHeatCell = HeatCellKind;
export type RefinedBarKind = BarKind;
export type RefinedGaugeFill = "ok" | "warm" | "hot"; export type RefinedGaugeFill = "ok" | "warm" | "hot";
import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; import { MAX_RECENT_CHECKS } from "@/Types/Monitor";
@@ -71,12 +73,14 @@ export const refinedStyles = (
fast: tokens.up, fast: tokens.up,
med: `color-mix(in srgb, ${tokens.up} 60%, #ffffff 40%)`, med: `color-mix(in srgb, ${tokens.up} 60%, #ffffff 40%)`,
slow: tokens.warn, slow: tokens.warn,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
const barBg: Record<RefinedBarKind, string> = { const barBg: Record<RefinedBarKind, string> = {
up: tokens.up, up: tokens.up,
degraded: tokens.degraded,
down: tokens.down, down: tokens.down,
empty: tokens.border, empty: tokens.border,
}; };
@@ -4,17 +4,15 @@ import Stack from "@mui/material/Stack";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import type { SxProps, Theme } from "@mui/material/styles"; import type { SxProps, Theme } from "@mui/material/styles";
import type { Monitor } from "@/Types/Monitor"; import type { Monitor } from "@/Types/Monitor";
import type { StatusPage } from "@/Types/StatusPage"; import type { StatusPage, StatusPageRange } from "@/Types/StatusPage";
import { getMonitorTypeLabel } from "@/Types/StatusPage"; import {
getMonitorTypeLabel,
STATUS_PAGE_RANGE_DAYS,
STATUS_PAGE_RANGES,
} from "@/Types/StatusPage";
import type { StatusPageThemeTokens } from "@/Pages/StatusPage/Status/themes/tokens"; import type { StatusPageThemeTokens } from "@/Pages/StatusPage/Status/themes/tokens";
import { import { ThemedHeatmap } from "@/Pages/StatusPage/Status/themes/shared/ThemedHeatmap";
ThemedHeatmap, import { ThemedHistogram } from "@/Pages/StatusPage/Status/themes/shared/ThemedHistogram";
type HeatCellKind,
} from "@/Pages/StatusPage/Status/themes/shared/ThemedHeatmap";
import {
ThemedHistogram,
type BarKind,
} from "@/Pages/StatusPage/Status/themes/shared/ThemedHistogram";
import { import {
ThemedInfrastructure, ThemedInfrastructure,
type GaugeFillLevel, type GaugeFillLevel,
@@ -28,6 +26,12 @@ import {
} from "@/Pages/StatusPage/Status/themes/shared/overallStatus"; } from "@/Pages/StatusPage/Status/themes/shared/overallStatus";
import { useStatusPageTheme } from "@/Pages/StatusPage/Status/themes/StatusPageThemeProvider"; import { useStatusPageTheme } from "@/Pages/StatusPage/Status/themes/StatusPageThemeProvider";
import { formatPercentage } from "@/Utils/FormatUtils"; import { formatPercentage } from "@/Utils/FormatUtils";
import {
checksToCells,
dailyBucketsToCells,
type BarKind,
type HeatCellKind,
} from "@/Pages/StatusPage/Status/themes/shared/ChartCells";
type StatusPageMonitor = Monitor; type StatusPageMonitor = Monitor;
@@ -82,9 +86,19 @@ interface Props {
statusPage: StatusPage; statusPage: StatusPage;
monitors: StatusPageMonitor[]; monitors: StatusPageMonitor[];
config: ThemeConfig<any>; config: ThemeConfig<any>;
range: StatusPageRange;
onRangeChange: (range: StatusPageRange) => void;
bucketTimezone: string;
} }
export const BaseStatusPage = ({ statusPage, monitors, config }: Props) => { export const BaseStatusPage = ({
statusPage,
monitors,
config,
range,
onRangeChange,
bucketTimezone,
}: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { tokens, mode } = useStatusPageTheme(); const { tokens, mode } = useStatusPageTheme();
const styles = useMemo( const styles = useMemo(
@@ -126,33 +140,56 @@ export const BaseStatusPage = ({ statusPage, monitors, config }: Props) => {
/> />
{statusPage.showCharts && ( {statusPage.showCharts && (
<Box sx={styles.chartSwitchWrap}> <Stack>
<Box <Box sx={styles.chartSwitchWrap}>
sx={styles.chartSwitch}
role="radiogroup"
>
<Box <Box
component="button" sx={styles.chartSwitch}
type="button" role="radiogroup"
role="radio"
aria-checked={chartMode === "heatmap"}
onClick={() => setChartMode("heatmap")}
sx={styles.chartSwitchButton(chartMode === "heatmap")}
> >
{t("pages.statusPages.monitorsList.chartTypeHeatmap")} <Box
</Box> component="button"
<Box type="button"
component="button" role="radio"
type="button" aria-checked={chartMode === "heatmap"}
role="radio" onClick={() => setChartMode("heatmap")}
aria-checked={chartMode === "histogram"} sx={styles.chartSwitchButton(chartMode === "heatmap")}
onClick={() => setChartMode("histogram")} >
sx={styles.chartSwitchButton(chartMode === "histogram")} {t("pages.statusPages.monitorsList.chartTypeHeatmap")}
> </Box>
{t("pages.statusPages.monitorsList.chartTypeHistogram")} <Box
component="button"
type="button"
role="radio"
aria-checked={chartMode === "histogram"}
onClick={() => setChartMode("histogram")}
sx={styles.chartSwitchButton(chartMode === "histogram")}
>
{t("pages.statusPages.monitorsList.chartTypeHistogram")}
</Box>
</Box> </Box>
</Box> </Box>
</Box> <Box sx={styles.chartSwitchWrap}>
<Box
sx={styles.chartSwitch}
role="radiogroup"
aria-label={t("pages.statusPages.rangeSelectorAria")}
>
{STATUS_PAGE_RANGES.map((value) => (
<Box
component="button"
type="button"
role="radio"
key={value}
aria-checked={range === value}
onClick={() => onRangeChange(value)}
sx={styles.chartSwitchButton(range === value)}
>
{t(`pages.statusPages.range.${value}`)}
</Box>
))}
</Box>
</Box>
</Stack>
)} )}
<Stack <Stack
@@ -166,6 +203,16 @@ export const BaseStatusPage = ({ statusPage, monitors, config }: Props) => {
const badgeTone = monitorBadgeTone(monitor.status); const badgeTone = monitorBadgeTone(monitor.status);
const uptimePercentage = formatPercentage(monitor.uptimePercentage ?? 0); const uptimePercentage = formatPercentage(monitor.uptimePercentage ?? 0);
const cells =
range === "latest"
? checksToCells(monitor.recentChecks ?? [], t)
: dailyBucketsToCells(
monitor.dailyChecks ?? [],
STATUS_PAGE_RANGE_DAYS[range],
bucketTimezone,
t
);
return ( return (
<Box <Box
component="li" component="li"
@@ -226,13 +273,13 @@ export const BaseStatusPage = ({ statusPage, monitors, config }: Props) => {
{showChart && {showChart &&
(chartMode === "heatmap" ? ( (chartMode === "heatmap" ? (
<ThemedHeatmap <ThemedHeatmap
checks={monitor.recentChecks ?? []} cells={cells}
containerSx={styles.heatmap} containerSx={styles.heatmap}
cellSx={styles.heatmapCell} cellSx={styles.heatmapCell}
/> />
) : ( ) : (
<ThemedHistogram <ThemedHistogram
checks={monitor.recentChecks ?? []} cells={cells}
containerSx={styles.histogram} containerSx={styles.histogram}
barSx={styles.bar} barSx={styles.bar}
statsSx={styles.chartStats} statsSx={styles.chartStats}
@@ -2,65 +2,48 @@ import Tooltip from "@mui/material/Tooltip";
import Box from "@mui/material/Box"; import Box from "@mui/material/Box";
import type { SxProps, Theme } from "@mui/material/styles"; import type { SxProps, Theme } from "@mui/material/styles";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import type { CheckSnapshot } from "@/Types/Check"; import type {
import { MAX_RECENT_CHECKS } from "@/Types/Monitor"; ChartCell,
import { ThemedChartTooltip } from "@/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip"; HeatCellKind,
import { formatMs } from "@/Utils/TimeUtils"; } from "@/Pages/StatusPage/Status/themes/shared/ChartCells";
const CELLS = MAX_RECENT_CHECKS;
export type HeatCellKind = "fast" | "med" | "slow" | "down" | "empty";
interface Props { interface Props {
checks: CheckSnapshot[]; cells: ChartCell[];
containerSx: SxProps<Theme>; containerSx: SxProps<Theme>;
cellSx: (kind: HeatCellKind) => SxProps<Theme>; cellSx: (kind: HeatCellKind) => SxProps<Theme>;
} }
const classify = (check: CheckSnapshot): Exclude<HeatCellKind, "empty"> => { export const ThemedHeatmap = ({ cells, containerSx, cellSx }: Props) => {
if (!check.status) return "down";
const rt = check.responseTime ?? 0;
if (rt > 500) return "slow";
if (rt > 250) return "med";
return "fast";
};
export const ThemedHeatmap = ({ checks, containerSx, cellSx }: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const source = checks.slice(-CELLS);
const padded: (CheckSnapshot | null)[] = [
...source,
...Array.from({ length: Math.max(0, CELLS - source.length) }, () => null),
];
return ( return (
<Box <Box
sx={containerSx} sx={[
...(Array.isArray(containerSx) ? containerSx : [containerSx]),
{ gridTemplateColumns: `repeat(${cells.length}, 1fr)` },
]}
role="img" role="img"
aria-label={t("pages.statusPages.monitorsList.chart.heatmapAria")} aria-label={t("pages.statusPages.monitorsList.chart.heatmapAria")}
> >
{padded.map((check, i) => { {cells.map((cell) => {
if (!check) { if (cell.heatKind === "empty") {
return ( return (
<Box <Box
key={`empty-${i}`} key={cell.key}
sx={cellSx("empty")} sx={cellSx("empty")}
/> />
); );
} }
const kind = classify(check);
const tooltipContent = <ThemedChartTooltip check={check} />;
return ( return (
<Tooltip <Tooltip
key={check.id ?? i} key={cell.key}
title={tooltipContent} title={cell.tooltip}
arrow arrow
placement="top" placement="top"
> >
<Box <Box
sx={cellSx(kind)} sx={cellSx(cell.heatKind)}
aria-label={`${formatMs(check.responseTime)}, ${check.status ? "up" : "down"}`} aria-label={cell.ariaLabel}
/> />
</Tooltip> </Tooltip>
); );
@@ -5,17 +5,14 @@ import Stack from "@mui/material/Stack";
import type { SxProps, Theme } from "@mui/material/styles"; import type { SxProps, Theme } from "@mui/material/styles";
import { useTranslation } from "react-i18next"; import { useTranslation } from "react-i18next";
import type { CheckSnapshot } from "@/Types/Check"; import type { CheckSnapshot } from "@/Types/Check";
import { MAX_RECENT_CHECKS } from "@/Types/Monitor";
import { computeBarHeights } from "@/Utils/DataUtils";
import { formatMs } from "@/Utils/TimeUtils"; import { formatMs } from "@/Utils/TimeUtils";
import { ThemedChartTooltip } from "@/Pages/StatusPage/Status/themes/shared/ThemedChartTooltip"; import type {
const CELLS = MAX_RECENT_CHECKS; BarKind,
const MIN_HEIGHT_PCT = 6; ChartCell,
} from "@/Pages/StatusPage/Status/themes/shared/ChartCells";
export type BarKind = "up" | "down" | "empty";
interface Props { interface Props {
checks: CheckSnapshot[]; cells: ChartCell[];
containerSx: SxProps<Theme>; containerSx: SxProps<Theme>;
barSx: (kind: BarKind, heightPct: number) => SxProps<Theme>; barSx: (kind: BarKind, heightPct: number) => SxProps<Theme>;
statsSx: SxProps<Theme>; statsSx: SxProps<Theme>;
@@ -26,7 +23,7 @@ const tone = (check: CheckSnapshot): Exclude<BarKind, "empty"> =>
check.status ? "up" : "down"; check.status ? "up" : "down";
export const ThemedHistogram = ({ export const ThemedHistogram = ({
checks, cells,
containerSx, containerSx,
barSx, barSx,
statsSx, statsSx,
@@ -34,45 +31,42 @@ export const ThemedHistogram = ({
}: Props) => { }: Props) => {
const { t } = useTranslation(); const { t } = useTranslation();
const { padded, heights, avg, peak } = useMemo(() => { const { avg, peak } = useMemo(() => {
const source = checks.slice(-CELLS); const valid = cells.filter((cell) => cell.responseTime > 0);
const out: (CheckSnapshot | null)[] = [ const maxRt = valid.length ? Math.max(...valid.map((cell) => cell.responseTime)) : 0;
...source,
...Array.from({ length: Math.max(0, CELLS - source.length) }, () => null),
];
const heights = computeBarHeights(source);
const valid = out.filter((c): c is CheckSnapshot => c !== null && c.responseTime > 0);
const maxRt = valid.length ? Math.max(...valid.map((c) => c.responseTime)) : 0;
const avgRt = valid.length const avgRt = valid.length
? valid.reduce((s, c) => s + c.responseTime, 0) / valid.length ? valid.reduce((sum, cell) => sum + cell.responseTime, 0) / valid.length
: 0; : 0;
return { padded: out, heights, avg: formatMs(avgRt), peak: formatMs(maxRt) }; return { avg: formatMs(avgRt), peak: formatMs(maxRt) };
}, [checks]); }, [cells]);
return ( return (
<Stack gap={statsGap}> <Stack gap={statsGap}>
<Box sx={containerSx}> <Box
{padded.map((check, i) => { sx={[
if (!check) { ...(Array.isArray(containerSx) ? containerSx : [containerSx]),
{ gridTemplateColumns: `repeat(${cells.length}, 1fr)` },
]}
>
{cells.map((cell) => {
if (cell.barKind === "empty") {
return ( return (
<Box <Box
key={`empty-${i}`} key={cell.key}
sx={barSx("empty", MIN_HEIGHT_PCT)} sx={barSx("empty", cell.heightPct)}
/> />
); );
} }
const height = heights[i] ?? MIN_HEIGHT_PCT;
const tooltipContent = <ThemedChartTooltip check={check} />;
return ( return (
<Tooltip <Tooltip
key={check.id ?? i} key={cell.key}
title={tooltipContent} title={cell.tooltip}
arrow arrow
placement="top" placement="top"
> >
<Box <Box
sx={barSx(tone(check), height)} sx={barSx(cell.barKind, cell.heightPct)}
aria-label={formatMs(check.responseTime)} aria-label={cell.ariaLabel}
/> />
</Tooltip> </Tooltip>
); );
+7 -1
View File
@@ -1,4 +1,9 @@
import type { GroupedCheck, CheckSnapshot, GroupedUptimeCheck } from "@/Types/Check"; import type {
GroupedCheck,
CheckSnapshot,
GroupedUptimeCheck,
DailyCheckBucket,
} from "@/Types/Check";
import type { PageSpeedGroupedCheck } from "@/Types/Check"; import type { PageSpeedGroupedCheck } from "@/Types/Check";
import type { GeoContinent } from "@/Types/GeoCheck"; import type { GeoContinent } from "@/Types/GeoCheck";
export type { GeoContinent } from "@/Types/GeoCheck"; export type { GeoContinent } from "@/Types/GeoCheck";
@@ -149,6 +154,7 @@ export interface Monitor {
dnsServer?: string; dnsServer?: string;
dnsRecordType?: DnsRecordType; dnsRecordType?: DnsRecordType;
recentChecks: CheckSnapshot[]; recentChecks: CheckSnapshot[];
dailyChecks?: DailyCheckBucket[];
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
} }
+11 -5
View File
@@ -24,13 +24,16 @@ export const STATUS_PAGE_THEME_MODES = ["auto", "light", "dark"] as const;
export type StatusPageThemeMode = (typeof STATUS_PAGE_THEME_MODES)[number]; export type StatusPageThemeMode = (typeof STATUS_PAGE_THEME_MODES)[number];
export const DEFAULT_STATUS_PAGE_THEME_MODE: StatusPageThemeMode = "auto"; export const DEFAULT_STATUS_PAGE_THEME_MODE: StatusPageThemeMode = "auto";
export const STATUS_PAGE_RANGES = ["latest", "30d", "60d", "90d"] as const; export const STATUS_PAGE_DAY_RANGES = ["30d", "60d", "90d"] as const;
export type StatusPageDayRange = (typeof STATUS_PAGE_DAY_RANGES)[number];
export const STATUS_PAGE_RANGES = ["latest", ...STATUS_PAGE_DAY_RANGES] as const;
export type StatusPageRange = (typeof STATUS_PAGE_RANGES)[number]; export type StatusPageRange = (typeof STATUS_PAGE_RANGES)[number];
export const STATUS_PAGE_RANGE_DAYS: Record< export const STATUS_PAGE_RANGE_DAYS: Record<StatusPageDayRange, number> = {
Exclude<StatusPageRange, "latest">, "30d": 30,
number "60d": 60,
> = { "30d": 30, "60d": 60, "90d": 90 }; "90d": 90,
};
export const isStatusPageRange = (value: string | null): value is StatusPageRange => export const isStatusPageRange = (value: string | null): value is StatusPageRange =>
STATUS_PAGE_RANGES.some((range) => range === value); STATUS_PAGE_RANGES.some((range) => range === value);
@@ -78,4 +81,7 @@ export interface StatusPage {
export interface StatusPageResponse { export interface StatusPageResponse {
statusPage: StatusPage; statusPage: StatusPage;
monitors: Monitor[]; monitors: Monitor[];
range?: StatusPageDayRange; // present only when range !== "latest"
bucketTimezone?: string;
checkTTLDays?: number;
} }
+7
View File
@@ -1442,6 +1442,13 @@
}, },
"statusPages": { "statusPages": {
"deleteSuccess": "Status page deleted successfully", "deleteSuccess": "Status page deleted successfully",
"rangeSelectorAria": "History range",
"range": {
"latest": "Latest",
"30d": "30 days",
"60d": "60 days",
"90d": "90 days"
},
"fallback": { "fallback": {
"title": "No status pages yet", "title": "No status pages yet",
"description": "Publish a public page that shows real-time uptime and incident history to your customers and stakeholders.", "description": "Publish a public page that shows real-time uptime and incident history to your customers and stakeholders.",