|
@@ -2,6 +2,7 @@ import React from 'react'
|
|
|
import { Form, Input, Row, Col, Button, Modal, message } from 'antd'
|
|
|
import { connect } from 'dva'
|
|
|
import AceEditor from 'react-ace'
|
|
|
+import { isJSON } from '@/utils/utils'
|
|
|
import { detail, update, test } from '../service'
|
|
|
|
|
|
import 'ace-builds/src-noconflict/mode-java'
|
|
@@ -58,9 +59,13 @@ class Add extends React.PureComponent {
|
|
|
message.warn('请先提交策略内容!')
|
|
|
return false
|
|
|
}
|
|
|
+ if (!isJSON(this.state.testContent)) {
|
|
|
+ message.warn('输入数据格式错误!')
|
|
|
+ return false
|
|
|
+ }
|
|
|
test({
|
|
|
group: this.state.name,
|
|
|
- input: JSON.parse(this.state.testContent)
|
|
|
+ input: this.state.testContent
|
|
|
}).then(res => {
|
|
|
if (res.code === 0) {
|
|
|
this.setState({ testResult: JSON.stringify(res) })
|