From 9834fe20c94b18ca1e2efa331a67e4dd2c66baab Mon Sep 17 00:00:00 2001 From: fuomag9 <1580624+fuomag9@users.noreply.github.com> Date: Fri, 6 Mar 2026 17:30:13 +0100 Subject: [PATCH] simplify global WAF settings: replace toggle+radio with single switch With DetectionOnly removed, the global WAF had two redundant controls: an Enable toggle and an Off/On radio, both doing the same thing. Collapse them into a single labelled switch. Mode is now derived from the enabled state in the action rather than being a separate form field. Co-Authored-By: Claude Sonnet 4.6 --- app/(dashboard)/settings/SettingsClient.tsx | 13 ++----------- app/(dashboard)/settings/actions.ts | 4 +--- 2 files changed, 3 insertions(+), 14 deletions(-) diff --git a/app/(dashboard)/settings/SettingsClient.tsx b/app/(dashboard)/settings/SettingsClient.tsx index cbdf68fd..91b48846 100644 --- a/app/(dashboard)/settings/SettingsClient.tsx +++ b/app/(dashboard)/settings/SettingsClient.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { useFormState } from "react-dom"; -import { Alert, Box, Button, Card, CardContent, Checkbox, Collapse, FormControl, FormControlLabel, FormLabel, MenuItem, Radio, RadioGroup, Stack, Switch, TextField, Typography } from "@mui/material"; +import { Alert, Box, Button, Card, CardContent, Checkbox, Collapse, FormControlLabel, MenuItem, Stack, Switch, TextField, Typography } from "@mui/material"; import ContentCopyIcon from "@mui/icons-material/ContentCopy"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import type { @@ -805,17 +805,8 @@ export default function SettingsClient({ )} } - label="Enable WAF globally" + label="Enable WAF globally (blocking)" /> - - - Engine Mode - - - } label="Off" /> - } label="On (Blocking)" /> - - } label={ diff --git a/app/(dashboard)/settings/actions.ts b/app/(dashboard)/settings/actions.ts index 15235d69..37f3c17c 100644 --- a/app/(dashboard)/settings/actions.ts +++ b/app/(dashboard)/settings/actions.ts @@ -695,9 +695,7 @@ export async function updateWafSettingsAction(_prevState: ActionResult | null, f await requireAdmin(); const enabled = formData.get("waf_enabled") === "on"; - const rawMode = formData.get("waf_mode"); - const mode: WafSettings["mode"] = - rawMode === "Off" ? "Off" : "On"; + const mode: WafSettings["mode"] = enabled ? "On" : "Off"; const loadOwasp = formData.get("waf_load_owasp_crs") === "on"; const customDirectives = typeof formData.get("waf_custom_directives") === "string" ? (formData.get("waf_custom_directives") as string).trim()