dashboard: Support setting value pattern for client IP and host in gateway flow rule dialog (#1325)
This commit is contained in:
parent
80d5c8b484
commit
09970cd380
|
|
@ -146,12 +146,12 @@ public class GatewayFlowRuleController {
|
||||||
return Result.ofFail(-1, "fieldName can't be null or empty");
|
return Result.ofFail(-1, "fieldName can't be null or empty");
|
||||||
}
|
}
|
||||||
itemEntity.setFieldName(paramItem.getFieldName());
|
itemEntity.setFieldName(paramItem.getFieldName());
|
||||||
|
}
|
||||||
|
|
||||||
String pattern = paramItem.getPattern();
|
String pattern = paramItem.getPattern();
|
||||||
// 如果匹配串不为空,验证匹配模式
|
// 如果匹配串不为空,验证匹配模式
|
||||||
if (StringUtil.isNotEmpty(pattern)) {
|
if (StringUtil.isNotEmpty(pattern)) {
|
||||||
itemEntity.setPattern(pattern);
|
itemEntity.setPattern(pattern);
|
||||||
|
|
||||||
Integer matchStrategy = paramItem.getMatchStrategy();
|
Integer matchStrategy = paramItem.getMatchStrategy();
|
||||||
if (!Arrays.asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX).contains(matchStrategy)) {
|
if (!Arrays.asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX).contains(matchStrategy)) {
|
||||||
return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy);
|
return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy);
|
||||||
|
|
@ -159,7 +159,6 @@ public class GatewayFlowRuleController {
|
||||||
itemEntity.setMatchStrategy(matchStrategy);
|
itemEntity.setMatchStrategy(matchStrategy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// 阈值类型 0-线程数 1-QPS
|
// 阈值类型 0-线程数 1-QPS
|
||||||
Integer grade = reqVo.getGrade();
|
Integer grade = reqVo.getGrade();
|
||||||
|
|
@ -292,19 +291,18 @@ public class GatewayFlowRuleController {
|
||||||
return Result.ofFail(-1, "fieldName can't be null or empty");
|
return Result.ofFail(-1, "fieldName can't be null or empty");
|
||||||
}
|
}
|
||||||
itemEntity.setFieldName(paramItem.getFieldName());
|
itemEntity.setFieldName(paramItem.getFieldName());
|
||||||
|
}
|
||||||
|
|
||||||
String pattern = paramItem.getPattern();
|
String pattern = paramItem.getPattern();
|
||||||
// 如果匹配串不为空,验证匹配模式
|
// 如果匹配串不为空,验证匹配模式
|
||||||
if (StringUtil.isNotEmpty(pattern)) {
|
if (StringUtil.isNotEmpty(pattern)) {
|
||||||
itemEntity.setPattern(pattern);
|
itemEntity.setPattern(pattern);
|
||||||
|
|
||||||
Integer matchStrategy = paramItem.getMatchStrategy();
|
Integer matchStrategy = paramItem.getMatchStrategy();
|
||||||
if (!Arrays.asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX).contains(matchStrategy)) {
|
if (!Arrays.asList(PARAM_MATCH_STRATEGY_EXACT, PARAM_MATCH_STRATEGY_CONTAINS, PARAM_MATCH_STRATEGY_REGEX).contains(matchStrategy)) {
|
||||||
return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy);
|
return Result.ofFail(-1, "invalid matchStrategy: " + matchStrategy);
|
||||||
}
|
}
|
||||||
itemEntity.setMatchStrategy(matchStrategy);
|
itemEntity.setMatchStrategy(matchStrategy);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
entity.setParamItem(null);
|
entity.setParamItem(null);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,7 +70,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group" ng-if="currentRule.paramItem != null && (currentRule.paramItem.parseStrategy == 2 || currentRule.paramItem.parseStrategy == 3 || currentRule.paramItem.parseStrategy == 4)">
|
<div class="form-group" ng-if="currentRule.paramItem != null">
|
||||||
<label class="col-sm-2 control-label">属性值匹配</label>
|
<label class="col-sm-2 control-label">属性值匹配</label>
|
||||||
<div class="col-sm-2">
|
<div class="col-sm-2">
|
||||||
<label class="checkbox-inline">
|
<label class="checkbox-inline">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue