Skip to content

Commit

Permalink
feat: 告警策略增加留观时长
Browse files Browse the repository at this point in the history
  • Loading branch information
guguji5 committed Jan 29, 2022
1 parent 98a948b commit 3ae3da1
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/pages/warning/strategy/components/editModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,11 @@ const fields = [
field: 'notify_repeat_step',
name: '重复发送频率',
},
{
id: 15,
field: 'recover_duration',
name: '留观时长',
},
{
id: 11,
field: 'callbacks',
Expand Down Expand Up @@ -476,6 +481,33 @@ const editModal: React.FC<Props> = ({ isModalVisible, editModalFinish }) => {
</Form.Item>
</>
);
case 'recover_duration':
return (
<>
<Form.Item label={t('改为:')}>
<Space>
<Form.Item
style={{ marginBottom: 0 }}
name='recover_duration'
initialValue={0}
wrapperCol={{ span: 10 }}
rules={[
{
required: false,
message: t('留观时长不能为空'),
},
]}
>
<InputNumber min={0} />
</Form.Item>
分钟
<Tooltip title={t(`持续${form.getFieldValue('recover_duration')}秒没有再次触发阈值才发送恢复通知`)}>
<QuestionCircleFilled />
</Tooltip>
</Space>
</Form.Item>
</>
);
case 'notify_repeat_step':
return (
<>
Expand Down
13 changes: 12 additions & 1 deletion src/pages/warning/strategy/components/operateForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ const operateForm: React.FC<Props> = ({ type, detail = {} }) => {
enable_time: detail?.enable_stime ? [moment(detail.enable_stime, 'HH:mm'), moment(detail.enable_etime, 'HH:mm')] : [moment('00:00', 'HH:mm'), moment('23:59', 'HH:mm')],
enable_status: detail?.disabled === undefined ? true : !detail?.disabled,
notify_recovered: detail?.notify_recovered === 1 || detail?.notify_recovered === undefined ? true : false, // 1:启用 0:禁用
recover_duration: detail?.recover_duration || 0,
callbacks: !!detail?.callbacks
? detail.callbacks.map((item) => ({
url: item,
Expand Down Expand Up @@ -424,7 +425,17 @@ const operateForm: React.FC<Props> = ({ type, detail = {} }) => {
</Tooltip>
</Space>
</Form.Item>

<Form.Item label={t('留观时长')} required>
<Space>
<Form.Item style={{ marginBottom: 0 }} name='recover_duration' initialValue={0} wrapperCol={{ span: 10 }}>
<InputNumber min={0} />
</Form.Item>
分钟
<Tooltip title={t(`持续${form.getFieldValue('recover_duration')}秒没有再次触发阈值才发送恢复通知`)}>
<QuestionCircleFilled />
</Tooltip>
</Space>
</Form.Item>
<Form.Item label={t('重复发送频率')} required>
<Space>
<Form.Item
Expand Down

0 comments on commit 3ae3da1

Please sign in to comment.