From 563e4376109865eab6a2c757247254b7f1a53640 Mon Sep 17 00:00:00 2001 From: laurenashleigh Date: Tue, 21 Oct 2025 12:45:55 +0100 Subject: [PATCH] Add Condition section to panel --- .../components/AlertRuleDrawerForm.tsx | 20 +- .../components/RuleConditionSection.tsx | 261 ++++++++++++++++++ 2 files changed, 280 insertions(+), 1 deletion(-) create mode 100644 public/app/features/alerting/unified/components/RuleConditionSection.tsx diff --git a/public/app/features/alerting/unified/components/AlertRuleDrawerForm.tsx b/public/app/features/alerting/unified/components/AlertRuleDrawerForm.tsx index f15a192ce6a..001ec34bfc0 100644 --- a/public/app/features/alerting/unified/components/AlertRuleDrawerForm.tsx +++ b/public/app/features/alerting/unified/components/AlertRuleDrawerForm.tsx @@ -1,12 +1,16 @@ +import { css } from '@emotion/css'; import { FormProvider, useForm } from 'react-hook-form'; +import { GrafanaTheme2 } from '@grafana/data'; import { t } from '@grafana/i18n'; -import { Drawer } from '@grafana/ui'; +import { Drawer, useStyles2 } from '@grafana/ui'; import { RuleDefinitionSection } from 'app/features/alerting/unified/components/RuleDefinitionSection'; import { getDefaultFormValues } from '../rule-editor/formDefaults'; import { RuleFormType, RuleFormValues } from '../types/rule-form'; +import { RuleConditionSection } from './RuleConditionSection'; + export interface AlertRuleDrawerFormProps { isOpen: boolean; onClose: () => void; @@ -15,6 +19,7 @@ export interface AlertRuleDrawerFormProps { export function AlertRuleDrawerForm({ isOpen, onClose, title }: AlertRuleDrawerFormProps) { const methods = useForm({ defaultValues: getDefaultFormValues(RuleFormType.grafana) }); + const styles = useStyles2(getStyles); if (!isOpen) { return null; @@ -27,7 +32,20 @@ export function AlertRuleDrawerForm({ isOpen, onClose, title }: AlertRuleDrawerF > +