修改URL 和domain类的关键字显示为当前业务

界面增加带宽的选项
This commit is contained in:
duandongmei
2018-08-29 10:50:40 +08:00
parent a6b6696521
commit 7a5b2dc32a
14 changed files with 149 additions and 28 deletions

View File

@@ -277,7 +277,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
strRegionList=map.get("dstList");
}
}
//域名信息
boolean doaminFlag=false;
String domainUserRegion="";
if(entity.getHttpUrlList()!=null && entity.getHttpUrlList().size()>0){
doaminFlag=true;
domainUserRegion=Constants.USERREGION_DOMAIN_ID+"="+entity.getCompileId();
domainUserRegion=domainUserRegion+";"+Constants.USERREGION_DOMAIN_STR+"="+entity.getHttpUrlList().get(0).getCfgKeywords();
HttpUrlCfg cfg = new HttpUrlCfg();
BeanUtils.copyProperties(entity, cfg, new String[]{"cfgId"});
cfg.setTableName(HttpUrlCfg.getTablename());
@@ -324,9 +330,13 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
}
//限速需要发Droprate=0.001 暂不支持Bandwidth=200kbps
if(entity.getAction().equals(Constants.RATELIMIT_ACTION)){
entity.setUserRegion1(StringUtil.isEmpty(entity.getUserRegion1()) ? "":entity.getUserRegion1());
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion1());
if(entity.getUserRegion1().equals("0")){//丢包率
entity.setUserRegion2(StringUtil.isEmpty(entity.getUserRegion2()) ? "":entity.getUserRegion2());
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+entity.getUserRegion2());
}else if(entity.getUserRegion1().equals("1")){//带宽
entity.setUserRegion3(StringUtil.isEmpty(entity.getUserRegion3()) ? "":entity.getUserRegion3());
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+entity.getUserRegion3());
}
}
String userRegion="";
//替换需要发zone
@@ -347,9 +357,18 @@ public class InterceptCfgService extends CrudService<WebsiteCfgDao,CfgIndexInfo>
maatCfg.setUserRegion(userRegion);
}
if(StringUtil.isEmpty(maatCfg.getUserRegion())){
if(StringUtil.isEmpty(maatCfg.getUserRegion())
|| maatCfg.getUserRegion().equals(Constants.USER_REGION_PLACEHOLDER)){
if(doaminFlag){
maatCfg.setUserRegion(domainUserRegion);
}else{
maatCfg.setUserRegion(Constants.USER_REGION_PLACEHOLDER);
}
}else{
if(doaminFlag){
maatCfg.setUserRegion(maatCfg.getUserRegion()+";"+domainUserRegion);
}
}
configCompileList.add(maatCfg);
maatBean.setConfigCompileList(configCompileList);

View File

@@ -743,7 +743,7 @@ target_ip_protect=Anti DDOS
ratelimit_config=Ratelimit
ip_ratelimit=IP Ratelimit
domain_ratelimit=Website Ratelimit
ratelimit=Limit Rate
ratelimit=Pocket Loss Rate
ir_type=Reuse Type
dns_strategy_id=DNS Policy ID
no_strategy=No Strategy
@@ -1124,3 +1124,5 @@ end_entity=End-entity Certificate
header=Header
layer=Layer
can_not_delete_issued_asn_group=Can not delete issued ASN group
bandwith=Bandwith
limit_rate_type=Limit Rate Type

View File

@@ -741,7 +741,7 @@ ratelimit_config=\u9650\u901F
target_ip_protect=\u6297DDOS\u653B\u51FB
ip_ratelimit=IP\u9650\u6D41
domain_ratelimit=\u57DF\u540D\u9650\u6D41
ratelimit=\u9650\u901F\u6BD4\u4F8B
ratelimit=\u4E22\u5305\u7387
ir_type=\u590D\u7528\u7C7B\u578B
dns_strategy_id=DNS\u7B56\u7565ID
no_strategy=\u65E0\u7B56\u7565
@@ -1121,3 +1121,5 @@ certificate_validity=\u8BC1\u4E66\u6709\u6548\u671F
header=\u5173\u952E\u5B57
layer=\u5339\u914D\u533A\u57DF
can_not_delete_issued_asn_group=\u4E0D\u80FD\u5220\u9664\u5DF2\u7ECF\u4E0B\u53D1\u8FC7\u7684ASN\u5206\u7EC4
bandwith=\u5E26\u5BBD
limit_rate_type=\u9650\u901F\u65B9\u5F0F

View File

@@ -35,7 +35,18 @@
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font>
<spring:message code="keywords" /></label>
<c:choose>
<c:when test="${fn:containsIgnoreCase(region.configServiceType,'domain') }">
<spring:message code="domain" />
</c:when>
<c:when test="${fn:containsIgnoreCase(region.configServiceType,'url') }">
<spring:message code="URL" />
</c:when>
<c:otherwise>
<spring:message code="keywords" />
</c:otherwise>
</c:choose>
</label>
<!-- 此配置的关键词可以输入多个关键词 -->
<c:if test="${region.configMultiKeywords eq 1}">
<div class="col-md-6">
@@ -47,7 +58,9 @@
<!-- 此配置的关键词不允许输入多个关键词 -->
<c:if test="${(region.configMultiKeywords eq 0) or (empty region.configMultiKeywords)}">
<div class="col-md-6">
<input class="form-control required invisibleChar" type="text"
<input class="form-control required invisibleChar
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if>
" type="text"
name="cfgKeywords"
value="${_cfg.cfgKeywords}">
</div>

View File

@@ -103,7 +103,7 @@
<form:select path="seltype" class="selectpicker select2 input-small" >
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
<form:option value="cfgKeywords"><spring:message code="key_word"></spring:message></form:option>
<form:option value="cfgKeywords"><spring:message code="URL"></spring:message></form:option>
</form:select>
</div>
@@ -276,7 +276,7 @@
<th><input type="checkbox" class="i-checks" id="checkAll"></th>
<th style="display: none"><spring:message code="cfg_id"/></th>
<th><spring:message code="config_describe"/></th>
<th><spring:message code="key_word"/></th>
<th><spring:message code="URL"/></th>
<th><spring:message code="whether_hexbinary"/></th>
<th><spring:message code="expression_type"/></th>
<th><spring:message code="match_method"/></th>

View File

@@ -104,7 +104,7 @@
<form:select path="seltype" class="selectpicker select2 input-small" >
<form:option value="cfgDesc"><spring:message code="config_describe"></spring:message></form:option>
<form:option value="compileId"><spring:message code="cfg_id"></spring:message></form:option>
<form:option value="cfgKeywords"><spring:message code="key_word"></spring:message></form:option>
<form:option value="cfgKeywords"><spring:message code="URL"></spring:message></form:option>
</form:select>
</div>
@@ -278,7 +278,7 @@
<%-- <th><spring:message code="seq"/></th> --%>
<th style="display: none"><spring:message code="cfg_id"/></th>
<th><spring:message code="config_describe"/></th>
<th><spring:message code="key_word"/></th>
<th><spring:message code="URL"/></th>
<th><spring:message code="whether_hexbinary"/></th>
<th><spring:message code="expression_type"/></th>
<th><spring:message code="match_method"/></th>

View File

@@ -67,7 +67,19 @@
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><font color="red">*</font>
<spring:message code="keywords" /></label>
<c:choose>
<c:when test="${fn:containsIgnoreCase(region.configServiceType,'domain') }">
<spring:message code="domain" />
</c:when>
<c:when test="${fn:containsIgnoreCase(region.configServiceType,'url') }">
<spring:message code="URL" />
</c:when>
<c:otherwise>
<spring:message code="keywords" />
</c:otherwise>
</c:choose>
</label>
<!-- 此配置的关键词可以输入多个关键词 -->
<c:if test="${region.configMultiKeywords eq 1}">
<div class="col-md-6">
@@ -81,7 +93,7 @@
<div class="col-md-6">
<input class="form-control required invisibleChar
<c:if test="${fn:contains(region.configServiceType,'domain') }"> domainCheck </c:if>
<c:if test="${fn:containsIgnoreCase(region.configServiceType,'domain') }"> domainCheck </c:if>
"
type="text"
name="${cfgName}.cfgKeywords"

View File

@@ -127,7 +127,16 @@
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='keywords' />:</label><label>
<label>
<c:choose>
<c:when test="${fn:containsIgnoreCase(cfg.cfgType,'URL') }">
<spring:message code="URL" />
</c:when>
<c:otherwise>
<spring:message code="keywords" />
</c:otherwise>
</c:choose>
:</label><label>
${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>

View File

@@ -22,6 +22,9 @@
});
$("#serviceId").val($(".action:checked").attr("serviceId"));
$("#protocolId").val($(".action:checked").attr("protocolId"));
$(".ratelimitAction").find("input[name='userRegion1']").on("change",function(){
switchRateLimitType();
});
$("#cfgFrom").validate(
{
errorPlacement : function(error, element) {
@@ -87,6 +90,13 @@
}else if(action==64){//限速
$(".monitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
$(".replaceAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
var rateLimitType=$("input[name='userRegion1']checked").val();
if(rateLimitType == 0){//丢包率
$(".bandwith").find("input[name='userRegion3']").attr("disabled",true);
}
if(rateLimitType == 1){//带宽
$(".droprate").find("input[name='userRegion2']").attr("disabled",true);
}
}else if(action==80){//替换
$(".monitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
@@ -259,13 +269,48 @@
<div class="row ratelimitAction hidden">
<div class="col-md-6">
<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="limit_rate_type"/></label>
<div class="col-md-6">
<input class="form-control required number" range="[0,1]" type="text" name="userRegion1" value="${_cfg.userRegion1 }">
<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>
<div class="col-md-6">
<input class="form-control required number" range="[0,1]" type="text" name="userRegion2" value="${_cfg.userRegion2 }">
</div>
<div for="userRegion2"></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>
<%--action 为80 替换时 可以选择替换动作--%>
<div class="row replaceAction hidden">

View File

@@ -316,6 +316,7 @@
<th style="display: none"><spring:message code="cfg_id"/></th>
<th class="cfgDesc"><spring:message code="config_describe"/></th>
<th><spring:message code="ratelimit"/></th>
<th><spring:message code="bandwith"/></th>
<th><spring:message code="certificate"/></th>
<c:if test="${interceptType eq 'Ip' }">
<th><spring:message code="replace_zone"/></th>
@@ -351,7 +352,12 @@
<td>${indexCfg.cfgDesc }</td>
<td>
<c:if test="${indexCfg.action eq 64}">
${indexCfg.userRegion1 }
${indexCfg.userRegion2 }
</c:if>
</td>
<td>
<c:if test="${indexCfg.action eq 64}">
${indexCfg.userRegion3 }
</c:if>
</td>
<td>

View File

@@ -161,7 +161,7 @@
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
<label><spring:message code='URL' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>
</div>

View File

@@ -162,7 +162,7 @@
<div class="row">
<div class="col-md-8">
<div class="form-group">
<label><spring:message code='keywords' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
<label><spring:message code='URL' />:</label><label>${fn:replace(cfg.cfgKeywords, "***and***", " ")}</label>
</div>
</div>

View File

@@ -22553,7 +22553,7 @@ transition: background-color .1s ease-in-out;
/* END SHOW MORE CSS**/
/**瀛愰厤缃<EFBFBD>夐」鍗℃牱寮<EFBFBD>**/
/**鐎涙劙鍘ょ純顕<EFBFBD>锟藉銆嶉崡鈩冪壉瀵拷**/
.tabInfo {
border: 1px solid #c2cad8;
padding: 5px;

View File

@@ -523,6 +523,7 @@ var setInterceptDefaultInfo=function(cfgId){
$("select[name='"+protocolNamePrefix+"protocol']").append("<option value='6'>TCP</option>");
$("select[name='"+protocolNamePrefix+"protocol']").append("<option value='17'>UDP</option>");
$("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh");
switchRateLimitType();
}
if(interceptReplacePktBin == 'intercept_replace_pkt_bin'){
$("."+interceptReplacePktBin).addClass("hidden");
@@ -544,8 +545,6 @@ var setInterceptDefaultInfo=function(cfgId){
$("."+interceptReplacePktBin).removeClass("hidden");
$("."+interceptReplacePktBin).find("span").removeClass("hidden");
}
}else {
//白名单
$(".monitAction").addClass("hidden");
@@ -643,6 +642,20 @@ var setDefaultMatchMethod=function (obj){
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").selectpicker("refresh");
}
}
//限流方式
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");
}
}
var switchIpType=function(obj){
var type=$(obj).val();
var row=$(obj).parents('.row');