game
This commit is contained in:
1 parent
206c5577a6
commit
791b9fc7a2
4 files changed
+21
-3
No files matched your search
@@ -6,7 +6,7 @@ import useMediaQuery from "@mui/material/useMediaQuery";
|
|||||||
import type { MonitorType } from "@/Types/Monitor";
|
import type { MonitorType } from "@/Types/Monitor";
|
||||||
import { Typography, useTheme } from "@mui/material";
|
import { Typography, useTheme } from "@mui/material";
|
||||||
|
|
||||||
const types = ["http", "ping", "port", "docker"];
|
const types = ["http", "ping", "port", "docker", "game"];
|
||||||
const statuses = ["up", "down"];
|
const statuses = ["up", "down"];
|
||||||
const states = ["active", "paused"];
|
const states = ["active", "paused"];
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ import {
|
|||||||
} from "@/Components/v2/inputs";
|
} from "@/Components/v2/inputs";
|
||||||
import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi";
|
import { useGet, usePost, usePatch, useDelete } from "@/Hooks/UseApi";
|
||||||
import { useMonitorForm } from "@/Hooks/useMonitorForm";
|
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 { Notification } from "@/Types/Notification";
|
||||||
import type { MonitorFormData } from "@/Validation/monitor";
|
import type { MonitorFormData } from "@/Validation/monitor";
|
||||||
|
|
||||||
@@ -146,6 +146,8 @@ const CreateMonitorPage = () => {
|
|||||||
|
|
||||||
// Fetch notifications for the team
|
// Fetch notifications for the team
|
||||||
const { data: notifications } = useGet<Notification[]>("/notifications/team");
|
const { data: notifications } = useGet<Notification[]>("/notifications/team");
|
||||||
|
// Fetch games for game type monitors
|
||||||
|
const { data: games } = useGet<GamesMap>("/monitors/games");
|
||||||
|
|
||||||
const { schema, defaults } = useMonitorForm({
|
const { schema, defaults } = useMonitorForm({
|
||||||
data: existingMonitor ?? null,
|
data: existingMonitor ?? null,
|
||||||
@@ -357,6 +359,12 @@ const CreateMonitorPage = () => {
|
|||||||
error={!!fieldState.error}
|
error={!!fieldState.error}
|
||||||
>
|
>
|
||||||
<MenuItem value="">Select a game</MenuItem>
|
<MenuItem value="">Select a game</MenuItem>
|
||||||
|
{games &&
|
||||||
|
Object.entries(games).map(([key, game]) => (
|
||||||
|
<MenuItem key={key} value={key}>
|
||||||
|
{game.name}
|
||||||
|
</MenuItem>
|
||||||
|
))}
|
||||||
</Select>
|
</Select>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ const UptimeMonitorsPage = () => {
|
|||||||
|
|
||||||
// Default to all types when none selected
|
// Default to all types when none selected
|
||||||
const effectiveTypes =
|
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
|
// Build URL for monitors with checks
|
||||||
const monitorsWithChecksUrl = useMemo(() => {
|
const monitorsWithChecksUrl = useMemo(() => {
|
||||||
|
|||||||
@@ -156,3 +156,13 @@ export interface HardwareDetailsResponse {
|
|||||||
stats: HardwareStats;
|
stats: HardwareStats;
|
||||||
monitorStats: MonitorStats | null;
|
monitorStats: MonitorStats | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export interface Game {
|
||||||
|
name: string;
|
||||||
|
options?: {
|
||||||
|
port?: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
export type GamesMap = Record<string, Game>;
|
||||||
Reference in new issue
Block a user