U 优化创建监控项的提示信息

pull/462/head
vapao 2022-03-12 12:53:10 +08:00
parent 6230416015
commit b1adf5ad64
3 changed files with 12 additions and 6 deletions

View File

@ -42,7 +42,7 @@ export default observer(function () {
store.record.type = v;
store.record.targets = [];
store.record.extra = undefined;
};
}
function handleAddGroup() {
Modal.confirm({

View File

@ -4,6 +4,7 @@
* Released under the AGPL-3.0 License.
*/
import React, { useState, useEffect } from 'react';
import { Link } from 'react-router-dom';
import { observer } from 'mobx-react';
import { Form, Select, Radio, Transfer, Checkbox, Button, message } from 'antd';
import { http } from 'libs';
@ -39,6 +40,7 @@ export default observer(function () {
http.post('/api/monitor/', formData)
.then(() => {
message.success('操作成功');
store.record = {};
store.formVisible = false;
store.fetchRecords()
}, () => setLoading(false))
@ -52,7 +54,7 @@ export default observer(function () {
const info = store.record;
return (
<Form form={form} labelCol={{span: 6}} wrapperCol={{span: 14}}>
<Form.Item name="rate" initialValue={info.rate || 5} label="监控频率">
<Form.Item name="rate" initialValue={info.rate || 5} label="监控频率" tooltip="每隔N分钟检测一次">
<Radio.Group>
<Radio value={1}>1分钟</Radio>
<Radio value={5}>5分钟</Radio>
@ -61,7 +63,7 @@ export default observer(function () {
<Radio value={60}>60分钟</Radio>
</Radio.Group>
</Form.Item>
<Form.Item name="threshold" initialValue={info.threshold || 3} label="报警阈值">
<Form.Item name="threshold" initialValue={info.threshold || 3} label="报警阈值" tooltip="连续N次检测失败则发送告警">
<Radio.Group>
<Radio value={1}>1</Radio>
<Radio value={2}>2</Radio>
@ -70,7 +72,8 @@ export default observer(function () {
<Radio value={5}>5</Radio>
</Radio.Group>
</Form.Item>
<Form.Item required name="notify_grp" valuePropName="targetKeys" initialValue={info.notify_grp} label="报警联系人组">
<Form.Item required name="notify_grp" valuePropName="targetKeys" initialValue={info.notify_grp} label="报警联系人组"
extra={<>去创建 <Link to="/alarm/contact">报警联系人</Link> <Link to="/alarm/group"></Link></>}>
<Transfer
lazy={false}
rowKey={item => item.id}

View File

@ -50,9 +50,12 @@ class Store {
};
showForm = (info) => {
info = info || {type: '1', targets: []};
if (info) {
this.record = lds.cloneDeep(info)
} else if (this.record.id || !this.record.type) {
this.record = {type: '1', targets: []}
}
this.page = 0;
this.record = lds.cloneDeep(info);
this.formVisible = true;
}
}