diff --git a/client/src/Components/v2/monitors/ControlsFilter.tsx b/client/src/Components/v2/monitors/ControlsFilter.tsx index 34eedd190..01802ee3f 100644 --- a/client/src/Components/v2/monitors/ControlsFilter.tsx +++ b/client/src/Components/v2/monitors/ControlsFilter.tsx @@ -6,7 +6,7 @@ import useMediaQuery from "@mui/material/useMediaQuery"; import type { MonitorType } from "@/Types/Monitor"; import { Typography, useTheme } from "@mui/material"; -const types = ["http", "ping", "port", "docker"]; +const types = ["http", "ping", "port", "docker", "game"]; const statuses = ["up", "down"]; const states = ["active", "paused"]; diff --git a/client/src/Pages/CreateMonitor/index.tsx b/client/src/Pages/CreateMonitor/index.tsx index d670fe41e..ef3f01f63 100644 --- a/client/src/Pages/CreateMonitor/index.tsx +++ b/client/src/Pages/CreateMonitor/index.tsx @@ -29,7 +29,7 @@ import { } from "@/Components/v2/inputs"; import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi"; import { useMonitorForm } from "@/Hooks/useMonitorForm"; -import type { Monitor, MonitorType } from "@/Types/Monitor"; +import type { Monitor, MonitorType, GamesMap } from "@/Types/Monitor"; import type { Notification } from "@/Types/Notification"; import type { MonitorFormData } from "@/Validation/monitor"; @@ -146,6 +146,8 @@ const CreateMonitorPage = () => { // Fetch notifications for the team const { data: notifications } = useGet("/notifications/team"); + // Fetch games for game type monitors + const { data: games } = useGet("/monitors/games"); const { schema, defaults } = useMonitorForm({ data: existingMonitor ?? null, @@ -357,6 +359,12 @@ const CreateMonitorPage = () => { error={!!fieldState.error} > Select a game + {games && + Object.entries(games).map(([key, game]) => ( + + {game.name} + + ))} )} /> diff --git a/client/src/Pages/Uptime/Monitors/index.tsx b/client/src/Pages/Uptime/Monitors/index.tsx index 5c3828d07..efd1a4d6e 100644 --- a/client/src/Pages/Uptime/Monitors/index.tsx +++ b/client/src/Pages/Uptime/Monitors/index.tsx @@ -70,7 +70,7 @@ const UptimeMonitorsPage = () => { // Default to all types when none selected const effectiveTypes = - selectedTypes.length > 0 ? selectedTypes : ["http", "ping", "docker", "port"]; + selectedTypes.length > 0 ? selectedTypes : ["http", "ping", "docker", "port", "game"]; // Build URL for monitors with checks const monitorsWithChecksUrl = useMemo(() => { diff --git a/client/src/Types/Monitor.ts b/client/src/Types/Monitor.ts index ddf44e56f..914ab798e 100644 --- a/client/src/Types/Monitor.ts +++ b/client/src/Types/Monitor.ts @@ -156,3 +156,13 @@ export interface HardwareDetailsResponse { stats: HardwareStats; monitorStats: MonitorStats | null; } + + +export interface Game { + name: string; + options?: { + port?: number; + }; +} + +export type GamesMap = Record;