From a7fb235c56a39f523bf62176668f6cf798dae302 Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Tue, 11 Aug 2026 17:24:03 -0700 Subject: [PATCH] fix monitor types --- client/src/Types/Monitor.ts | 11 ++++++++--- client/src/Types/StatusPage.ts | 17 +++-------------- 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/client/src/Types/Monitor.ts b/client/src/Types/Monitor.ts index bf5e4f170..ef328ebdb 100644 --- a/client/src/Types/Monitor.ts +++ b/client/src/Types/Monitor.ts @@ -35,9 +35,12 @@ export const SelectableMonitorTypes = [ export type SelectableMonitorType = (typeof SelectableMonitorTypes)[number]; // Irregular i18n key fragments shared by the type selector's label -// (pages.common.monitors.monitorTypes.) and description -// (pages.createMonitor.form.type.Description) keys. -export const monitorTypeLabelKey: Record = { +// (pages.common.monitors.monitorTypes.), its description +// (pages.createMonitor.form.type.Description), and status page +// type labels (via getMonitorTypeLabel). Covers every type with a label; +// only selectable types have description keys. +export const monitorTypeLabelKey: Record & + Partial> = { http: "optionHttp", ping: "optionPing", docker: "optionDocker", @@ -46,6 +49,8 @@ export const monitorTypeLabelKey: Record = { grpc: "optionGrpc", websocket: "optionWebSocket", dns: "optionDns", + hardware: "optionHardware", + pagespeed: "optionPagespeed", }; export const MonitorIntervalOptions = [ diff --git a/client/src/Types/StatusPage.ts b/client/src/Types/StatusPage.ts index bbe1f41f2..ea0db5292 100644 --- a/client/src/Types/StatusPage.ts +++ b/client/src/Types/StatusPage.ts @@ -1,24 +1,13 @@ +import { monitorTypeLabelKey } from "@/Types/Monitor"; import type { Monitor, MonitorType } from "@/Types/Monitor"; export type MonitorDisplayType = "uptime" | "infrastructure"; -export const MONITOR_TYPE_KEYS: Partial> = { - http: "pages.common.monitors.monitorTypes.optionHttp", - ping: "pages.common.monitors.monitorTypes.optionPing", - docker: "pages.common.monitors.monitorTypes.optionDocker", - port: "pages.common.monitors.monitorTypes.optionPort", - game: "pages.common.monitors.monitorTypes.optionGame", - grpc: "pages.common.monitors.monitorTypes.optionGrpc", - websocket: "pages.common.monitors.monitorTypes.optionWebSocket", - hardware: "pages.common.monitors.monitorTypes.optionHardware", - pagespeed: "pages.common.monitors.monitorTypes.optionPagespeed", -}; - export const getMonitorTypeLabel = ( type: MonitorType, t: (key: string) => string ): string => { - const key = MONITOR_TYPE_KEYS[type]; - return key ? t(key) : type; + const fragment = monitorTypeLabelKey[type]; + return fragment ? t(`pages.common.monitors.monitorTypes.${fragment}`) : type; }; export const STATUS_PAGE_THEMES = [