Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Remove duplicate webhook template type

rcourtman4cfb56dc27d9
diff --git a/docs/release-control/v6/internal/subsystems/alerts.md b/docs/release-control/v6/internal/subsystems/alerts.md
index aca91bb3e8..6d2d59d10c 100644
--- a/docs/release-control/v6/internal/subsystems/alerts.md
+++ b/docs/release-control/v6/internal/subsystems/alerts.md
@@ -72,6 +72,8 @@ normalization fork.
The alert webhook service chooser also now derives its service set from the
backend webhook template registry, rather than keeping a second frontend-only
list of services, labels, descriptions, and mention-copy metadata.
+The WebhookConfig editor now imports the shared webhook template API type
+directly so it does not retain a local duplicate shape for chooser metadata.
Frontend alert surfaces and backend alert-support files now require explicit
registry path-policy coverage, so new alert-owned runtime files must be mapped
diff --git a/frontend-modern/src/components/Alerts/WebhookConfig.test.tsx b/frontend-modern/src/components/Alerts/WebhookConfig.test.tsx
index 5358ca4277..d30f55a190 100644
--- a/frontend-modern/src/components/Alerts/WebhookConfig.test.tsx
+++ b/frontend-modern/src/components/Alerts/WebhookConfig.test.tsx
@@ -20,7 +20,7 @@ vi.mock('@/utils/logger', () => ({
import { WebhookConfig } from './WebhookConfig';
import { logger } from '@/utils/logger';
-import type { Webhook } from '@/api/notifications';
+import type { Webhook, WebhookTemplate } from '@/api/notifications';
// --- Helpers ---
@@ -37,7 +37,7 @@ function makeWebhook(overrides: Partial<Webhook> = {}): Webhook {
};
}
-const discordTemplate = {
+const discordTemplate: WebhookTemplate = {
service: 'discord',
label: 'Discord',
mentionPlaceholder: '@everyone or <@USER_ID> or <@&ROLE_ID>',
@@ -51,7 +51,7 @@ const discordTemplate = {
instructions: 'Go to Server Settings → Integrations → Webhooks → New Webhook.',
};
-const slackTemplate = {
+const slackTemplate: WebhookTemplate = {
service: 'slack',
label: 'Slack',
mentionPlaceholder: '@channel, @here, or <@USER_ID>',
@@ -65,7 +65,7 @@ const slackTemplate = {
instructions: 'Create an incoming webhook in your Slack workspace.',
};
-const genericTemplate = {
+const genericTemplate: WebhookTemplate = {
service: 'generic',
label: 'Generic',
name: 'Generic Webhook',
@@ -77,7 +77,7 @@ const genericTemplate = {
instructions: '',
};
-const pushoverTemplate = {
+const pushoverTemplate: WebhookTemplate = {
service: 'pushover',
label: 'Pushover',
name: 'Pushover',
@@ -89,7 +89,12 @@ const pushoverTemplate = {
instructions: 'Create an application at https://pushover.net/apps',
};
-const mockTemplates = [genericTemplate, discordTemplate, slackTemplate, pushoverTemplate];
+const mockTemplates: WebhookTemplate[] = [
+ genericTemplate,
+ discordTemplate,
+ slackTemplate,
+ pushoverTemplate,
+];
// --- Tests ---
describe('WebhookConfig', () => {
diff --git a/frontend-modern/src/components/Alerts/WebhookConfig.tsx b/frontend-modern/src/components/Alerts/WebhookConfig.tsx
index 578f39f343..4599d6fc1f 100644
--- a/frontend-modern/src/components/Alerts/WebhookConfig.tsx
+++ b/frontend-modern/src/components/Alerts/WebhookConfig.tsx
@@ -1,5 +1,5 @@
import { createSignal, createEffect, Show, For, Index } from 'solid-js';
-import { NotificationsAPI, Webhook } from '@/api/notifications';
+import { NotificationsAPI, Webhook, type WebhookTemplate } from '@/api/notifications';
import { logger } from '@/utils/logger';
import {
ALERT_WEBHOOK_ADD_LABEL,
@@ -51,18 +51,6 @@ import {
formCheckbox,
} from '@/components/shared/Form';
-interface WebhookTemplate {
- service: string;
- label?: string;
- name: string;
- description?: string;
- urlPattern: string;
- method: string;
- headers: Record<string, string>;
- payloadTemplate: string;
- instructions: string;
-}
-
interface WebhookConfigProps {
webhooks: Webhook[];
onAdd: (webhook: Omit<Webhook, 'id'>) => void;
diff --git a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
index 3fa029f089..79da25ee18 100644
--- a/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
+++ b/frontend-modern/src/utils/__tests__/frontendResourceTypeBoundaries.test.ts
@@ -2996,6 +2996,7 @@ describe('frontend resource type boundaries', () => {
expect(webhookConfigSource).not.toContain('Optional — tag users or groups');
expect(webhookConfigSource).not.toContain('getAlertWebhookMentionPlaceholder(');
expect(webhookConfigSource).not.toContain('getAlertWebhookMentionHelp(');
+ expect(webhookConfigSource).not.toContain('interface WebhookTemplate');
expect(webhookConfigSource).not.toContain('Your Pushover application token');
expect(webhookConfigSource).not.toContain('Primary user key or group key');
expect(webhookConfigSource).not.toContain('app_token');