完善条件
diff --git a/.webpackrc.js b/.webpackrc.js
index 4afc478..7ebf8c7 100755
--- a/.webpackrc.js
+++ b/.webpackrc.js
@@ -26,7 +26,7 @@
hash: true,
proxy: {
"/": {
- target: "http://192.168.1.101:8888",
+ target: "http://localhost:9095",
changeOrigin: true,
pathRewrite: { "^/": "" }
}
diff --git a/src/index.ejs b/src/index.ejs
index 36a188c..13c451d 100644
--- a/src/index.ejs
+++ b/src/index.ejs
@@ -11,7 +11,7 @@
</head>
<body>
- <div id="httpPath" style="display: none">http://192.168.90.140:9095</div>
+ <div id="httpPath" style="display: none">http://localhost:9095</div>
<div id="root"></div>
</body>
diff --git a/src/routes/plug/common/Rule.js b/src/routes/plug/common/Rule.js
index f9acb62..be27d4c 100644
--- a/src/routes/plug/common/Rule.js
+++ b/src/routes/plug/common/Rule.js
@@ -32,11 +32,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -97,6 +107,15 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
+
};
render() {
@@ -204,6 +223,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/common/Selector.js b/src/routes/plug/common/Selector.js
index dfd8105..8368fbb 100644
--- a/src/routes/plug/common/Selector.js
+++ b/src/routes/plug/common/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,8 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ // eslint-disable-next-line prefer-template
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +34,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +60,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -92,13 +104,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`;
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -113,7 +133,7 @@
enabled = true,
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
let {
@@ -175,7 +195,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -186,116 +206,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
);
})}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
-
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
+ </div>
+
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
</div>
-
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
-
- }
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/divide/Rule.js b/src/routes/plug/divide/Rule.js
index 4446726..774a705 100644
--- a/src/routes/plug/divide/Rule.js
+++ b/src/routes/plug/divide/Rule.js
@@ -65,11 +65,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -181,6 +191,14 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
@@ -216,14 +234,7 @@
} = this.props;
const {
ruleConditions,
- requestVolumeThreshold,
- errorThresholdPercentage,
- maxConcurrentRequests,
- sleepWindowInMilliseconds,
- groupKey,
- commandKey,
loadBalance,
- timeout,
retry
} = this.state;
@@ -329,6 +340,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/divide/Selector.js b/src/routes/plug/divide/Selector.js
index ec93ad9..1a49b64 100644
--- a/src/routes/plug/divide/Selector.js
+++ b/src/routes/plug/divide/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -22,18 +22,21 @@
}
];
- let upstreamList = [{
- upstreamHost: "",
- protocol: "",
- upstreamUrl: "",
- weight: '50'
- }]
+ let upstreamList = [
+ {
+ upstreamHost: "",
+ protocol: "",
+ upstreamUrl: "",
+ weight: "50"
+ }
+ ];
if (props.handle) {
const myHandle = JSON.parse(props.handle);
upstreamList = myHandle;
}
- let selectValue = props.type+'' || null
+ // eslint-disable-next-line prefer-template
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
upstreamList,
@@ -46,11 +49,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -60,16 +73,17 @@
return result;
};
- checkUpstream = (upstreamList) => {
+ checkUpstream = upstreamList => {
let result = true;
if (upstreamList) {
upstreamList.forEach((item, index) => {
- const { upstreamHost, upstreamUrl,weight} = item;
+ const { upstreamHost, upstreamUrl, weight } = item;
if (!upstreamHost || !upstreamUrl || !weight) {
message.destroy();
message.error(
- `第${index + 1}行http负载, upstreamHost和upstreamUrl, weight不能为空`
+ `第${index +
+ 1}行http负载, upstreamHost和upstreamUrl, weight不能为空`
);
result = false;
}
@@ -80,22 +94,21 @@
result = false;
}
return result;
- }
-
-
+ };
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
const { upstreamList } = this.state;
- const mySubmit = selectValue!=='0'&& this.checkConditions(selectorConditions);
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
const myUpstream = this.checkUpstream(upstreamList);
- if ((mySubmit||selectValue==='0') && myUpstream) {
+ if ((mySubmit || selectValue === "0") && myUpstream) {
handleOk({
...values,
handle: JSON.stringify(upstreamList),
@@ -133,6 +146,14 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`;
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
divideHandleAdd = () => {
@@ -168,11 +189,11 @@
this.setState({ upstreamList });
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -188,8 +209,8 @@
sort
} = this.props;
- const { selectorConditions, upstreamList ,selectValue } = this.state;
-
+ const { selectorConditions, upstreamList, selectValue } = this.state;
+
let {
selectorTypeEnums,
matchModeEnums,
@@ -197,7 +218,7 @@
paramTypeEnums
} = platform;
- type = `${type}`
+ type = `${type}`;
if (operatorEnums) {
operatorEnums = operatorEnums.filter(item => {
@@ -251,7 +272,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -262,120 +283,121 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
+ {selectValue !== "0" && (
+ <Fragment>
<FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- {/* 条件 */}
- <div className={styles.condition}>
- {/* 输入框左侧标题 */}
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ {/* 条件 */}
+ <div className={styles.condition}>
+ {/* 输入框左侧标题 */}
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
-
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/dubbo/Rule.js b/src/routes/plug/dubbo/Rule.js
index 433665d..0676dcb 100644
--- a/src/routes/plug/dubbo/Rule.js
+++ b/src/routes/plug/dubbo/Rule.js
@@ -71,11 +71,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -170,6 +180,15 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
onHandleChange = (key, value) => {
@@ -312,6 +331,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/dubbo/Selector.js b/src/routes/plug/dubbo/Selector.js
index 87b01ff..e8e2f08 100644
--- a/src/routes/plug/dubbo/Selector.js
+++ b/src/routes/plug/dubbo/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -12,7 +12,7 @@
class AddModal extends Component {
constructor(props) {
super(props);
-
+
const selectorConditions = props.selectorConditions || [
{
paramType: "header",
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,12 +59,13 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions ,selectValue} = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
const { appName, protocol, port, registry } = values;
handleOk({
...values,
@@ -93,12 +104,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value=>{
+
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -114,12 +134,12 @@
sort,
handle
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
let appName = "",
protocol = "",
port = "",
- registry = ""
+ registry = "";
type = `${type}`;
@@ -176,7 +196,7 @@
sm: { span: 19 }
}
};
-
+
return (
<Modal
width={700}
@@ -200,7 +220,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -211,113 +231,117 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&(<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
- </>)
- }
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
@@ -395,7 +419,7 @@
]
})(<Input placeholder="port" />)}
</FormItem> */}
-
+
<FormItem label="执行顺序" {...formItemLayout}>
{getFieldDecorator("sort", {
initialValue: sort,
diff --git a/src/routes/plug/hystrix/Rule.js b/src/routes/plug/hystrix/Rule.js
index 5fe3a75..07712e0 100644
--- a/src/routes/plug/hystrix/Rule.js
+++ b/src/routes/plug/hystrix/Rule.js
@@ -53,11 +53,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -151,6 +161,14 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
onHandleChange = (key, value) => {
@@ -282,6 +300,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/hystrix/Selector.js b/src/routes/plug/hystrix/Selector.js
index 28e7754..bc3246d 100644
--- a/src/routes/plug/hystrix/Selector.js
+++ b/src/routes/plug/hystrix/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -92,13 +103,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -114,7 +133,7 @@
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
@@ -124,7 +143,7 @@
operatorEnums,
paramTypeEnums
} = platform;
-
+
if (operatorEnums) {
operatorEnums = operatorEnums.filter(item => {
return item.support === true;
@@ -177,7 +196,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -188,115 +207,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
+ {selectValue !== "0" && (
+ <Fragment>
<FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/limiter/Rule.js b/src/routes/plug/limiter/Rule.js
index b214b55..63171f5 100644
--- a/src/routes/plug/limiter/Rule.js
+++ b/src/routes/plug/limiter/Rule.js
@@ -41,11 +41,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -122,6 +132,14 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
onHandleChange = (key, value) => {
@@ -239,6 +257,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/limiter/Selector.js b/src/routes/plug/limiter/Selector.js
index 14a75d5..e1a4c7b 100644
--- a/src/routes/plug/limiter/Selector.js
+++ b/src/routes/plug/limiter/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -92,13 +103,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -113,7 +132,7 @@
enabled = true,
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
let {
@@ -175,7 +194,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -186,115 +205,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/monitor/Rule.js b/src/routes/plug/monitor/Rule.js
index 5210382..e77c6a6 100644
--- a/src/routes/plug/monitor/Rule.js
+++ b/src/routes/plug/monitor/Rule.js
@@ -31,11 +31,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -103,6 +113,15 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
render() {
@@ -211,6 +230,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/monitor/Selector.js b/src/routes/plug/monitor/Selector.js
index 2df402f..e1a4c7b 100644
--- a/src/routes/plug/monitor/Selector.js
+++ b/src/routes/plug/monitor/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -47,7 +57,6 @@
return result;
};
-
handleSubmit = e => {
const { form, handleOk } = this.props;
const { selectorConditions, selectValue } = this.state;
@@ -55,8 +64,9 @@
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -93,13 +103,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -114,7 +132,7 @@
enabled = true,
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
let {
@@ -176,7 +194,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -187,117 +205,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
-
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/rewrite/Rule.js b/src/routes/plug/rewrite/Rule.js
index 78d8049..94a8676 100644
--- a/src/routes/plug/rewrite/Rule.js
+++ b/src/routes/plug/rewrite/Rule.js
@@ -31,11 +31,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -99,6 +109,15 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
render() {
@@ -212,6 +231,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/rewrite/Selector.js b/src/routes/plug/rewrite/Selector.js
index 14a75d5..f37021f 100644
--- a/src/routes/plug/rewrite/Selector.js
+++ b/src/routes/plug/rewrite/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -92,13 +103,22 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -113,7 +133,7 @@
enabled = true,
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
let {
@@ -175,7 +195,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -186,115 +206,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/sign/Rule.js b/src/routes/plug/sign/Rule.js
index c67afec..a543205 100644
--- a/src/routes/plug/sign/Rule.js
+++ b/src/routes/plug/sign/Rule.js
@@ -31,11 +31,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -103,6 +113,14 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
render() {
@@ -211,6 +229,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/sign/Selector.js b/src/routes/plug/sign/Selector.js
index 8199ede..6642d6b 100644
--- a/src/routes/plug/sign/Selector.js
+++ b/src/routes/plug/sign/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -92,13 +103,22 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -113,7 +133,7 @@
enabled = true,
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
@@ -176,7 +196,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -187,116 +207,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/plug/spring/Rule.js b/src/routes/plug/spring/Rule.js
index fd37508..7623f63 100644
--- a/src/routes/plug/spring/Rule.js
+++ b/src/routes/plug/spring/Rule.js
@@ -62,11 +62,21 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -155,6 +165,14 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
onHandleChange = (key, value) => {
@@ -282,6 +300,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/spring/Selector.js b/src/routes/plug/spring/Selector.js
index 10652b9..7a0c3cc 100644
--- a/src/routes/plug/spring/Selector.js
+++ b/src/routes/plug/spring/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -21,7 +21,7 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -33,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -49,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
const { serviceId } = values;
handleOk({
...values,
@@ -94,13 +105,21 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
+ selectValue: value
+ });
+ };
render() {
let {
@@ -120,8 +139,7 @@
let serviceId = handle;
type = `${type}`;
-
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
let {
selectorTypeEnums,
@@ -182,7 +200,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -193,115 +211,118 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
- }
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
@@ -336,8 +357,7 @@
{
required: true,
message: "请输入serviceId"
- },
-
+ }
]
})(<Input placeholder="serviceId" />)}
</FormItem>
diff --git a/src/routes/plug/waf/Rule.js b/src/routes/plug/waf/Rule.js
index 46345e2..6077179 100644
--- a/src/routes/plug/waf/Rule.js
+++ b/src/routes/plug/waf/Rule.js
@@ -31,11 +31,22 @@
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -113,6 +124,15 @@
let { ruleConditions } = this.state;
ruleConditions[index][name] = value;
this.setState({ ruleConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
render() {
@@ -228,6 +248,7 @@
</li>
<li>
<Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
onChange={e => {
this.conditionChange(
index,
diff --git a/src/routes/plug/waf/Selector.js b/src/routes/plug/waf/Selector.js
index 2c069da..e2d1e8c 100644
--- a/src/routes/plug/waf/Selector.js
+++ b/src/routes/plug/waf/Selector.js
@@ -1,4 +1,4 @@
-import React, { Component } from "react";
+import React, { Component, Fragment } from "react";
import { Modal, Form, Select, Input, Switch, Button, message } from "antd";
import { connect } from "dva";
import styles from "../index.less";
@@ -20,7 +20,8 @@
paramValue: ""
}
];
- let selectValue = props.type+'' || null
+ // eslint-disable-next-line prefer-template
+ let selectValue = props.type + "" || null;
this.state = {
selectorConditions,
selectValue
@@ -32,11 +33,21 @@
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramName || !paramValue) {
+ if (!paramType || !operator || !paramValue) {
message.destroy();
message.error(`第${index + 1}行条件不完整`);
result = false;
}
+ if (paramType === "uri" || paramType === "host" || paramType === "ip") {
+ // aaa
+ } else {
+ // eslint-disable-next-line no-lonely-if
+ if (!paramName) {
+ message.destroy();
+ message.error(`第${index + 1}行条件不完整`);
+ result = false;
+ }
+ }
});
} else {
message.destroy();
@@ -48,13 +59,14 @@
handleSubmit = e => {
const { form, handleOk } = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
e.preventDefault();
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- const mySubmit = selectValue!=='0'&&this.checkConditions(selectorConditions);
- if (mySubmit||selectValue==='0') {
+ const mySubmit =
+ selectValue !== "0" && this.checkConditions(selectorConditions);
+ if (mySubmit || selectValue === "0") {
handleOk({
...values,
sort: Number(values.sort),
@@ -91,14 +103,22 @@
let { selectorConditions } = this.state;
selectorConditions[index][name] = value;
this.setState({ selectorConditions });
+
+ if (name === "paramType") {
+ let key = `paramTypeValueEn${index}`
+ if (value === "uri" || value === "host" || value === "ip") {
+ this.setState({ [key]: true });
+ } else {
+ this.setState({ [key]: false });
+ }
+ }
};
- getSelectValue = value =>{
+ getSelectValue = value => {
this.setState({
- selectValue:value
- })
- }
-
+ selectValue: value
+ });
+ };
render() {
let {
@@ -114,7 +134,7 @@
sort
} = this.props;
- const { selectorConditions,selectValue } = this.state;
+ const { selectorConditions, selectValue } = this.state;
type = `${type}`;
@@ -124,7 +144,7 @@
operatorEnums,
paramTypeEnums
} = platform;
-
+
if (operatorEnums) {
operatorEnums = operatorEnums.filter(item => {
return item.support === true;
@@ -177,7 +197,7 @@
rules: [{ required: true, message: "请选择类型" }],
initialValue: type || "1"
})(
- <Select onChange={value=>this.getSelectValue(value)}>
+ <Select onChange={value => this.getSelectValue(value)}>
{selectorTypeEnums.map(item => {
return (
<Option key={item.code} value={`${item.code}`}>
@@ -188,115 +208,116 @@
</Select>
)}
</FormItem>
- {
- selectValue!=='0'&&<>
- <FormItem label="匹配方式" {...formItemLayout}>
- {getFieldDecorator("matchMode", {
- rules: [{ required: true, message: "请选择匹配方式" }],
- initialValue: matchMode
- })(
- <Select>
- {matchModeEnums.map(item => {
- return (
- <Option key={item.code} value={item.code}>
- {item.name}
- </Option>
- );
- })}
- </Select>
- )}
- </FormItem>
- <div className={styles.condition}>
- <h3 className={styles.header}>
- <strong>*</strong>条件:{" "}
- </h3>
- <div>
- {selectorConditions.map((item, index) => {
- return (
- <ul key={index}>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "paramType", value);
- }}
- value={item.paramType}
- style={{ width: 100 }}
- >
- {paramTypeEnums.map(typeItem => {
- return (
- <Option key={typeItem.name} value={typeItem.name}>
- {typeItem.name}
- </Option>
- );
- })}
- </Select>
- </li>
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramName",
- e.target.value
- );
- }}
- value={item.paramName}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Select
- onChange={value => {
- this.conditionChange(index, "operator", value);
- }}
- value={item.operator}
- style={{ width: 100 }}
- >
- {operatorEnums.map(opearte => {
- return (
- <Option key={opearte.name} value={opearte.name}>
- {opearte.name}
- </Option>
- );
- })}
- </Select>
- </li>
-
- <li>
- <Input
- onChange={e => {
- this.conditionChange(
- index,
- "paramValue",
- e.target.value
- );
- }}
- value={item.paramValue}
- style={{ width: 100 }}
- />
- </li>
- <li>
- <Button
- type="danger"
- onClick={() => {
- this.handleDelete(index);
- }}
- >
- 删除
- </Button>
- </li>
- </ul>
- );
- })}
- </div>
-
- <Button onClick={this.handleAdd} type="primary">
- 新增
- </Button>
- </div>
-
- </>
- }
+ {selectValue !== "0" && (
+ <Fragment>
+ <FormItem label="匹配方式" {...formItemLayout}>
+ {getFieldDecorator("matchMode", {
+ rules: [{ required: true, message: "请选择匹配方式" }],
+ initialValue: matchMode
+ })(
+ <Select>
+ {matchModeEnums.map(item => {
+ return (
+ <Option key={item.code} value={item.code}>
+ {item.name}
+ </Option>
+ );
+ })}
+ </Select>
+ )}
+ </FormItem>
+ <div className={styles.condition}>
+ <h3 className={styles.header}>
+ <strong>*</strong>条件:{" "}
+ </h3>
+ <div>
+ {selectorConditions.map((item, index) => {
+ return (
+ <ul key={index}>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "paramType", value);
+ }}
+ value={item.paramType}
+ style={{ width: 100 }}
+ >
+ {paramTypeEnums.map(typeItem => {
+ return (
+ <Option
+ key={typeItem.name}
+ value={typeItem.name}
+ >
+ {typeItem.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ disabled={this.state[`paramTypeValueEn${index}`]}
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramName",
+ e.target.value
+ );
+ }}
+ value={item.paramName}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Select
+ onChange={value => {
+ this.conditionChange(index, "operator", value);
+ }}
+ value={item.operator}
+ style={{ width: 100 }}
+ >
+ {operatorEnums.map(opearte => {
+ return (
+ <Option key={opearte.name} value={opearte.name}>
+ {opearte.name}
+ </Option>
+ );
+ })}
+ </Select>
+ </li>
+ <li>
+ <Input
+ onChange={e => {
+ this.conditionChange(
+ index,
+ "paramValue",
+ e.target.value
+ );
+ }}
+ value={item.paramValue}
+ style={{ width: 100 }}
+ />
+ </li>
+ <li>
+ <Button
+ type="danger"
+ onClick={() => {
+ this.handleDelete(index);
+ }}
+ >
+ 删除
+ </Button>
+ </li>
+ </ul>
+ );
+ })}
+ </div>
+ <Button onClick={this.handleAdd} type="primary">
+ 新增
+ </Button>
+ </div>
+ </Fragment>
+ )}
<div className={styles.layout}>
<FormItem {...formCheckLayout} label="继续后续选择器">
{getFieldDecorator("continued", {
diff --git a/src/routes/sysytem/metadata/index.js b/src/routes/sysytem/metadata/index.js
index 7817d6a..586b9fb 100644
--- a/src/routes/sysytem/metadata/index.js
+++ b/src/routes/sysytem/metadata/index.js
@@ -181,6 +181,7 @@
)
});
};
+
enableClick = () => {
const { dispatch } = this.props;
const { appName, currentPage, selectedRowKeys } = this.state;
@@ -215,6 +216,7 @@
message.warn("请选择数据");
}
};
+
syncData = () => {
const { dispatch } = this.props;
dispatch({
@@ -233,43 +235,50 @@
align: "center",
title: "应用名称",
dataIndex: "appName",
- key: "appName"
+ key: "appName",
+ width: 120
},
{
align: "center",
title: "路径",
dataIndex: "path",
- key: "path"
+ key: "path",
+ width: 150
},
{
align: "center",
title: "路径描述",
dataIndex: "pathDesc",
- key: "pathDesc"
+ key: "pathDesc",
+ width: 200
},
{
align: "center",
title: "服务接口",
dataIndex: "serviceName",
- key: "serviceName"
+ key: "serviceName",
+ width: 150
},
{
align: "center",
title: "方法名称",
dataIndex: "methodName",
- key: "methodName"
+ key: "methodName",
+ width: 120
},
{
align: "center",
title: "参数类型",
dataIndex: "parameterTypes",
- key: "parameterTypes"
+ key: "parameterTypes",
+ width: 120
},
{
align: "center",
title: "rpc类型",
dataIndex: "rpcType",
- key: "rpcType"
+ key: "rpcType",
+ width: 100
},
{
align: "center",
@@ -281,6 +290,7 @@
align: "center",
title: "状态",
dataIndex: "enabled",
+ width: 90,
key: "enabled",
render: text => {
if (text) {
@@ -293,6 +303,7 @@
{
align: "center",
title: "操作",
+ width: 90,
dataIndex: "operate",
key: "operate",
render: (text, record) => {
@@ -369,9 +380,6 @@
同步数据
</Button>
-
-
-
</div>
<Table
diff --git a/src/routes/sysytem/plugin/AddModal.js b/src/routes/sysytem/plugin/AddModal.js
index bc309c9..d89cabb 100644
--- a/src/routes/sysytem/plugin/AddModal.js
+++ b/src/routes/sysytem/plugin/AddModal.js
@@ -16,11 +16,9 @@
form.validateFieldsAndScroll((err, values) => {
if (!err) {
- let { name, role, enabled, master, mode, url, password, userName, database, config } = values;
+ let { name, role, enabled, master, mode, url, password, config } = values;
if (name === 'rate_limiter') {
config = JSON.stringify({ master, mode, url, password })
- } else if (name === 'monitor') {
- config = JSON.stringify({ userName, database, url, password })
}
handleOk({ name, role, enabled, config, id });
}
@@ -112,50 +110,6 @@
<Divider />
</Fragment>
)
- } else if (name === 'monitor') {
- try {
- config = JSON.parse(config)
- } catch (error) {
- config = {}
- }
- configWrap = (
- <Fragment>
- <Divider>influxdb 配置</Divider>
- <FormItem label="数据库" {...formItemLayout}>
- {getFieldDecorator("database", {
- rules: [{ required: true, message: "请输入数据库" }],
- initialValue: config.database,
- })(
- <Input placeholder="请输入数据库" />
- )}
- </FormItem>
- <FormItem label="URL" {...formItemLayout}>
- {getFieldDecorator("url", {
- rules: [{ required: true, message: "请输入URL" }],
- initialValue: config.url,
- })(
- <TextArea placeholder="请输入URL" rows={3} />
- )}
- </FormItem>
- <FormItem label="用户名" {...formItemLayout}>
- {getFieldDecorator("userName", {
- rules: [{ required: true, message: "请输入用户名" }],
- initialValue: config.userName,
- })(
- <Input placeholder="请输入用户名" />
- )}
- </FormItem>
- <FormItem label="密码" {...formItemLayout}>
- {getFieldDecorator("password", {
- rules: [{ required: true, message: "请输入password" }],
- initialValue: config.password,
- })(
- <Input placeholder="请输入password" />
- )}
- </FormItem>
- <Divider />
- </Fragment>
- )
} else {
configWrap = (
<FormItem label="配置" {...formItemLayout}>