diff --git a/frontend/src/components/settings/WebhooksSection.tsx b/frontend/src/components/settings/WebhooksSection.tsx index 7e305783..2617a23c 100644 --- a/frontend/src/components/settings/WebhooksSection.tsx +++ b/frontend/src/components/settings/WebhooksSection.tsx @@ -5,6 +5,7 @@ import { TogglePill } from '@/components/ui/toggle-pill'; import { Skeleton } from '@/components/ui/skeleton'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'; import { toast } from '@/components/ui/toast-store'; +import { useAuth } from '@/context/AuthContext'; import { useNodes } from '@/context/NodeContext'; import { apiFetch } from '@/lib/api'; import { copyToClipboard } from '@/lib/clipboard'; @@ -42,6 +43,7 @@ interface WebhookExecution { } export function WebhooksSection({ isPaid }: { isPaid: boolean }) { + const { isAdmin } = useAuth(); const { activeNode, nodes } = useNodes(); const [webhooks, setWebhooks] = useState([]); const [loading, setLoading] = useState(true); @@ -72,6 +74,7 @@ export function WebhooksSection({ isPaid }: { isPaid: boolean }) { }; useEffect(() => { fetchWebhooks(); fetchStacks(); }, [activeNode?.id]); + useEffect(() => { if (!isAdmin) setShowForm(false); }, [isAdmin]); const enabledCount = webhooks.filter(w => w.enabled).length; useMastheadStats( @@ -159,13 +162,15 @@ export function WebhooksSection({ isPaid }: { isPaid: boolean }) { return (
-
- setShowForm(!showForm)}> - Create webhook - -
+ {isAdmin && ( +
+ setShowForm(!showForm)}> + Create webhook + +
+ )} - {showForm && ( + {isAdmin && showForm && ( setFormName(e.target.value)} /> @@ -240,7 +245,9 @@ export function WebhooksSection({ isPaid }: { isPaid: boolean }) { } title="No webhooks yet" - subtitle="Create one to trigger stack actions from CI/CD." + subtitle={isAdmin + ? 'Create one to trigger stack actions from CI/CD.' + : 'An admin operator can create webhooks for this instance.'} /> )} @@ -269,10 +276,18 @@ export function WebhooksSection({ isPaid }: { isPaid: boolean }) {
- handleToggle(wh.id!, c)} /> - + {isAdmin ? ( + <> + handleToggle(wh.id!, c)} /> + + + ) : ( + + {wh.enabled ? 'On' : 'Off'} + + )}
diff --git a/frontend/src/components/settings/registry.ts b/frontend/src/components/settings/registry.ts index 502de5e2..acad18a8 100644 --- a/frontend/src/components/settings/registry.ts +++ b/frontend/src/components/settings/registry.ts @@ -159,8 +159,8 @@ export const SETTINGS_ITEMS: readonly SettingsItemMeta[] = [ id: 'webhooks', group: 'alerts', label: 'Webhooks', - description: 'Outbound HTTP hooks to Slack, Discord, Teams, or custom endpoints.', - keywords: ['slack', 'discord', 'teams', 'webhook', 'outbound'], + description: 'Incoming HMAC-signed HTTP triggers that run stack actions from CI/CD pipelines.', + keywords: ['webhook', 'incoming', 'trigger', 'ci', 'cd', 'pipeline', 'deploy', 'hmac', 'signature', 'action'], tier: 'skipper', scope: 'global', hiddenOnRemote: true,