修改缓存策略参数验证与处理逻辑

This commit is contained in:
zhangwei
2018-11-13 11:14:51 +08:00
parent 9ac9b35d07
commit 71803f7d3b
4 changed files with 77 additions and 30 deletions

View File

@@ -13,6 +13,35 @@
$(document)
.ready(
function() {
$("#ignore_qs").tagsInput({
width:$("#ignore_qs").find(".form-control").width(),
defaultText:'please input ignore query string in URL',
'delimiter':',',//特殊字符串分隔与表达式的多关键词
maxCount:0,
onAddTag:function(tag,size){
var reg = new RegExp(/\t|\r|\n|,/);
if (tag.match(reg)) {
$(this).parents(".col-md-6").next("div").html("<label class='error'><spring:message code='cache_param_character_error'/></label>");
}else{
$(this).parents(".col-md-6").next("div").html("");
}
},
onRemoveTag:function(tag,size){
$(this).parents(".col-md-6").next("div").html("");
}
});
$(".tagsinput").popover({
animation:true,
container:'body',
placement:'right',
html:true,
trigger:"hover",
title:"",
content:function(){
var content = $("#tagsinputTip").text();
return content;
}
});
//initCommIpVal();
/* $("#cancel").on("click", function() {
window.history.back();
@@ -71,67 +100,71 @@
var flag = true;
var subscribeId=0;
if($("#ignore_qs").parents(".col-md-6").next("div").html()!=''){
$("#ignore_qs").parents(".col-md-6").next("div").html("<label class='error'><spring:message code='cache_param_character_error'/></label>");
return;
}
if($("#pinning_time_unit").val()=='h'){
if(parseInt($("#pinning_time").val())>24){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='m'){
if(parseInt($("#pinning_time").val())>1440){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#pinning_time_unit").val()=='s'){
if(parseInt($("#pinning_time").val())>86400){
alert($("#pinning_time").val());
$("div[for='pinning_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#inactive_time_unit").val()=='h'){
if(parseInt($("#inactive_time").val())>24){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='m'){
if(parseInt($("#inactive_time").val())>1440){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}else if($("#inactive_time_unit").val()=='s'){
if(parseInt($("#inactive_time").val())>86400){
alert($("#inactive_time").val());
$("div[for='inactive_time']").append("<label class='error'><spring:message code='cache_time_error'/></label>");
return ;
}
}
if($("#max_cache_size_unit").val()=='t'){
if(parseInt($("#max_cache_size").val())>1024){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='g'){
if(parseInt($("#max_cache_size").val())>1048576){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_size_unit").val()=='m'){
if(parseInt($("#max_cache_size").val())>1073741824){
alert($("#max_cache_size").val());
$("div[for='max_cache_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
if($("#max_cache_obj_size_unit").val()=='t'){
if(parseInt($("#max_cache_obj_size").val())>1024){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='g'){
if(parseInt($("#max_cache_obj_size").val())>1048576){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}else if($("#max_cache_obj_size_unit").val()=='m'){
if(parseInt($("#max_cache_obj_size").val())>1073741824){
alert($("#max_cache_obj_size").val());
$("div[for='max_cache_obj_size']").append("<label class='error'><spring:message code='cache_size_error'/></label>");
return ;
}
}
@@ -357,19 +390,6 @@
</div>
</div>
<div class="row cacheAction">
<%-- <c:set var="propertyName" >ignore_qs</c:set> --%>
<div class="col-md-6 ignore_qs <c:if test='${empty _cfg.userRegion.cache_key.ignore_qs }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_query_string" />
</label>
<div class="col-md-6">
<input id="ignore_qs" name="ignore_qs" class="form-control invisibleChar" type="text"
value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
<div class="col-md-6 cookie <c:if test='${empty _cfg.userRegion.cache_key.cookie }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
@@ -381,6 +401,20 @@
<div for="cookie"></div>
</div>
</div>
<%-- <c:set var="propertyName" >ignore_qs</c:set> --%>
<div class="col-md-6 ignore_qs <c:if test='${empty _cfg.userRegion.cache_key.ignore_qs }'>hidden</c:if>">
<div class="form-group">
<label class="control-label col-md-3">
<spring:message code="ignore_query_string" />
</label>
<div class="col-md-6">
<input id="ignore_qs" name="ignore_qs" class="form-control tags" type="text"
value="${fn:replace(fn:replace(_cfg.userRegion.cache_key.ignore_qs, '[',''),']','')}">
</div>
<div for="ignore_qs"></div>
</div>
</div>
</div>
<div class="row cacheAction">
<div class="col-md-6">
@@ -525,6 +559,7 @@
</c:forEach>
</select>
</div>
<div for="pinning_time"></div>
<%-- <div class="input-group">
<input id="pinning_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
@@ -561,6 +596,7 @@
</c:forEach>
</select>
</div>
<div for="max_cache_size"></div>
<%-- <div class="input-group">
<input id="max_cache_size_g" class="form-control input-small" type="text" />
<span class="input-group-btn">
@@ -589,6 +625,7 @@
</c:forEach>
</select>
</div>
<div for="inactive_time"></div>
<%-- <div class="input-group">
<input id="inactive_time_hour" class="form-control input-xsmall" type="text" />
<span class="input-group-btn">
@@ -627,6 +664,7 @@
</c:forEach>
</select>
</div>
<div for="max_cache_obj_size"></div>
</div>
</div>
</div>