feat: fold traefik into the service widget type, remove the dedicated one
Traefik gets the same treatment as the other six services now instead of a bespoke widget type: docker health merged with a single "Routes" stat, via the same internal container-to-container API call (http://traefik:8080/api/http/routers) it already used. No auth needed, same as before. Deleted lib/collectors/traefik.ts, lib/types/traefik-result.ts, and components/widgets/traefik/ entirely - the generic service Widget.tsx and ServiceWidgetResult shape cover it with zero new component code.
This commit is contained in:
+7
-10
@@ -58,15 +58,6 @@ export const httpWidgetSchema = z.object({
|
||||
.default({ status: 200 }),
|
||||
});
|
||||
|
||||
export const traefikWidgetSchema = z.object({
|
||||
type: z.literal("traefik"),
|
||||
name: z.string().default("Traefik"),
|
||||
apiUrl: z.string().url(),
|
||||
href: z.string().url().optional(),
|
||||
icon: z.string().optional(),
|
||||
interval: durationSchema.default("15s"),
|
||||
});
|
||||
|
||||
const serviceCommonFields = {
|
||||
type: z.literal("service") as z.ZodLiteral<"service">,
|
||||
name: z.string(),
|
||||
@@ -116,6 +107,11 @@ export const headscaleServiceWidgetSchema = z.object({
|
||||
apiToken: z.string(),
|
||||
});
|
||||
|
||||
export const traefikServiceWidgetSchema = z.object({
|
||||
...serviceCommonFields,
|
||||
service: z.literal("traefik"),
|
||||
});
|
||||
|
||||
export const serviceWidgetSchema = z.discriminatedUnion("service", [
|
||||
giteaServiceWidgetSchema,
|
||||
coolifyServiceWidgetSchema,
|
||||
@@ -123,6 +119,7 @@ export const serviceWidgetSchema = z.discriminatedUnion("service", [
|
||||
n8nServiceWidgetSchema,
|
||||
umamiServiceWidgetSchema,
|
||||
headscaleServiceWidgetSchema,
|
||||
traefikServiceWidgetSchema,
|
||||
]);
|
||||
|
||||
export const widgetSchema = z.discriminatedUnion("type", [
|
||||
@@ -132,7 +129,6 @@ export const widgetSchema = z.discriminatedUnion("type", [
|
||||
databaseWidgetSchema,
|
||||
systemWidgetSchema,
|
||||
httpWidgetSchema,
|
||||
traefikWidgetSchema,
|
||||
serviceWidgetSchema,
|
||||
]);
|
||||
|
||||
@@ -194,3 +190,4 @@ export type ImmichServiceWidget = z.infer<typeof immichServiceWidgetSchema>;
|
||||
export type N8nServiceWidget = z.infer<typeof n8nServiceWidgetSchema>;
|
||||
export type UmamiServiceWidget = z.infer<typeof umamiServiceWidgetSchema>;
|
||||
export type HeadscaleServiceWidget = z.infer<typeof headscaleServiceWidgetSchema>;
|
||||
export type TraefikServiceWidget = z.infer<typeof traefikServiceWidgetSchema>;
|
||||
|
||||
Reference in New Issue
Block a user