This is an automated email from the ASF dual-hosted git repository.
dengliming pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shenyu-dashboard.git
The following commit(s) were added to refs/heads/master by this push:
new 71a313ce Support `isBlank` (#312)
71a313ce is described below
commit 71a313ce120fe1487d0b55388081cd500478a7ff
Author: Kerwin Bryant <[email protected]>
AuthorDate: Tue Aug 15 17:31:45 2023 +0800
Support `isBlank` (#312)
---
src/routes/Plugin/Common/Rule.js | 14 ++++++++++++--
src/routes/Plugin/Common/Selector.js | 16 ++++++++++++++--
2 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/src/routes/Plugin/Common/Rule.js b/src/routes/Plugin/Common/Rule.js
index aec2027e..e125d281 100644
--- a/src/routes/Plugin/Common/Rule.js
+++ b/src/routes/Plugin/Common/Rule.js
@@ -124,7 +124,7 @@ class AddModal extends Component {
if (ruleConditions) {
ruleConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramValue) {
+ if (!paramType || !operator || (operator !== "isBlank" &&
!paramValue)) {
message.destroy();
message.error(`Line ${index + 1} condition is incomplete`);
result = false;
@@ -338,6 +338,11 @@ class AddModal extends Component {
return operate.key !== "pathPattern" ? operate : ""
})
}
+ if (paramType !== "post" && paramType !== "query" && paramType !==
"header" && paramType !== "cookie") {
+ operatorsFil = operatorsFil.filter(operate => {
+ return operate.key !== "isBlank" ? operate : ""
+ })
+ }
if (paramType === "uri" || paramType === "host" || paramType === "ip" ||
paramType === "cookie" || paramType === "domain") {
operatorsFil = operatorsFil.filter(operate => {
return operate.key !== "TimeBefore" && operate.key !== "TimeAfter" ?
operate : ""
@@ -396,7 +401,12 @@ class AddModal extends Component {
);
}}
value={item.paramValue}
- style={{ width: 160 }}
+ style={{
+ width: 160,
+ display: item.operator === "isBlank"
+ ? "none"
+ : "block"
+ }}
/>
)
}
diff --git a/src/routes/Plugin/Common/Selector.js
b/src/routes/Plugin/Common/Selector.js
index 001552e1..9b98deb4 100644
--- a/src/routes/Plugin/Common/Selector.js
+++ b/src/routes/Plugin/Common/Selector.js
@@ -161,7 +161,7 @@ class AddModal extends Component {
if (selectorConditions) {
selectorConditions.forEach((item, index) => {
const { paramType, operator, paramName, paramValue } = item;
- if (!paramType || !operator || !paramValue) {
+ if (!paramType || !operator || (operator !== "isBlank" &&
!paramValue)) {
message.destroy();
message.error(`Line ${index + 1} condition is incomplete`);
result = false;
@@ -779,6 +779,11 @@ class AddModal extends Component {
return operate.key !== "pathPattern" ? operate : ""
})
}
+ if (paramType !== "post" && paramType !== "query" && paramType !==
"header" && paramType !== "cookie") {
+ operatorsFil = operatorsFil.filter(operate => {
+ return operate.key !== "isBlank" ? operate : ""
+ })
+ }
if (paramType === "uri" || paramType === "host" || paramType === "ip" ||
paramType === "cookie" || paramType === "domain") {
operatorsFil = operatorsFil.filter(operate => {
return operate.key !== "TimeBefore" && operate.key !== "TimeAfter" ?
operate : ""
@@ -1047,7 +1052,14 @@ class AddModal extends Component {
</Select>
</Col>
- <Col span={7}>
+ <Col
+ span={7}
+ style={{
+ display: item.operator === "isBlank"
+ ? "none"
+ : "block"
+ }}
+ >
<Tooltip title={item.paramValue}>
{this.getParamValueInput(item, index)}
</Tooltip>