server_actions.splice(index, 1)}>
@@ -94,7 +95,7 @@ class Ext2Setup3 extends React.Component {
width="100%"
height="100px"
value={item['data']}
- onChange={v => item['data'] = v}
+ onChange={v => item['data'] = cleanCommand(v)}
placeholder="请输入要执行的动作"/>
host_actions.splice(index, 1)}>
diff --git a/spug_web/src/pages/exec/task/index.js b/spug_web/src/pages/exec/task/index.js
index a11a3a2..6672c6c 100644
--- a/spug_web/src/pages/exec/task/index.js
+++ b/spug_web/src/pages/exec/task/index.js
@@ -10,8 +10,8 @@ import { ACEditor, AuthCard } from 'components';
import HostSelector from './HostSelector';
import TemplateSelector from './TemplateSelector';
import ExecConsole from './ExecConsole';
+import { http, cleanCommand } from 'libs';
import store from './store';
-import http from 'libs/http';
@observer
class TaskIndex extends React.Component {
@@ -26,7 +26,7 @@ class TaskIndex extends React.Component {
handleSubmit = () => {
this.setState({loading: true});
const host_ids = store.hosts.map(item => item.id);
- http.post('/api/exec/do/', {host_ids, command: this.state.body})
+ http.post('/api/exec/do/', {host_ids, command: cleanCommand(this.state.body)})
.then(store.switchConsole)
.finally(() => this.setState({loading: false}))
};
diff --git a/spug_web/src/pages/exec/template/Form.js b/spug_web/src/pages/exec/template/Form.js
index 413d51f..60925a7 100644
--- a/spug_web/src/pages/exec/template/Form.js
+++ b/spug_web/src/pages/exec/template/Form.js
@@ -7,7 +7,7 @@ import React from 'react';
import { observer } from 'mobx-react';
import { Modal, Form, Input, Select, Col, Button, message } from 'antd';
import { ACEditor } from 'components';
-import http from 'libs/http';
+import { http, cleanCommand } from 'libs';
import store from './store';
@observer
@@ -25,7 +25,7 @@ class ComForm extends React.Component {
this.setState({loading: true});
const formData = this.props.form.getFieldsValue();
formData['id'] = store.record.id;
- formData['body'] = this.state.body;
+ formData['body'] = cleanCommand(this.state.body);
http.post('/api/exec/template/', formData)
.then(res => {
message.success('操作成功');
diff --git a/spug_web/src/pages/monitor/Form.js b/spug_web/src/pages/monitor/Form.js
index 05a4d17..9c1609e 100644
--- a/spug_web/src/pages/monitor/Form.js
+++ b/spug_web/src/pages/monitor/Form.js
@@ -8,7 +8,7 @@ import { observer } from 'mobx-react';
import { Modal, Form, Input, Select, Radio, message, Steps, Button, Transfer, Checkbox } from 'antd';
import TemplateSelector from '../exec/task/TemplateSelector';
import { LinkButton, ACEditor } from 'components';
-import http from 'libs/http';
+import { http, cleanCommand } from 'libs';
import store from './store';
import hostStore from '../host/store';
import groupStore from '../alarm/group/store';
@@ -158,7 +158,7 @@ class ComForm extends React.Component {
this.setState({showTmp: true})}>从模板添加}>
- this.handleExtra('4', e)}/>
+ this.handleExtra('4', cleanCommand(e))}/>
{getFieldDecorator('desc', {initialValue: info['desc']})(
diff --git a/spug_web/src/pages/schedule/Form.js b/spug_web/src/pages/schedule/Form.js
index a8149f1..37a4780 100644
--- a/spug_web/src/pages/schedule/Form.js
+++ b/spug_web/src/pages/schedule/Form.js
@@ -8,7 +8,7 @@ import { observer } from 'mobx-react';
import { Modal, Form, Input, Select, Col, Button, Steps, Tabs, InputNumber, DatePicker, Icon, message } from 'antd';
import { LinkButton, ACEditor } from 'components';
import TemplateSelector from '../exec/task/TemplateSelector';
-import http from 'libs/http';
+import { http, cleanCommand } from 'libs';
import store from './store';
import hostStore from '../host/store';
import styles from './index.module.css';
@@ -51,7 +51,7 @@ class ComForm extends React.Component {
}
this.setState({loading: true});
formData['id'] = store.record.id;
- formData['command'] = this.state.command;
+ formData['command'] = cleanCommand(this.state.command);
formData['targets'] = store.targets.filter(x => x);
formData['trigger_args'] = this._parse_args(formData['trigger']);
http.post('/api/schedule/', formData)