diff --git a/src/main/webapp/static/global/scripts/common.js b/src/main/webapp/static/global/scripts/common.js index b9952cae3..12341e3ac 100644 --- a/src/main/webapp/static/global/scripts/common.js +++ b/src/main/webapp/static/global/scripts/common.js @@ -11,6 +11,7 @@ $(function(){ direction:[] }); $("select[name$='isHexbin']").each(function(){ + console.log("isHexbin:"+$(this).val()); setIsHexBin(this); }); $("input[name$='isHex']").on("change",function(){ @@ -360,13 +361,6 @@ $(function(){ $("#serviceId").val($(this).attr("serviceId")); $("#protocolId").val($(this).attr("protocolId")); }); - //选择hex cfgkeywords需校验十六进制 - $("select[name$='isHexbin']").each(function(){ - $(this).on("change",function(){ - addHexCheck(this,$(this).val()); - }); - addHexCheck(this,$(this).val()); - }); // 校验搜索条件里的时间选框,不允许起始时间晚于终止时间 $("#searchForm").validate({ rules:{ @@ -699,6 +693,14 @@ var setIsHexBin=function(obj){ $("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",true); $("input[name='"+profix+"isCaseSenstive'][value=0]").prop("checked",false); } + if(isHexbin == 1){ //十六进制 + console.log($("input[name='"+profix+"cfgKeywords']").val()); + $("input[name='"+profix+"cfgKeywords']").addClass("hexCheck"); + $("input[name='"+profix+"domain']").addClass("hexCheck"); + }else{ + $("input[name='"+profix+"cfgKeywords']").removeClass("hexCheck"); + $("input[name='"+profix+"domain']").removeClass("hexCheck"); + } return; } var isHex=$("input[name='"+profix+"isHex']:checked").val(); @@ -727,16 +729,15 @@ var setIsHexBin=function(obj){ if($("select[name='"+profix+"isHexbin']").val() == ""){ $("select[name='"+profix+"isHexbin']").find("option[value=0]").prop("selected","selected"); } -} -//选择hex cfgkeywords需校验十六进制 -var addHexCheck=function(obj,isHexbin){ - if(isHexbin == 1){ //十六进制 - $(obj).parent().parent().parent().parent().parent().parent().find("input[name$='cfgKeywords']").addClass("hexCheck"); - $(obj).parent().parent().parent().parent().parent().parent().find("input[name$='domain']").addClass("hexCheck"); + if(isHex == 1){ //十六进制 + console.log($("input[name='"+profix+"cfgKeywords']").val()); + $("input[name='"+profix+"cfgKeywords']").addClass("hexCheck"); + $("input[name='"+profix+"domain']").addClass("hexCheck"); }else{ - $(obj).parent().parent().parent().parent().parent().parent().find("input[name$='cfgKeywords']").removeClass("hexCheck"); - $(obj).parent().parent().parent().parent().parent().parent().find("input[name$='domain']").removeClass("hexCheck"); + $("input[name='"+profix+"cfgKeywords']").removeClass("hexCheck"); + $("input[name='"+profix+"domain']").removeClass("hexCheck"); } + } //与表达式时,只允许为子串匹配 var setDefaultMatchMethod=function (obj){ @@ -828,14 +829,16 @@ var switchAction=function(action){ /*************************action切换时,隐藏白名单和drop的是否记录日志*****************************/ //drop whitelist - if(action == 32 || action==128){ + if(action == 32 || action==128 || action==96){ $(".doLog").addClass("hidden"); $("input[name=doLog][value=0]").prop("checked",true); + $(".interceptDoLog").find("input[name=doLog][value=0]").prop("checked",true); }else{ //如果表单非修改时,选中默认值 if(!$("input[name='compileId']").val()){ $(".doLog").removeClass("hidden"); $("input[name=doLog][value=2]").prop("checked",true); + $(".interceptDoLog").find("input[name=doLog][value=1]").prop("checked",true); } } @@ -1390,11 +1393,7 @@ var GetLogTotal=function(_data){ for(var i=0;i"+data[i].sum+""); - }else{ - $(this).html(data[i].sum); - } + $(this).html(""+data[i].sum+""); hasLog=true; } } @@ -1436,7 +1435,8 @@ var toLogSearch = function(index){ var date=$(this).attr("date"); var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4); - window.location.href = pathName+"/toLogSearch?action="+action+"&functionId="+functionId+"&compileId="+compileId+"&date="+date; + window.location.href = pathName+"/toLogSearch?action="+action+"&functionId="+functionId+"&cfgId="+compileId+"&date="+date+"&isLogTotalSearch=yes"; + } }); @@ -1571,6 +1571,39 @@ var importCfg=function(){ $("#import_modal").modal('hide');//导入文件隐藏 $("#importForm1").submit(); } +var validateTagInputKeyword=function(){ + var flag=true; + $(".boxSolid:visible").find("input[name$='cfgKeywords']").each(function(){ + if($(this).val()==''){ + $(this).parents(".form-group").find( + "div[for='" + + $(this).attr("name") + + "']").html(""); + return false; + } + }); + if(flag){ + //keywords非空校验完成校验二进制字符串 + $(".boxSolid:visible").find("select[name$='isHexbin']").each(function(){ + var isHexbin=$(this).val(); + var configMultiKeywords=$("input[name$='"+$(this).attr("name").replace("isHexbin","configMultiKeywords")+"']").val(); + if(isHexbin == 1 && configMultiKeywords==1){ //十六进制 + var keywords=$("input[name$='"+$(this).attr("name").replace("isHexbin","cfgKeywords")+"']").val(); + keywords=keywords.replace("***and***","") + if(keywords != ''){ + if(!(/^([0-9|a-f|A-F]*)$/.test(keywords))){ + $(this).parents(".boxSolid").find( + "div[for='" + + $(this).attr("name").replace("isHexbin","cfgKeywords") + + "']").html(""); + flag = false; + } + } + } + }); + } + return flag; +} var validateInvisibleCharTag=function(){ var hasInvisibleCharTags=[]; var reg = new RegExp(/\t|\r|\n/);