diff --git a/src/pages/alertRules/FormNG/components/SectionCard/index.tsx b/src/pages/alertRules/FormNG/components/SectionCard/index.tsx index 48692d420..96f1f6584 100644 --- a/src/pages/alertRules/FormNG/components/SectionCard/index.tsx +++ b/src/pages/alertRules/FormNG/components/SectionCard/index.tsx @@ -51,8 +51,10 @@ export default function SectionCard(props: { empty?: boolean; collapsed?: boolean; setCollapsed?: (collapsed: boolean) => void; + /** 收起状态下在标题右侧展示的配置摘要 */ + summary?: React.ReactNode; }) { - const { item, index, sectionRef, children, empty, setCollapsed: onSetCollapsed } = props; + const { item, index, sectionRef, children, empty, summary, setCollapsed: onSetCollapsed } = props; const { t, i18n } = useTranslation('alertRules'); const { darkMode } = useContext(CommonStateContext); const [collapsed, setCollapsed] = useState(props.collapsed ?? item.tag === 'optional'); @@ -113,6 +115,7 @@ export default function SectionCard(props: { )} + {collapsed && summary &&
{summary}
}
diff --git a/src/pages/warning/shield/add.tsx b/src/pages/warning/shield/add.tsx index 2632492a3..5355c9cca 100644 --- a/src/pages/warning/shield/add.tsx +++ b/src/pages/warning/shield/add.tsx @@ -52,8 +52,8 @@ const AddShield: React.FC = () => { }); } catch (e) {} } + // 不预填规则标题,交给表单按筛选条件自动生成 setEventDetail({ - note: t('quick_mute'), group_id: dat.group_id, prod: dat.rule_prod, cate: dat.cate, diff --git a/src/pages/warning/shield/components/DaysOfWeekSelect.tsx b/src/pages/warning/shield/components/DaysOfWeekSelect.tsx new file mode 100644 index 000000000..7219358ca --- /dev/null +++ b/src/pages/warning/shield/components/DaysOfWeekSelect.tsx @@ -0,0 +1,63 @@ +import React from 'react'; +import { Select, Divider, Space } from 'antd'; +import { useTranslation } from 'react-i18next'; +import _ from 'lodash'; + +import { daysOfWeek } from '@/pages/alertRules/constants'; + +interface Props { + value?: string[]; + onChange?: (value: string[]) => void; + disabled?: boolean; +} + +const PRESETS: { key: 'everyday' | 'workday' | 'weekend'; days: string[] }[] = [ + { key: 'everyday', days: ['1', '2', '3', '4', '5', '6', '0'] }, + { key: 'workday', days: ['1', '2', '3', '4', '5'] }, + { key: 'weekend', days: ['6', '0'] }, +]; + +/** + * 周期屏蔽的星期选择,下拉底部提供「每天 / 工作日 / 周末」快捷选项 + */ +export default function DaysOfWeekSelect(props: Props) { + const { t } = useTranslation('alertMutes'); + const { value, onChange, disabled } = props; + + return ( + { - return { - label: item.name, - value: item.id, - }; - })} - showSearch - optionFilterProp='label' - /> - - - - - -