基础信息、隧道行为增加限速,Stream模块三个限速位置统一

This commit is contained in:
DuanDongmei
2018-11-29 16:22:28 +08:00
parent 05d217e9e8
commit a62d57e243
6 changed files with 232 additions and 66 deletions

View File

@@ -964,6 +964,15 @@ public class AppCfgService extends BaseService {
if (entity.getBehavCode() != null) { if (entity.getBehavCode() != null) {
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode(); userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
} }
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) {
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
if (entity.getBehavCode() != null) {
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
}
}
// 限速业务需要设置 // 限速业务需要设置
if (Constants.RATELIMIT_ACTION.equals(entity.getAction())) { if (Constants.RATELIMIT_ACTION.equals(entity.getAction())) {
@@ -981,15 +990,7 @@ public class AppCfgService extends BaseService {
if(StringUtil.isEmpty(entity.getUserRegion4())){ if(StringUtil.isEmpty(entity.getUserRegion4())){
userRegion+=Constants.USER_REGION_SPLIT +Constants.APP_VIGNORE_USER_REGION_KEY+"=1"; userRegion+=Constants.USER_REGION_SPLIT +Constants.APP_VIGNORE_USER_REGION_KEY+"=1";
} }
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_BASIC_PROTOCOL.equalsIgnoreCase(configType)) {
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
} else if (Constants.SPECIFIC_SERVICE_CFG_TYPE_ENCRYPTED_TUNNEL_BEHAVIOR.equalsIgnoreCase(configType)) {
userRegion = Constants.PROTO_ID_REGION + "=" + entity.getAppCode();
if (entity.getBehavCode() != null) {
userRegion += Constants.USER_REGION_SPLIT + Constants.BEHAV_ID_REGION + "=" + entity.getBehavCode();
}
}
maatCfg.setUserRegion(userRegion); maatCfg.setUserRegion(userRegion);
configCompileList.add(maatCfg); configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList); maatBean.setConfigCompileList(configCompileList);

View File

@@ -371,9 +371,9 @@
<th><input type="checkbox" class="i-checks" id="checkAll"></th> <th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th> <th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th> <th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<th><spring:message code="ratelimit"/></th>
<%-- <th><spring:message code="block_by_app_server_ip"/></th> --%> <%-- <th><spring:message code="block_by_app_server_ip"/></th> --%>
<th class="sort-column r.action"><spring:message code="block_type"/></th> <th class="sort-column r.action"><spring:message code="block_type"/></th>
<th><spring:message code="ratelimit"/></th>
<th><spring:message code="social_app"/></th> <th><spring:message code="social_app"/></th>
<th><spring:message code="behaviour_type"/></th> <th><spring:message code="behaviour_type"/></th>
<th><spring:message code="is_audit"/></th> <th><spring:message code="is_audit"/></th>
@@ -402,15 +402,6 @@
</td> </td>
<td>${cfg.compileId }</td> <td>${cfg.compileId }</td>
<td>${cfg.cfgDesc }</td> <td>${cfg.cfgDesc }</td>
<td>
<c:if test="${cfg.action eq 64}">
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<%-- <td> <%-- <td>
<c:if test="${cfg.userRegion4 eq '1'}"> <c:if test="${cfg.userRegion4 eq '1'}">
<spring:message code="yes"/> <spring:message code="yes"/>
@@ -426,6 +417,15 @@
</c:if> </c:if>
</c:forEach> </c:forEach>
</td> </td>
<td>
<c:if test="${cfg.action eq 64}">
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td> <td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td>
<td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td> <td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td>
<%-- <td>${cfg.ratelimit }</td> --%> <%-- <td>${cfg.ratelimit }</td> --%>

View File

@@ -14,16 +14,19 @@ $(function(){
// $("#cancel").on("click",function(){ // $("#cancel").on("click",function(){
// window.history.back(); // window.history.back();
// }); // });
$(".ratelimitAction").find("input[name='userRegion1']").on("change",function(){
switchRateLimitType();
});
$(".action").on("change", function() { $(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId")); $("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId")); $("#protocolId").val($(this).attr("protocolId"));
var action=$("input[name='action']:checked").val(); var action=$("input[name='action']:checked").val();
switchAction(action); if(action==64){
if($(".action:checked").val()==64){ $(".ratelimitAction").removeClass("hidden");
$("#ratelimit").show();
}else{ }else{
$("#ratelimit").hide(); $(".ratelimitAction").addClass("hidden");
} }
switchAction(action);
if($(this).val()==1){ if($(this).val()==1){
$(".ipPortAdd").click(); $(".ipPortAdd").click();
} }
@@ -31,9 +34,9 @@ $(function(){
$("#serviceId").val($(".action:checked").attr("serviceId")); $("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId")); $("#protocolId").val($(".action:checked").attr("protocolId"));
if($(".action:checked").val()==64){ if($(".action:checked").val()==64){
$("#ratelimit").show(); $(".ratelimitAction").removeClass("hidden");
}else{ }else{
$("#ratelimit").hide(); $(".ratelimitAction").addClass("hidden");
} }
$("#cfgFrom").validate({ $("#cfgFrom").validate({
errorPlacement: function(error,element){ errorPlacement: function(error,element){
@@ -98,8 +101,8 @@ $(function(){
//if($("[name='behavCode']")&&$("[name='behavCode']").val()!=""){ //if($("[name='behavCode']")&&$("[name='behavCode']").val()!=""){
// $("input[name='exprType']").val(1); // $("input[name='exprType']").val(1);
//} //}
if($("input[name='ratelimit']").is(":hidden")){ if($(".ratelimitAction").is(":hidden")){
$("input[name='ratelimit']").val(""); $(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
} }
/* $("#appCode").val($("#specServiceIdId").val()); */ /* $("#appCode").val($("#specServiceIdId").val()); */
loading('onloading...'); loading('onloading...');
@@ -125,6 +128,20 @@ var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled"); $("." + contentClassName).addClass("hidden").addClass("disabled");
$("." + addBtnClassName).removeClass("hidden"); $("." + addBtnClassName).removeClass("hidden");
} }
//限流方式
var switchRateLimitType=function(){
//0 丢包率 1 带宽
var rateLimitType=$(".ratelimitAction").find("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){
$(".droprate").removeClass("hidden");
$(".bandwith").addClass("hidden");
}
if(rateLimitType == 1){
$(".droprate").addClass("hidden");
$(".bandwith").removeClass("hidden");
}
}
</script> </script>
</head> </head>
<body> <body>
@@ -251,17 +268,74 @@ var delContent = function(contentClassName, addBtnClassName) {
</c:forEach> </c:forEach>
</div> </div>
</div> </div>
<div class="col-md-6 hidden">
<div class="col-md-6 ratelimit" id="ratelimit">
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-3">
<input type="checkbox" name="userRegion4" class="child-checks" <%-- <c:if test="${_cfg.userRegion4 eq '1' }"> --%>checked<%-- </c:if> --%> value="1">
</label>
<div class="col-md-6">
<label class="control-label">
<spring:message code="block_by_app_server_ip"/>
</label>
</div>
<div for="userRegion4"></div>
</div>
</div>
</div>
<div class="row ratelimitAction hidden">
<h4 class="form-section">
<spring:message code="action_region" />
<small></small>
</h4>
<div class="col-md-6 hidden">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="limit_rate_type"/></label>
<div class="col-md-6">
<label class="radio-inline">
<input type="radio"
name="userRegion1" value="0"
<%-- <c:if test="${(userRegion1 eq 0) || (empty userRegion1)}"> --%>
checked
<%-- </c:if> --%>
class="required" >
<spring:message code="ratelimit" />
</label>
<%-- <label class="radio-inline">
<input type="radio"
name="userRegion1" value="1"
<c:if test="${(userRegion1 eq 1)}">
checked
</c:if>
class="required" >
<spring:message code="bandwith" />
</label> --%>
</div>
<div for="userRegion1"></div>
</div>
</div>
<div class="col-md-6 droprate">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label> <label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control required digest" range="[0,1]" type="text" name="ratelimit" value="${_cfg.ratelimit}"> <select name="userRegion2" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.userRegion2==ratelimitC.itemCode || (_cfg.userRegion2==null && ratelimitC.itemCode eq '0.1')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
</div> </div>
<div for="ratelimit"></div> <div for="userRegion2"></div>
</div> </div>
</div> </div>
<%-- <div class="col-md-6 bandwith">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="bandwith"/></label>
<div class="col-md-6">
<input class="form-control required number" type="text" name="userRegion3" value="${_cfg.userRegion3 }">
</div>
<div for="userRegion3"></div>
</div>
</div> --%>
</div> </div>
</c:if> </c:if>
<!-- 关键字 --> <!-- 关键字 -->

View File

@@ -375,8 +375,8 @@
<th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th> <th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th> <th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<%-- <th><spring:message code="behaviour_type"/></th> --%> <%-- <th><spring:message code="behaviour_type"/></th> --%>
<%-- <th><spring:message code="ratelimit"/></th> --%>
<th class="sort-column r.action"><spring:message code="block_type"/></th> <th class="sort-column r.action"><spring:message code="block_type"/></th>
<th><spring:message code="ratelimit"/></th>
<th><spring:message code="basic_protocol"/></th> <th><spring:message code="basic_protocol"/></th>
<th><spring:message code="is_audit"/></th> <th><spring:message code="is_audit"/></th>
<th><spring:message code="do_log"/></th> <th><spring:message code="do_log"/></th>
@@ -411,9 +411,17 @@
</c:if> </c:if>
</c:forEach> </c:forEach>
</td> </td>
<td>
<c:if test="${cfg.action eq 64}">
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td>
<td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td> <td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td>
<%--<td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td>--%> <%--<td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td>--%>
<%-- <td>${cfg.ratelimit }</td> --%>
<td> <td>
<c:choose> <c:choose>
<c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when> <c:when test="${cfg.isAudit eq '0'}"><span class="label label-danger"><spring:message code="created"></spring:message></span></c:when>

View File

@@ -9,23 +9,26 @@ $(function(){
/* $("#cancel").on("click",function(){ /* $("#cancel").on("click",function(){
window.history.back(); window.history.back();
}); */ }); */
$(".ratelimitAction").find("input[name='userRegion1']").on("change",function(){
switchRateLimitType();
});
$(".action").on("change", function() { $(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId")); $("#serviceId").val($(this).attr("serviceId"));
$("#protocolId").val($(this).attr("protocolId")); $("#protocolId").val($(this).attr("protocolId"));
var action=$("input[name='action']:checked").val(); var action=$("input[name='action']:checked").val();
switchAction(action); if(action==64){
if($(".action:checked").val()==64){ $(".ratelimitAction").removeClass("hidden");
$("#ratelimit").show();
}else{ }else{
$("#ratelimit").hide(); $(".ratelimitAction").addClass("hidden");
} }
switchAction(action);
}); });
$("#serviceId").val($(".action:checked").attr("serviceId")); $("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId")); $("#protocolId").val($(".action:checked").attr("protocolId"));
if($(".action:checked").val()==64){ if($(".action:checked").val()==64){
$("#ratelimit").show(); $(".ratelimitAction").removeClass("hidden");
}else{ }else{
$("#ratelimit").hide(); $(".ratelimitAction").addClass("hidden");
} }
$("#cfgFrom").validate({ $("#cfgFrom").validate({
errorPlacement: function(error,element){ errorPlacement: function(error,element){
@@ -73,8 +76,8 @@ $(function(){
if($("[name='behavCode']")&&$("[name='behavCode']").val()!=""){ if($("[name='behavCode']")&&$("[name='behavCode']").val()!=""){
$("input[name='exprType']").val(1); $("input[name='exprType']").val(1);
} }
if($("input[name='ratelimit']").is(":hidden")){ if($(".ratelimitAction").is(":hidden")){
$("input[name='ratelimit']").val(""); $(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
} }
/* $("#appCode").val($("#specServiceIdId").val()); */ /* $("#appCode").val($("#specServiceIdId").val()); */
loading('onloading...'); loading('onloading...');
@@ -149,6 +152,21 @@ var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled"); $("." + contentClassName).addClass("hidden").addClass("disabled");
$("." + addBtnClassName).removeClass("hidden"); $("." + addBtnClassName).removeClass("hidden");
} }
//限流方式
var switchRateLimitType=function(){
//0 丢包率 1 带宽
var rateLimitType=$(".ratelimitAction").find("input[name='userRegion1']:checked").val();
if(rateLimitType == 0){
$(".droprate").removeClass("hidden");
$(".bandwith").addClass("hidden");
}
if(rateLimitType == 1){
$(".droprate").addClass("hidden");
$(".bandwith").removeClass("hidden");
}
}
</script> </script>
</head> </head>
<body> <body>
@@ -245,6 +263,19 @@ var delContent = function(contentClassName, addBtnClassName) {
</c:forEach> </c:forEach>
</div> </div>
</div> </div>
<div class="col-md-6 hidden">
<div class="form-group">
<label class="control-label col-md-3">
<input type="checkbox" name="userRegion4" class="child-checks" <%-- <c:if test="${_cfg.userRegion4 eq '1' }"> --%>checked<%-- </c:if> --%> value="1">
</label>
<div class="col-md-6">
<label class="control-label">
<spring:message code="block_by_app_server_ip"/>
</label>
</div>
<div for="userRegion4"></div>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">
@@ -282,16 +313,60 @@ var delContent = function(contentClassName, addBtnClassName) {
</div> </div>
</div> </div>
<div class="row"> <div class="row ratelimitAction hidden">
<div class="col-md-6" id="ratelimit"> <h4 class="form-section">
<spring:message code="action_region" />
<small></small>
</h4>
<div class="col-md-6 hidden">
<div class="form-group"> <div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="limit_rate_type"/></label>
<div class="col-md-6">
<label class="radio-inline">
<input type="radio"
name="userRegion1" value="0"
<%-- <c:if test="${(userRegion1 eq 0) || (empty userRegion1)}"> --%>
checked
<%-- </c:if> --%>
class="required" >
<spring:message code="ratelimit" />
</label>
<%-- <label class="radio-inline">
<input type="radio"
name="userRegion1" value="1"
<c:if test="${(userRegion1 eq 1)}">
checked
</c:if>
class="required" >
<spring:message code="bandwith" />
</label> --%>
</div>
<div for="userRegion1"></div>
</div>
</div>
<div class="col-md-6 droprate">
<div class="form-group ">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label> <label class="control-label col-md-3"><font color="red">*</font><spring:message code="ratelimit"/></label>
<div class="col-md-6"> <div class="col-md-6">
<input class="form-control required digest" range="[0,1]" type="text" name="ratelimit" value="${_cfg.ratelimit}"> <select name="userRegion2" data-live-search="true" class="selectpicker form-control required">
<option value="" ><spring:message code="selected"/></option>
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<option value="${ratelimitC.itemCode}" <c:if test="${_cfg.userRegion2==ratelimitC.itemCode || (_cfg.userRegion2==null && ratelimitC.itemCode eq '0.1')}">selected</c:if>><spring:message code="${ratelimitC.itemValue}"/></option>
</c:forEach>
</select>
</div> </div>
<div for="ratelimit"></div> <div for="userRegion2"></div>
</div> </div>
</div> </div>
<%-- <div class="col-md-6 bandwith">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="bandwith"/></label>
<div class="col-md-6">
<input class="form-control required number" type="text" name="userRegion3" value="${_cfg.userRegion3 }">
</div>
<div for="userRegion3"></div>
</div>
</div> --%>
</div> </div>
</c:if> </c:if>
<!-- 关键字 --> <!-- 关键字 -->

View File

@@ -372,9 +372,9 @@
<th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th> <th class="sort-column r.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
<th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th> <th class="sort-column r.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
<th class="sort-column r.action"><spring:message code="block_type"/></th> <th class="sort-column r.action"><spring:message code="block_type"/></th>
<th><spring:message code="ratelimit"/></th>
<th><spring:message code="encrypted_tunnel_behavior"/></th> <th><spring:message code="encrypted_tunnel_behavior"/></th>
<th><spring:message code="behaviour_type"/></th> <th><spring:message code="behaviour_type"/></th>
<%-- <th><spring:message code="ratelimit"/></th> --%>
<th><spring:message code="is_audit"/></th> <th><spring:message code="is_audit"/></th>
<th><spring:message code="do_log"/></th> <th><spring:message code="do_log"/></th>
<th><spring:message code="log_total"/></th> <th><spring:message code="log_total"/></th>
@@ -407,6 +407,15 @@
<spring:message code="${dict.itemValue }"/> <spring:message code="${dict.itemValue }"/>
</c:if> </c:if>
</c:forEach> </c:forEach>
</td>
<td>
<c:if test="${cfg.action eq 64}">
<c:forEach items="${fns:getDictList('APP_RATE_LIMIT')}" var="ratelimitC">
<c:if test="${cfg.userRegion2==ratelimitC.itemCode}">
<spring:message code="${ratelimitC.itemValue}"/>
</c:if>
</c:forEach>
</c:if>
</td> </td>
<td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td> <td class="appCode" id="${cfg.appCode }">${cfg.appCode }</td>
<td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td> <td class="behavCode" id="${cfg.behavCode }">${cfg.behavCode }</td>
@@ -418,7 +427,6 @@
<c:when test="${cfg.isAudit eq '3'}"><span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when> <c:when test="${cfg.isAudit eq '3'}"><span indexTable="${cfg.indexTable}" data-placement="right" data-original-title="<spring:message code='letter_cancel_info'/>: " class="label le-ca-fo label-warning tooltips" data-icon="&#xe01e;"> <spring:message code="cancel_approved"/></span></c:when>
</c:choose> </c:choose>
</td> </td>
<%-- <td>${cfg.ratelimit }</td> --%>
<td> <td>
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict"> <c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
<c:if test="${dict.itemCode eq cfg.doLog }"> <c:if test="${dict.itemCode eq cfg.doLog }">