Feat: Frontend - Add websocket to client types and validations
This commit is contained in:
1 parent
52b838a9eb
commit
df77ed1fc7
3 files changed
+11
No files matched your search
@@ -12,6 +12,7 @@ export const MonitorTypes = [
|
||||
"port",
|
||||
"game",
|
||||
"grpc",
|
||||
"websocket",
|
||||
"unknown",
|
||||
] as const;
|
||||
export type MonitorType = (typeof MonitorTypes)[number];
|
||||
|
||||
@@ -9,6 +9,7 @@ export const getMonitorPath = (type: MonitorType): string => {
|
||||
ping: "uptime",
|
||||
game: "uptime",
|
||||
grpc: "uptime",
|
||||
websocket: "uptime",
|
||||
unknown: "uptime",
|
||||
docker: "uptime",
|
||||
hardware: "infrastructure",
|
||||
|
||||
@@ -85,6 +85,13 @@ const grpcSchema = baseSchema.extend({
|
||||
ignoreTlsErrors: z.boolean(),
|
||||
});
|
||||
|
||||
// WebSocket monitor schema
|
||||
const websocketSchema = baseSchema.extend({
|
||||
type: z.literal("websocket"),
|
||||
url: z.string().min(1, "WebSocket URL is required"),
|
||||
ignoreTlsErrors: z.boolean(),
|
||||
});
|
||||
|
||||
// PageSpeed monitor schema
|
||||
const pagespeedSchema = baseSchema.extend({
|
||||
type: z.literal("pagespeed"),
|
||||
@@ -123,6 +130,7 @@ export const monitorSchema = z.discriminatedUnion("type", [
|
||||
dockerSchema,
|
||||
gameSchema,
|
||||
grpcSchema,
|
||||
websocketSchema,
|
||||
pagespeedSchema,
|
||||
hardwareSchema,
|
||||
]);
|
||||
@@ -137,6 +145,7 @@ export {
|
||||
dockerSchema,
|
||||
gameSchema,
|
||||
grpcSchema,
|
||||
websocketSchema,
|
||||
pagespeedSchema,
|
||||
hardwareSchema,
|
||||
};
|
||||
Reference in new issue
Block a user