diff --git a/spug_web/src/pages/schedule/Step3.js b/spug_web/src/pages/schedule/Step3.js
index 65abf05..482e376 100644
--- a/spug_web/src/pages/schedule/Step3.js
+++ b/spug_web/src/pages/schedule/Step3.js
@@ -17,15 +17,21 @@ import S from './store';
import styles from './index.module.less';
export default observer(function (props) {
- const [visible, setVisible] = useState(false)
const [loading, setLoading] = useState(false)
function handleSubmit() {
- setLoading(true)
const formData = lds.pick(S.record, ['id', 'name', 'type', 'interpreter', 'command', 'desc', 'rst_notify']);
formData['targets'] = S.targets.filter(x => x);
formData['trigger'] = S.trigger;
formData['trigger_args'] = _parse_args();
+ if (S.trigger === 'monitor') {
+ if (formData.targets.length > 1) {
+ return message.error('监控告警类触发器,只能选择一个执行对象')
+ }
+ } else if (formData.targets.includes('monitor')) {
+ return message.error('执行对象选择有误,请重新选择')
+ }
+ setLoading(true)
http.post('/api/schedule/', formData)
.then(res => {
message.success('操作成功');
@@ -52,6 +58,13 @@ export default observer(function (props) {
}
}
+ function handleChange(_, ids) {
+ if (S.targets.includes('local')) {
+ ids.unshift('local')
+ }
+ S.targets = ids
+ }
+
return (
-
+ x !== 'local')} onChange={handleChange}>
+
+
- setVisible(false)}
- onOk={(_, ids) => S.targets = ids}/>
)
})
diff --git a/spug_web/src/pages/system/account/index.js b/spug_web/src/pages/system/account/index.js
index 449a3ed..d0a1ab5 100644
--- a/spug_web/src/pages/system/account/index.js
+++ b/spug_web/src/pages/system/account/index.js
@@ -3,7 +3,7 @@
* Copyright (c)
* Released under the AGPL-3.0 License.
*/
-import React from 'react';
+import React from 'react';
import { observer } from 'mobx-react';
import { Input } from 'antd';
import { SearchForm, AuthDiv, Breadcrumb } from 'components';