SigNoz is an open-source, OpenTelemetry-native observability platform for your team and their AI agents. Get logs, metrics, and traces in one tool with features like APM, distributed tracing, log management, infra monitoring, etc. Combined with SigNoz MCP and a native AI teammate (in SigNoz Cloud) it helps you build more resilient apps.
TypeScript apmapplication-monitoringdistributed-tracinggogood-first-issuejaegerloglogsmetricsmonitoringnextjsobservabilityopen-sourceopentelemetryprometheusreactreactjsself-hostedtracingtypescript
feat(planned-downtime): explicit toggle for all vs specific alert rules (#11272)
Jatinderjit Singha3a7fc4081ed
diff --git a/frontend/src/container/PlannedDowntime/PlannedDowntime.styles.scss b/frontend/src/container/PlannedDowntime/PlannedDowntime.styles.scssindex f60783020d..c22ef03129 100644--- a/frontend/src/container/PlannedDowntime/PlannedDowntime.styles.scss+++ b/frontend/src/container/PlannedDowntime/PlannedDowntime.styles.scss@@ -81,6 +81,20 @@}}+ .alert-rule-scope {+ margin-bottom: 12px;++ .ant-radio-wrapper {+ color: var(--l1-foreground);+ }+ }++ .alert-rule-all-warning {+ font-size: 12px;+ font-weight: 400;+ color: var(--l2-foreground);+ }+.formItemWithBullet {margin-bottom: 0;}diff --git a/frontend/src/container/PlannedDowntime/PlannedDowntimeForm.tsx b/frontend/src/container/PlannedDowntime/PlannedDowntimeForm.tsxindex 17f6bb5468..2039f56099 100644--- a/frontend/src/container/PlannedDowntime/PlannedDowntimeForm.tsx+++ b/frontend/src/container/PlannedDowntime/PlannedDowntimeForm.tsx@@ -8,6 +8,7 @@ import {FormInstance,Input,Modal,+ Radio,Select,SelectProps,Spin,@@ -71,11 +72,14 @@ const TZ_OPTIONS: DefaultOptionType[] = ALL_TIME_ZONES.map(}),);+type AlertRuleScope = 'all' | 'specific';+interface PlannedDowntimeFormData {name: string;startTime: dayjs.Dayjs | null;endTime: dayjs.Dayjs | null;recurrence?: AlertmanagertypesRecurrenceDTO;+ alertRuleScope: AlertRuleScope;alertRules: DefaultOptionType[];recurrenceSelect?: AlertmanagertypesRecurrenceDTO;timezone?: string;@@ -129,6 +133,12 @@ export function PlannedDowntimeForm(recurrenceOptions.doesNotRepeat.value,);+ const [alertRuleScope, setAlertRuleScope] = useState<AlertRuleScope>(+ initialValues.id && (initialValues.alertIds || []).length === 0+ ? 'all'+ : 'specific',+ );+const { notifications } = useNotifications();const { showErrorModal } = useErrorModal();@@ -142,9 +152,12 @@ export function PlannedDowntimeForm(const saveHandler = useCallback(async (values: PlannedDowntimeFormData) => {const data: AlertmanagertypesPostablePlannedMaintenanceDTO = {- alertIds: values.alertRules- .map((alert) => alert.value)- .filter((alert) => alert !== undefined) as string[],+ alertIds:+ values.alertRuleScope === 'all'+ ? []+ : (values.alertRules+ .map((alert) => alert.value)+ .filter((alert) => alert !== undefined) as string[]),name: values.name,scope: values.scope,schedule: {@@ -265,12 +278,13 @@ export function PlannedDowntimeForm(const startTime = schedule?.recurrence?.startTime || schedule?.startTime;const endTime = schedule?.recurrence?.endTime || schedule?.endTime;+ const initialAlertIds = initialValues.alertIds || [];+return {name: defaultTo(initialValues.name, ''),- alertRules: getAlertOptionsFromIds(- initialValues.alertIds || [],- alertOptions,- ),+ alertRuleScope:+ isEditMode && initialAlertIds.length === 0 ? 'all' : 'specific',+ alertRules: getAlertOptionsFromIds(initialAlertIds, alertOptions),startTime: startTime ? dayjs(startTime).tz(schedule.timezone) : null,endTime: endTime ? dayjs(endTime).tz(schedule.timezone) : null,recurrence: {@@ -287,6 +301,7 @@ export function PlannedDowntimeForm(useEffect(() => {setSelectedTags(formattedInitialValues.alertRules);+ setAlertRuleScope(formattedInitialValues.alertRuleScope);form.setFieldsValue({ ...formattedInitialValues });}, [form, formattedInitialValues, initialValues]);@@ -349,6 +364,7 @@ export function PlannedDowntimeForm(onFinish={onFinish}onValuesChange={(): void => {setRecurrenceType(form.getFieldValue('recurrence')?.repeatType as string);+ setAlertRuleScope(form.getFieldValue('alertRuleScope') as AlertRuleScope);handleFormData(form.getFieldsValue());}}autoComplete="off"@@ -448,49 +464,76 @@ export function PlannedDowntimeForm(<div className="scheduleTimeInfoText">{endTimeText}</div>)}<div>- <div className="alert-rule-form">- <Typography style={{ marginBottom: 8 }}>Silence Alerts</Typography>- <Typography style={{ marginBottom: 8 }} className="alert-rule-info">- (Leave empty to silence all alerts)- </Typography>- </div>- <Form.Item noStyle shouldUpdate>- <AlertRuleTags- closable- selectedTags={selectedTags}- handleClose={handleClose}- />- </Form.Item>- <Form.Item name={alertRuleFormName}>- <Select- placeholder="Search for alerts rules or groups..."- mode="multiple"- status={isError ? 'error' : undefined}- loading={isLoading}- tagRender={noTagRenderer}- onChange={handleAlertRulesChange}- showSearch- options={alertOptions}- filterOption={(input, option): boolean =>- (option?.label as string)?.toLowerCase()?.includes(input.toLowerCase())- }- notFoundContent={- isLoading ? (- <span>- <Spin size="small" /> Loading...- </span>- ) : (- <span>No alert available.</span>- )- }- >- {alertOptions?.map((option) => (- <Select.Option key={option.value} value={option.value}>- {option.label}- </Select.Option>- ))}- </Select>+ <Typography style={{ marginBottom: 8 }}>Silence Alerts</Typography>+ <Form.Item+ name="alertRuleScope"+ initialValue="specific"+ className="alert-rule-scope"+ >+ <Radio.Group>+ <Radio value="all">All alert rules</Radio>+ <Radio value="specific">Specific alert rules</Radio>+ </Radio.Group></Form.Item>+ {alertRuleScope === 'specific' && (+ <>+ <Form.Item noStyle shouldUpdate>+ <AlertRuleTags+ closable+ selectedTags={selectedTags}+ handleClose={handleClose}+ />+ </Form.Item>+ <Form.Item+ name={alertRuleFormName}+ rules={[+ {+ validator: async (+ _rule,+ value: DefaultOptionType[] | undefined,+ ): Promise<void> => {+ if (!value || value.length === 0) {+ throw new Error(+ 'Select at least one alert rule, or choose "All alert rules" to silence everything.',+ );+ }+ },+ },+ ]}+ >+ <Select+ placeholder="Search for alert rules or groups..."+ mode="multiple"+ status={isError ? 'error' : undefined}+ loading={isLoading}+ tagRender={noTagRenderer}+ onChange={handleAlertRulesChange}+ showSearch+ options={alertOptions}+ filterOption={(input, option): boolean =>+ (option?.label as string)+ ?.toLowerCase()+ ?.includes(input.toLowerCase())+ }+ notFoundContent={+ isLoading ? (+ <span>+ <Spin size="small" /> Loading...+ </span>+ ) : (+ <span>No alert available.</span>+ )+ }+ >+ {alertOptions?.map((option) => (+ <Select.Option key={option.value} value={option.value}>+ {option.label}+ </Select.Option>+ ))}+ </Select>+ </Form.Item>+ </>+ )}</div><Form.Itemlabel={diff --git a/frontend/src/container/PlannedDowntime/PlannedDowntimeList.tsx b/frontend/src/container/PlannedDowntime/PlannedDowntimeList.tsxindex 9a483d8029..a0a229a586 100644--- a/frontend/src/container/PlannedDowntime/PlannedDowntimeList.tsx+++ b/frontend/src/container/PlannedDowntime/PlannedDowntimeList.tsx@@ -204,7 +204,7 @@ export function CollapseListContent({selectedTags={alertOptions}/>) : (- '-'+ <Tag className="all-alerts-tag">All alert rules</Tag>),)}</Flex>