Conflicts: src/main/resources/messages/message_en.properties src/main/resources/messages/message_zh_CN.properties 修改是否十六进制选项选中值
1479 lines
52 KiB
JavaScript
1479 lines
52 KiB
JavaScript
$(function(){
|
||
$("select[name$='isHexbin']").each(function(){
|
||
setIsHexBin(this);
|
||
});
|
||
$("input[name$='isHex']").on("change",function(){
|
||
setIsHexBin(this);
|
||
});
|
||
$("input[name$='isCaseSenstive']").on("change",function(){
|
||
setIsHexBin(this);
|
||
});
|
||
setHexCaseSenstive();
|
||
$("a[name=viewLogInfo]>i").on("click",function(){
|
||
var html = "<div class='logInfo'>";
|
||
$(this).parents("tr").find("td").each(function(index,element){
|
||
if(index >0){
|
||
var text="";
|
||
if($(element).find(".tooltips").length > 0){
|
||
text=$(element).find(".tooltips").attr("data-original-title").trim();
|
||
}else{
|
||
text=$(element).text().trim()
|
||
}
|
||
html+="<div class='row col-md-12'>";
|
||
html+="<div class='col-md-4'><label>"+$(".table tr th").eq(index).text().trim()+":</label></div>";
|
||
html+="<div class='col-md-6'><label>"+text+"</label></div>";
|
||
html+="</div>";
|
||
|
||
}
|
||
})
|
||
html +="</div>";
|
||
|
||
top.$.jBox(html,{height:400,width:400,title:"<i class='icon-book-open'></i> Log Info",showIcon:false,opacity:0.5});
|
||
})
|
||
var tree2 = $("select[name=lableTest]").treeMultiselect({
|
||
searchable: true,
|
||
hideSidePanel:true,
|
||
startCollapsed:true
|
||
});
|
||
var tree1 = $("select[name=classifyTest]").treeMultiselect({
|
||
searchable: true,
|
||
hideSidePanel:true,
|
||
startCollapsed:true
|
||
});
|
||
//全选及取消
|
||
$("#checkAll").change(function(){
|
||
if($("#checkAll").prop("checked")){
|
||
$("input.i-checks").prop("checked",true);
|
||
}else{
|
||
$("input.i-checks").prop("checked",false);
|
||
}
|
||
});
|
||
|
||
$("select[name$='ipType']").each(function(){
|
||
switchIpInfo(this);
|
||
})
|
||
$("select[name$='exprType']").each(function(){
|
||
switchIpInfo(this);
|
||
})
|
||
$("select[name$='ipType']").on("change",function(){
|
||
switchIpInfo(this);
|
||
});
|
||
$("select[name$='ipPattern']").on("change",function(){
|
||
switchIpInfo(this);
|
||
});
|
||
$("select[name$='portPattern']").on("change",function(){
|
||
switchIpInfo(this);
|
||
});
|
||
|
||
switchAction($("input[name='action']:checked").val());
|
||
setInterceptDefaultInfo($("input[name='cfgId']").val());
|
||
|
||
$(".glyphicon-plus").on("click",function(){
|
||
var obj=$(this).parents(".form-section").next(".container-fluid").clone();
|
||
var len=$(this).parents("div").find(".container-fluid:visible").size();
|
||
if($(this).parent().parent().parent().attr("id")=="areaIp"){
|
||
obj.find("[id^='_areaCfg']").each(function(){
|
||
var name=$(this).attr("id").replace("_areaCfg.","");
|
||
$(this).removeAttr("id");
|
||
$(this).attr("name","areaCfg["+len+"]."+name);
|
||
$(this).parents(".form-group").find("div[for^='_areaCfg']").attr("for","areaCfg["+len+"]."+name);
|
||
$(this).selectpicker("refresh");
|
||
});
|
||
obj.removeClass("hidden");
|
||
switchIpInfo(obj.find("select[name$='ipType']"));
|
||
obj.find("select[name$='ipType']").on("change",function(){
|
||
switchIpInfo($(this));
|
||
});
|
||
obj.find("select[name$='ipPattern']").on("change",function(){
|
||
switchIpInfo($(this));
|
||
});
|
||
obj.appendTo("#areaIp");
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
if(!$(this).hasClass("hidden")) $(this).remove();
|
||
});
|
||
if(len==0){
|
||
$("#areaIp").find(".container-fluid:visible").eq(0).find("span[title=remove]").addClass("hidden");
|
||
}
|
||
}else if($(this).parent().parent().parent().attr("id")=="areaIsp"){
|
||
obj.find("[name^='areaCode']").each(function(){
|
||
$(this).attr("name","areaIsp["+len+"].area");
|
||
$(this).parents(".form-group").find("div[for^='areaCode']").attr("for","areaIsp["+len+"].area");
|
||
$(this).selectpicker("refresh");
|
||
});
|
||
obj.find("[name^='ispCode']").each(function(){
|
||
$(this).attr("name","areaIsp["+len+"].isp");
|
||
$(this).selectpicker("refresh");
|
||
});
|
||
obj.removeClass("hidden");
|
||
obj.appendTo("#areaIsp");
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
if(!$(this).hasClass("hidden")) $(this).remove();
|
||
});
|
||
if(len==0){
|
||
$("#areaIsp").find(".container-fluid:visible").eq(0).find("span[title=remove]").addClass("hidden");
|
||
}
|
||
}
|
||
});
|
||
$("input[name='areaType']").on('change',function(){
|
||
var val=$(this).val();
|
||
if($(this).is(":visible")){
|
||
if(val==0){
|
||
$("#areaIp").removeClass("hidden");
|
||
$("#areaIsp").addClass("hidden");
|
||
if($("#areaIp").find(".container-fluid:visible").size() <1){
|
||
$("#areaIp").find(".glyphicon-plus").click();
|
||
}
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
});
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}else{
|
||
$("#areaIsp").removeClass("hidden");
|
||
$("#areaIp").addClass("hidden");
|
||
if($("#areaIsp").find(".container-fluid:visible").size() <1){
|
||
$("#areaIsp").find(".glyphicon-plus").click();
|
||
}
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
});
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}
|
||
}else{
|
||
$("#areaIsp").addClass("hidden");
|
||
$("#areaIp").addClass("hidden");
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}
|
||
});
|
||
$("input[name='isAreaEffective']").on('change',function(){
|
||
var val=$(this).val();
|
||
if(val==1){
|
||
$(".areaType").find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
});
|
||
$(".areaType").removeClass("hidden");
|
||
if($("input[name='areaType']:checked").val()==1){//areaISP
|
||
$("#areaIsp").removeClass("hidden");
|
||
if($("#areaIsp").find(".container-fluid:visible").size() <1){
|
||
$("#areaIsp").find(".glyphicon-plus").click();
|
||
}
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
});
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}else if($("input[name='areaType']:checked").val()==0){//areaIp
|
||
$("#areaIp").removeClass("hidden");
|
||
if($("#areaIp").find(".container-fluid:visible").size() <1){
|
||
$("#areaIp").find(".glyphicon-plus").click();
|
||
}
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
});
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}else{
|
||
$(".areaType").find("[value='1']").prop("checked",true);
|
||
$("#areaIsp").removeClass("hidden");
|
||
if($("#areaIsp").find(".container-fluid:visible").size() <1){
|
||
$("#areaIsp").find(".glyphicon-plus").click();
|
||
}
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
});
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}
|
||
|
||
}else{
|
||
$(".areaType").addClass("hidden");
|
||
$("#areaIp").addClass("hidden");
|
||
$("#areaIsp").addClass("hidden");
|
||
|
||
$(".areaType").find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
});
|
||
$("#areaIsp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
$("#areaIp").find(".container-fluid").each(function(){
|
||
$(this).find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
})
|
||
});
|
||
}
|
||
});
|
||
areaControlInit();
|
||
/*=====关键字与表达式处理 开始=====*/
|
||
var tagsInputSettings="#tags";
|
||
$("input[name$='cfgKeywords']").each(function(){
|
||
var tagsId = $(this).attr("id");
|
||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||
var isTags = $(this).hasClass("tags");//有tags样式的关键字输入框才需处理
|
||
if(typeof(tagsId)!=='undefined' && tagsId.indexOf("tags_")!=-1 && isTags){
|
||
if($("input:radio[name='"+objNamePrefix+"exprType']").val()==1){
|
||
$("select[name='"+objNamePrefix+"matchMethod']").find("option[value!=0]").attr("disabled",true);
|
||
}
|
||
//表单中如果有关键字内容可能输入多个关键字的情况,根据输入关键字个数确定表达式选中情况,不允许手动选中
|
||
$("input:radio[name='"+objNamePrefix+"exprType']").attr("disabled",true);
|
||
tagsInputSettings = tagsInputSettings+",#"+tagsId;
|
||
}
|
||
|
||
});
|
||
$(tagsInputSettings).tagsInput({
|
||
width:$(tagsInputSettings).find(".form-control").width(),
|
||
defaultText:'please input keywords',
|
||
'delimiter':'***and***',//特殊字符串分隔与表达式的多关键词
|
||
maxCount:4,
|
||
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'>"+$.validator.messages.hasInvisibleChar.replace("{0}","'"+tag+"'")+"</label>");
|
||
}else{
|
||
$(this).parents(".col-md-6").next("div").html("");
|
||
}
|
||
//var keywordValue = "";
|
||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||
/*$("span[class='tag']").each(function(){
|
||
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim();
|
||
});
|
||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||
exprTypeChecked(objNamePrefix,size);
|
||
},
|
||
onRemoveTag:function(tag,size){
|
||
$(this).parents(".col-md-6").next("div").html("");
|
||
//var keywordValue = "";
|
||
var objNamePrefix = $(this).attr("name").split("cfgKeywords")[0];
|
||
/*$("span[class='tag']").each(function(){
|
||
keywordValue = keywordValue+"***iie***"+$(this).find("span").text().trim();
|
||
});
|
||
$(this).prev("input[name$='cfgKeywords']").val(keywordValue);*/
|
||
exprTypeChecked(objNamePrefix,size);
|
||
}
|
||
});
|
||
$(".tagsinput").popover({
|
||
animation:true,
|
||
container:'body',
|
||
placement:'right',
|
||
html:true,
|
||
trigger:"hover",
|
||
title:"",
|
||
content:function(){
|
||
var content = $("#tagsinputTip").text();
|
||
return content;
|
||
}
|
||
});
|
||
/*=====关键字与表达式处理 结束=====*/
|
||
/*$("input[name$='cfgKeywords']").each(function(){
|
||
if($(this).hasClass("tags")){
|
||
if($(this).val()==''){
|
||
$(this).parents(".form-group").find(
|
||
"div[for='"
|
||
+ $(this).attr("name")
|
||
+ "']").html("<label id=\"cfgKeywordsError\" class=\"error\">"+$("#keywordError").text()+"</label>");
|
||
flag = false;
|
||
return;
|
||
}
|
||
}
|
||
})*/
|
||
|
||
//处理增强字符串配置的匹配区域
|
||
$(".district").each(function(){
|
||
if($(this).siblings(".otherValue").val()!=''){
|
||
if($(this).val()!=$(this).siblings(".otherValue").val()){
|
||
$(this).find("option[value=others]").attr("selected","selected");
|
||
$(this).siblings(".otherValue").prop("type","text");
|
||
}
|
||
}
|
||
|
||
});
|
||
$("input[name$='exprType']").on("change",function(){
|
||
setDefaultMatchMethod(this);
|
||
});
|
||
$("input[name$='exprType']:checked").each(function(){
|
||
setDefaultMatchMethod(this);
|
||
});
|
||
/*
|
||
*配置展示日志总数,审核通过才会调用接口查询日志总量
|
||
必须放在是否审核一列之后
|
||
并且是否审核一列的span标签需配置data-audit="xxxx"属性
|
||
xxxx可用值为created,approved,unapproved,cancel
|
||
td需要配置属性有,functionId,compileId,action
|
||
*/
|
||
$("td[compileId]").each(function(){
|
||
var audit=$(this).prev().find("span").data("audit");
|
||
if(audit == "approved"){
|
||
var data={};
|
||
data.date=new Date();
|
||
data.compileId=$(this).attr("compileId");
|
||
data.action=$(this).attr("action");
|
||
data.functionId=$(this).attr("functionId");
|
||
data.audit=$(this).attr("audit");
|
||
data.obj=$(this)
|
||
GetLogTotal(data);
|
||
}else{
|
||
$(this).html("0");
|
||
}
|
||
});
|
||
$(".action").on("change", 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:{
|
||
"searchFoundStartTime": {
|
||
},
|
||
"searchFoundEndTime": {
|
||
compareDate: "[name=searchFoundStartTime]"
|
||
},
|
||
"search_create_time_start": {
|
||
},
|
||
"search_create_time_end": {
|
||
compareDate: "[name=search_create_time_start]"
|
||
},
|
||
"search_edit_time_start": {
|
||
},
|
||
"search_edit_time_end": {
|
||
compareDate: "[name=search_edit_time_start]"
|
||
},
|
||
"search_audit_time_start": {
|
||
},
|
||
"search_audit_time_end": {
|
||
compareDate: "[name=search_audit_time_start]"
|
||
},
|
||
"beginDate": {
|
||
},
|
||
"endDate": {
|
||
compareDate: "[name=beginDate]"
|
||
},
|
||
"dobeginDate": {
|
||
},
|
||
"doendDate": {
|
||
compareDate: "[name=dobeginDate]"
|
||
},
|
||
"editBeginDate": {
|
||
},
|
||
"editEndDate": {
|
||
compareDate: "[name=editBeginDate]"
|
||
},
|
||
"capIp":{
|
||
ipv4v6:true
|
||
},
|
||
"sIp":{
|
||
ipv4v6:true
|
||
},
|
||
"dIp":{
|
||
ipv4v6:true
|
||
}
|
||
},
|
||
submitHandler: function(form){
|
||
loading('<spring:message code="onloading"/>');
|
||
form.submit();
|
||
}
|
||
});
|
||
/* $("#ipCfgFrom input, #cfgForm input, #cfgFrom input").change(function(){
|
||
var s = $(this).val();
|
||
var ns = s.replace(/\t|\r|\n/mg, "");
|
||
$(this).val(ns);
|
||
});*/
|
||
$("input[name*='userRegion']").addClass("invisibleChar");
|
||
$("#cancel").on("click",function(){
|
||
window.history.back();
|
||
return false;
|
||
});
|
||
initCommIpVal();
|
||
});
|
||
window.onload=function(){
|
||
//日志查询IP类型增加格式提示
|
||
$("#searchForm [name='capIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||
$("#searchForm [name='sIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||
$("#searchForm [name='dIp']").attr("placeholder","IPv4 0.0.0.0 or IPv6 ::");
|
||
// 动态调整日志页搜索框的样式,防止validate的错误提示导致样式错乱
|
||
var igHeight = $("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").height();
|
||
$("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").bind("DOMNodeInserted",function(e) {
|
||
var newIgHeight = $("#searchForm").find(".col-md-12").eq(0).height();
|
||
$("#searchForm").find(".col-md-12").find(".pull-left").find(".input-group").find(".input-group-btn").css("padding-bottom", (newIgHeight-igHeight)+"px");
|
||
});
|
||
|
||
}
|
||
var setInterceptDefaultInfo=function(cfgId){
|
||
var action=$("input[name='action']:checked").val();
|
||
var interceptRatelimitIp="";
|
||
var interceptReplacePktBin="";
|
||
var protocolNamePrefix="";
|
||
//查找当前业务中的serviceRegionType,是否存在intercept_ratelimit_ip
|
||
$("input[name$='configServiceType']").each(function(){
|
||
//替换动作非tcp
|
||
var serviceRegionTypeValue=$(this).val();
|
||
var serviceRegionTypeName=$(this).attr("name");
|
||
if(serviceRegionTypeName.indexOf(".") >-1){
|
||
serviceRegionTypeName=serviceRegionTypeName.substring(0,serviceRegionTypeName.indexOf(".")+1);
|
||
}else{
|
||
serviceRegionTypeName="";
|
||
}
|
||
if(serviceRegionTypeValue == 'intercept_ratelimit_ip'){
|
||
interceptRatelimitIp=serviceRegionTypeValue;
|
||
protocolNamePrefix=serviceRegionTypeName;
|
||
}
|
||
if(serviceRegionTypeValue == 'intercept_replace_pkt_bin'){
|
||
interceptReplacePktBin=serviceRegionTypeValue;
|
||
}
|
||
});
|
||
|
||
if(action==1){
|
||
//监测
|
||
$(".monitAction").removeClass("hidden");
|
||
$(".ratelimitAction").addClass("hidden");
|
||
$(".replaceAction").addClass("hidden");
|
||
if(interceptRatelimitIp == 'intercept_ratelimit_ip'){
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=0]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=6]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=17]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=1]").attr("disabled",true);
|
||
$("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh");
|
||
}
|
||
if(interceptReplacePktBin == 'intercept_replace_pkt_bin'){
|
||
$("."+interceptReplacePktBin).addClass("hidden");
|
||
$("."+interceptReplacePktBin+"_div").addClass("hidden");
|
||
}
|
||
}else if(action==64){
|
||
//限速
|
||
$(".monitAction").addClass("hidden");
|
||
$(".ratelimitAction").removeClass("hidden");
|
||
$(".replaceAction").addClass("hidden");
|
||
if(interceptRatelimitIp == 'intercept_ratelimit_ip'){
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=0]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=6]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=17]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=1]").attr("disabled",true);
|
||
$("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh");
|
||
}
|
||
if(interceptReplacePktBin == 'intercept_replace_pkt_bin'){
|
||
$("."+interceptReplacePktBin).addClass("hidden");
|
||
$("."+interceptReplacePktBin+"_div").addClass("hidden");
|
||
}
|
||
}else if(action==80){
|
||
//替换
|
||
$(".monitAction").addClass("hidden");
|
||
$(".ratelimitAction").addClass("hidden");
|
||
$(".replaceAction").removeClass("hidden");
|
||
if(interceptRatelimitIp == 'intercept_ratelimit_ip'){
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=0]").attr("disabled",true);
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=6]").attr("disabled",true);
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=17]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=1]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh");
|
||
}
|
||
if(interceptReplacePktBin == 'intercept_replace_pkt_bin' && cfgId == ""){
|
||
$("."+interceptReplacePktBin).removeClass("hidden");
|
||
$("."+interceptReplacePktBin).find("span").removeClass("hidden");
|
||
}
|
||
|
||
|
||
}else {
|
||
//白名单
|
||
$(".monitAction").addClass("hidden");
|
||
$(".ratelimitAction").addClass("hidden");
|
||
$(".replaceAction").addClass("hidden");
|
||
if(interceptRatelimitIp == 'intercept_ratelimit'){
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=0]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=6]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=17]").removeAttr("disabled");
|
||
$("select[name='"+protocolNamePrefix+"protocol']").find("option[value=1]").attr("disabled",true);
|
||
$("select[name='"+protocolNamePrefix+"protocol']").selectpicker("refresh");
|
||
}
|
||
if(interceptReplacePktBin == 'intercept_replace_pkt_bin'){
|
||
$("."+interceptReplacePktBin).addClass("hidden");
|
||
$("."+interceptReplacePktBin+"_div").addClass("hidden");
|
||
}
|
||
}
|
||
|
||
}
|
||
//0 非十六进制 大小不敏感 1 十六进制,大小写不敏感 2非十六进制 大小写敏感
|
||
var setIsHexBin=function(obj){
|
||
var profix="";
|
||
if($(obj).attr("name").indexOf(".") > -1){
|
||
profix=$(obj).attr("name").substring(0,$(obj).attr("name").indexOf(".")+1);
|
||
}
|
||
if($(obj).attr("name").indexOf("isHexbin") > -1){
|
||
var isHexbin=$(obj).val();
|
||
if(isHexbin == 0){
|
||
$("input[name='"+profix+"isHex'][value=0]").prop("checked",true);
|
||
$("input[name='"+profix+"isHex'][value=1]").prop("checked",false);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=0]").prop("checked",true);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",false);
|
||
}else if(isHexbin == 1){
|
||
$("input[name='"+profix+"isHex'][value=1]").prop("checked",true);
|
||
$("input[name='"+profix+"isHex'][value=0]").prop("checked",false);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=0]").prop("checked",true);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",false);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().addClass("hidden");
|
||
}else if(isHexbin == 2){
|
||
$("input[name='"+profix+"isHex'][value=0]").prop("checked",true);
|
||
$("input[name='"+profix+"isHex'][value=1]").prop("checked",false);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",true);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=0]").prop("checked",false);
|
||
}
|
||
return;
|
||
}
|
||
var isHex=$("input[name='"+profix+"isHex']:checked").val();
|
||
//如果选择十六进制,则必须发小写不敏感
|
||
if(isHex == 1){
|
||
$("input[name='"+profix+"isCaseSenstive'][value=0]").prop("checked",true);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").prop("checked",false);
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().addClass("hidden");
|
||
}else{
|
||
$("input[name='"+profix+"isCaseSenstive'][value=1]").parent().removeClass("hidden");
|
||
}
|
||
var isCaseSenstive=$("input[name='"+profix+"isCaseSenstive']:checked").val();
|
||
//设置isHexbin下拉框的值
|
||
if(isHex == 0 && isCaseSenstive==0){
|
||
$("select[name='"+profix+"isHexbin']").find("option").prop("selected","");
|
||
$("select[name='"+profix+"isHexbin']").find("option[value=0]").prop("selected","selected");
|
||
}
|
||
if(isHex == 1 && isCaseSenstive==0){
|
||
$("select[name='"+profix+"isHexbin']").find("option").prop("selected","");
|
||
$("select[name='"+profix+"isHexbin']").find("option[value=1]").prop("selected","selected");
|
||
}
|
||
if(isHex == 0 && isCaseSenstive==1){
|
||
$("select[name='"+profix+"isHexbin']").find("option").prop("selected","");
|
||
$("select[name='"+profix+"isHexbin']").find("option[value=2]").prop("selected","selected");
|
||
}
|
||
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");
|
||
}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");
|
||
}
|
||
}
|
||
//与表达式时,只允许为子串匹配
|
||
var setDefaultMatchMethod=function (obj){
|
||
var exprType = $(obj).val();
|
||
if(exprType == 1){
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").find("option").removeAttr("selected");
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").find("option[value=0]").attr("selected","selected");
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").find("option[value!=0]").attr("disabled",true);
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").selectpicker("refresh");
|
||
}else{
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").find("option").removeAttr("disabled");
|
||
$(obj).parents(".row").parent(".row").find("select[name$='matchMethod']").selectpicker("refresh");
|
||
}
|
||
}
|
||
var switchIpType=function(obj){
|
||
var type=$(obj).val();
|
||
var row=$(obj).parents('.row');
|
||
var ipPattern=row.siblings().find("input[name$='ipPattern']");
|
||
var portPattern=row.siblings().find("input[name$='portPattern']");
|
||
var srcIp=row.siblings().find("input[name$='srcIpAddress']");
|
||
var dstIp=row.siblings().find("input[name$='destIpAddress']");
|
||
var srcPort=row.siblings().find("input[name$='srcPort']");
|
||
var dstPort=row.siblings().find("input[name$='destPort']");
|
||
if(4==type){
|
||
if(!$(srcIp).val()){
|
||
$(srcIp).val("0.0.0.0");
|
||
}else if($(srcIp).val()=="::"){
|
||
$(srcIp).val("0.0.0.0");
|
||
}
|
||
if(!$(dstIp).val()){
|
||
$(dstIp).val("0.0.0.0");
|
||
}else if($(dstIp).val()=="::"){
|
||
$(dstIp).val("0.0.0.0");
|
||
}
|
||
if(!$(srcPort).val()){
|
||
$(srcPort).val("0");
|
||
}
|
||
if(!$(dstPort).val()){
|
||
$(dstPort).val("0");
|
||
}
|
||
}
|
||
if(6==type){
|
||
if(!$(srcIp).val()){
|
||
$(srcIp).val("::");
|
||
}else if($(srcIp).val()=="0.0.0.0"){
|
||
$(srcIp).val("::");
|
||
}
|
||
if(!$(dstIp).val()){
|
||
$(dstIp).val("::");
|
||
}else if($(dstIp).val()=="0.0.0.0"){
|
||
$(dstIp).val("::");
|
||
}
|
||
if(!$(srcPort).val()){
|
||
$(srcPort).val("0");
|
||
}
|
||
if(!$(dstPort).val()){
|
||
$(dstPort).val("0");
|
||
}
|
||
}
|
||
}
|
||
var switchAction=function(action){
|
||
/********************dns reject时选择策略**********************/
|
||
if(action == 16){ //reject
|
||
$(".policy").find("input,select,div,button").each(function(){
|
||
$(this).removeAttr("disabled");
|
||
$(this).removeClass("hidden");
|
||
$(this).removeClass("disabled");
|
||
})
|
||
}else{
|
||
$(".policy").find("input,select,div,button").each(function(){
|
||
$(this).attr("disabled","disabled");
|
||
$(this).addClass("hidden");
|
||
})
|
||
}
|
||
|
||
/*************************action切换时,隐藏白名单和drop的是否记录日志*****************************/
|
||
//drop whitelist
|
||
if(action == 32 || action==128){
|
||
$(".doLog").addClass("hidden");
|
||
$("input[name=doLog][value=0]").prop("checked",true);
|
||
}else{
|
||
$(".doLog").removeClass("hidden");
|
||
$("input[name=doLog][value=2]").prop("checked",true);
|
||
}
|
||
}
|
||
//ipType、ipPattern、portPattern选项变化时调用此方法,添加默认值
|
||
var switchIpInfo=function(obj){
|
||
var ipType="";
|
||
var ipPattern="";
|
||
var portPattern="";
|
||
|
||
var row=$(obj).parents('.row').parent('.row');
|
||
ipType=row.find("select[name$='ipType']").val();
|
||
ipPattern=row.find("select[name$='ipPattern']").val();
|
||
portPattern=row.find("select[name$='portPattern']").val();
|
||
var srcIp=row.find("input[name$='srcIpAddress']");
|
||
var destIp=row.find("input[name$='destIpAddress']");
|
||
var srcPort=row.find("input[name$='srcPort']");
|
||
var destPort=row.find("input[name$='destPort']");
|
||
|
||
var srcIpV4Default=new Array();
|
||
srcIpV4Default[0]="0.0.0.0/32"; //subnet
|
||
srcIpV4Default[1]="0.0.0.0-0.0.0.0";//ip_range
|
||
srcIpV4Default[2]="0.0.0.0"; //ip
|
||
|
||
var destIpV4Default=new Array();
|
||
destIpV4Default[0]="0.0.0.0/32"; //subnet
|
||
destIpV4Default[1]="0.0.0.0-0.0.0.0";//ip_range
|
||
destIpV4Default[2]="0.0.0.0"; //ip
|
||
|
||
|
||
var srcIpV6Default=new Array();
|
||
srcIpV6Default[0]="::/64"; //subnet
|
||
srcIpV6Default[1]="::-::";//ip_range
|
||
srcIpV6Default[2]="::"; //ip
|
||
|
||
var destIpV6Default=new Array();
|
||
destIpV6Default[0]="::/64"; //subnet
|
||
destIpV6Default[1]="::-::";//ip_range
|
||
destIpV6Default[2]="::"; //ip
|
||
|
||
var portDefault=new Array();
|
||
portDefault[0]="0";//port
|
||
portDefault[1]="0/65535";//port_mask
|
||
|
||
//IPv4设置默认值
|
||
if(4==ipType){
|
||
if(!$(srcIp).val()){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(srcIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV6Default) > -1){ //是ipV4的默认值其中一个
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}
|
||
}
|
||
}
|
||
if(!$(destIp).val()){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}else{
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(destIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV6Default) > -1){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}else{
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(6==ipType){
|
||
if(!$(srcIp).val()){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(srcIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV6Default) > -1){ //是ipV6的默认值其中一个
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}
|
||
}
|
||
}
|
||
if(!$(destIp).val()){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}else{
|
||
$(destIp).val(srcIpV6Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(destIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV6Default) > -1){ //是ipV6的默认值其中一个
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}else{
|
||
$(destIp).val(srcIpV6Default[2]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(46==ipType){
|
||
if(!$(srcIp).val()){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(srcIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV6Default) > -1){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}else {
|
||
$(srcIp).val(srcIpV4Default[2]);
|
||
}
|
||
}
|
||
}
|
||
if(!$(destIp).val()){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}else{
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(destIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV6Default) > -1){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}else{
|
||
$(destIp).val(destIpV6Default[2]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
if(64==ipType){
|
||
if(!$(srcIp).val()){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(srcIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(srcIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(srcIp).val(),destIpV6Default) > -1){
|
||
if(ipPattern==1){
|
||
$(srcIp).val(srcIpV6Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(srcIp).val(srcIpV6Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}else{
|
||
$(srcIp).val(srcIpV6Default[2]);
|
||
}
|
||
}
|
||
}
|
||
if(!$(destIp).val()){
|
||
if(ipPattern==1){
|
||
$(destIp).val(srcIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(srcIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(srcIpV4Default[2]);
|
||
}else{
|
||
$(destIp).val(srcIpV4Default[2]);
|
||
}
|
||
}else{
|
||
if($.inArray($(destIp).val(),srcIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV4Default) > -1
|
||
|| $.inArray($(destIp).val(),srcIpV6Default) > -1
|
||
|| $.inArray($(destIp).val(),destIpV6Default) > -1){
|
||
if(ipPattern==1){
|
||
$(destIp).val(destIpV4Default[0]);
|
||
}else if(ipPattern==2){
|
||
$(destIp).val(destIpV4Default[1]);
|
||
}else if(ipPattern==3){
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}else{
|
||
$(destIp).val(destIpV4Default[2]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
//设置源端口默认值
|
||
if(!$(srcPort).val()){
|
||
if(portPattern==1){
|
||
$(srcPort).val(portDefault[0]);
|
||
}else if(portPattern==2){
|
||
$(srcPort).val(portDefault[1]);
|
||
}else{
|
||
$(srcPort).val(portDefault[0]);
|
||
}
|
||
}else{
|
||
if($.inArray($(srcPort).val(),portDefault) > -1){ //是ipV4的默认值其中一个
|
||
if(portPattern==1){
|
||
$(srcPort).val(portDefault[0]);
|
||
}else if(portPattern==2){
|
||
$(srcPort).val(portDefault[1]);
|
||
}else{
|
||
$(srcPort).val(portDefault[0]);
|
||
}
|
||
}
|
||
}
|
||
//设置目的端口默认值
|
||
if(!$(destPort).val()){
|
||
if(portPattern==1){
|
||
$(destPort).val(portDefault[0]);
|
||
}else if(portPattern==2){
|
||
$(destPort).val(portDefault[1]);
|
||
}else{
|
||
$(destPort).val(portDefault[0]);
|
||
}
|
||
}else{
|
||
if($.inArray($(destPort).val(),portDefault) > -1){ //是port的默认值其中一个
|
||
if(portPattern==1){
|
||
$(destPort).val(portDefault[0]);
|
||
}else if(portPattern==2){
|
||
$(destPort).val(portDefault[1]);
|
||
}else{
|
||
$(destPort).val(portDefault[0]);
|
||
}
|
||
}
|
||
}
|
||
}
|
||
var areaControlInit=function(){
|
||
if($("input[name='isAreaEffective']:checked").val()==1){
|
||
$(".areaType").removeClass("hidden");
|
||
if($("input[name='areaEffectiveIds']").val()){
|
||
$(".areaType").find("[value='1']").prop("checked",true);
|
||
$("#areaIsp").removeClass("hidden");
|
||
$("#areaIp").addClass("hidden");
|
||
}else{
|
||
$(".areaType").find("[value='0']").prop("checked",true);
|
||
$("#areaIp").removeClass("hidden");
|
||
$("#areaIsp").addClass("hidden");
|
||
}
|
||
}else{
|
||
$("input[name='areaEffectiveIds']").val("");
|
||
$("input[name='isAreaEffective']").find("[value='0']").prop("checked",true);
|
||
}
|
||
}
|
||
//查询
|
||
var page=function(n,s){
|
||
$("#intype").attr("name",$("#seltype").val());
|
||
$("#pageNo").val(n);
|
||
$("#pageSize").val(s);
|
||
$("#searchForm").submit();
|
||
return false;
|
||
}
|
||
|
||
//show more 添加更多属性
|
||
var more=function(obj){
|
||
var clickTimes=$(obj).data("click-times");
|
||
if(clickTimes==0){
|
||
$(".port").removeClass("hidden").removeClass("disabled");
|
||
$(obj).data("click-times",clickTimes+1);
|
||
}
|
||
if(clickTimes==1){
|
||
$(".destPort").removeClass("hidden").removeClass("disabled");
|
||
$(obj).data("click-times",clickTimes+1);
|
||
}
|
||
if(clickTimes==2){
|
||
$(".protocol").removeClass("hidden").removeClass("disabled");
|
||
$(obj).data("click-times",clickTimes+1);
|
||
}
|
||
var rows=$(obj).parent(".row").siblings(".row:hidden");
|
||
if(rows.size()==0){
|
||
$(obj).addClass("hidden");
|
||
}
|
||
}
|
||
|
||
var viewAreaInfo=function(path,areaEffectiveIds,compileId){
|
||
$.ajax({
|
||
type:'post',
|
||
url:path+'/ntc/av/area/ajaxAreaEffictiveInfo',
|
||
data:{"areaEffectiveIds":areaEffectiveIds,"compileId":compileId},
|
||
dataType:'json',
|
||
async:false,
|
||
success:function(data,textStatus){
|
||
if(textStatus=="success"){
|
||
var html = "";
|
||
var title="";
|
||
if(data.areaIsps.length > 0){
|
||
title=$.validator.messages.area;//+" "+$.validator.messages.isp;
|
||
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
|
||
html+="<thead>";
|
||
html+="<th style='width:50%;padding-right:0px'>"+$.validator.messages.area+"</th>";/* +
|
||
"<th style='width:50%;padding-right:0px'>"+$.validator.messages.isp+"</th>";*/
|
||
html+="</thead>";
|
||
html+="<tbody>";
|
||
for(i=0;i<data.areaIsps.length;i++){
|
||
html+="<tr>";
|
||
html+="<td>"+data.areaIsps[i].areaName;
|
||
html+="</td>";
|
||
/*html+="<td>"+data.areaIsps[i].ispName;
|
||
html+="</td>";*/
|
||
html+="</tr>";
|
||
}
|
||
html+="</tbody>";
|
||
html+="</table>";
|
||
}
|
||
if(data.areaIps.length > 0){
|
||
title=$.validator.messages.area+" ip";
|
||
html+="<table class='table table-striped table-bordered table-condensed' style='margin-left: 10px; width: 96%;'>";
|
||
html+="<thead>";
|
||
html+="<th style='width:20%;padding-right:0px'>"+$.validator.messages.ip_type+"</th>" +
|
||
"<th style='width:20%;padding-right:0px'>"+$.validator.messages.ip_pattern+"</th>" +
|
||
"<th style='width:60%;padding-right:0px'>"+$.validator.messages.client_ip+"</th>";
|
||
html+="</thead>";
|
||
html+="<tbody>";
|
||
for(i=0;i<data.areaIps.length;i++){
|
||
html+="<tr>";
|
||
html+="<td>";
|
||
if(data.areaIps[i].ipType==4){
|
||
html+=$.validator.messages.ipv4;
|
||
}
|
||
if(data.areaIps[i].ipType==6){
|
||
html+=$.validator.messages.ipv6;
|
||
}
|
||
if(data.areaIps[i].ipType==46){
|
||
html+=$.validator.messages.over4;
|
||
}
|
||
if(data.areaIps[i].ipType==64){
|
||
html+=$.validator.messages.over6;
|
||
}
|
||
if(data.areaIps[i].ipType==10){
|
||
html+=$.validator.messages.all;
|
||
}
|
||
html+="</td>";
|
||
html+="<td>";
|
||
if(data.areaIps[i].ipPattern==1){
|
||
html+=$.validator.messages.ip_subnet;
|
||
}
|
||
if(data.areaIps[i].ipPattern==2){
|
||
html+=$.validator.messages.ip_range;
|
||
}
|
||
if(data.areaIps[i].ipPattern==3){
|
||
html+="IP";
|
||
}
|
||
html+="</td>";
|
||
html+="<td>"+data.areaIps[i].srcIpAddress;
|
||
html+="</td>";
|
||
html+="</tr>";
|
||
}
|
||
html+="</tbody>";
|
||
html+="</table>";
|
||
}
|
||
top.$.jBox(html,{width: $(document).width()*0.4,height: 400,title:title, buttons:false});
|
||
}
|
||
|
||
}
|
||
|
||
});
|
||
}
|
||
|
||
var GetLogTotal=function(data){
|
||
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.indexOf("/nis")+4);
|
||
var timeStamp=0;
|
||
if(data.date){
|
||
timeStamp=data.date.valueOf();
|
||
}else{
|
||
timeStamp=(new Date()).valueOf();
|
||
}
|
||
var totalTr=$(data.obj);
|
||
var timeout=$.validator.messages.timeout;
|
||
var request=$.ajax({
|
||
type:'post',
|
||
timeout:10000,//超时时间设置,查询接口时间过长超时
|
||
url:pathName+'/report/ajaxGetLogTotal',
|
||
data:{"endTime":timeStamp,"action":data.action,"functionId":data.functionId,"compileId":data.compileId},
|
||
dataType:'json',
|
||
async:true,
|
||
success:function(data,textStatus){//处理返回结果
|
||
if(textStatus=="success"){
|
||
totalTr.html(data.sum);
|
||
}
|
||
},
|
||
complete:function(XMLHttpRequest,status){//超时设置
|
||
if(status=="timeout"){
|
||
totalTr.html(timeout);
|
||
}
|
||
}
|
||
});
|
||
}
|
||
|
||
//删除区域IP
|
||
function delAreaIp(obj){
|
||
var thisObj=$(obj);
|
||
thisObj.parents(".container-fluid").remove();
|
||
var len=$("#areaIp").find(".container-fluid:visible").size();
|
||
//调整角标
|
||
if(len>0){
|
||
len--;
|
||
$("#areaIp").find(".container-fluid:visible").each(function(){
|
||
$(this).find("[name^='areaCfg']").each(function(){
|
||
var name=$(this).attr("name");
|
||
name=name.substring(name.lastIndexOf(".")+1,name.length);
|
||
$(this).attr("name","areaCfg["+len+"]."+name);
|
||
$(this).parents(".form-group").find("div[for^='areaCfg']").attr("for","areaCfg["+len+"]."+name);
|
||
});
|
||
len--;
|
||
});
|
||
}
|
||
}
|
||
//删除区域ISP
|
||
function delAreaIsp(obj){
|
||
var thisObj=$(obj);
|
||
thisObj.parents(".container-fluid").remove();
|
||
var len=$("#areaIsp").find(".container-fluid:visible").size();
|
||
if(len>0){
|
||
len--;
|
||
$("#areaIsp").find(".container-fluid:visible").each(function(){
|
||
$(this).find("[name^='areaIsp']").each(function(){
|
||
var name=$(this).attr("name");
|
||
name=name.substring(name.lastIndexOf(".")+1,name.length);
|
||
$(this).attr("name","areaIsp["+len+"]."+name);
|
||
$(this).parents(".form-group").find("div[for^='areaIsp']").attr("for","areaIsp["+len+"]."+name);
|
||
});
|
||
len--;
|
||
});
|
||
}
|
||
}
|
||
//切换配置列表中显示子配置的选项卡样式
|
||
function switchSubCfgTabInfo(flag,index){
|
||
$("div[name='subCfg"+index+"']").hide();
|
||
$("div[id='"+flag+"Info"+index+"']").show();
|
||
$("div[name='tabTitle"+index+"']").removeClass("badge-info");
|
||
$("div[id='"+flag+"Title"+index+"']").addClass("badge-info");
|
||
$("i[name='tabFlag"+index+"']").addClass("fa-angle-double-up");
|
||
$("i[name='tabFlag"+index+"']").removeClass("fa-angle-double-down");
|
||
$("i[id='"+flag+index+"']").addClass("fa-angle-double-down");
|
||
$("i[id='"+flag+index+"']").removeClass("fa-angle-double-up");
|
||
}
|
||
function isLicit(str,regStr) {//判断是否为合格字符 //s 包括空格回车等特殊字符
|
||
regStr = App.isEmpty(regStr)?"^[_0-9a-zA-Z\u4e00-\u9fa5\.@&]*$":regStr;
|
||
var re = new RegExp(regStr);
|
||
//var re = "^[_0-9a-zA-Z\.@]*$";
|
||
return re.test(str);
|
||
}
|
||
function exprTypeChecked(objNamePrefix,size){
|
||
if(size>1) {
|
||
$("input:radio[name='"+objNamePrefix+"exprType'][value=1]").prop("checked",true); //选中是
|
||
$("select[name='"+objNamePrefix+"matchMethod']").find("option").removeAttr("selected",false);
|
||
$("select[name='"+objNamePrefix+"matchMethod']").find("option[value=0]").attr("selected",true);
|
||
$("select[name='"+objNamePrefix+"matchMethod']").find("option[value!=0]").attr("disabled",true);
|
||
$("select[name='"+objNamePrefix+"matchMethod']").selectpicker("refresh");
|
||
}else {
|
||
$("input:radio[name='"+objNamePrefix+"exprType'][value=0]").prop("checked",true); //选中否
|
||
$("select[name='"+objNamePrefix+"matchMethod']").find("option").removeAttr("disabled");
|
||
$("select[name='"+objNamePrefix+"matchMethod']").selectpicker("refresh");
|
||
}
|
||
}
|
||
function validateDataIsLicit(){
|
||
var fdfz = $.trim($("#tags_1").val()).replace(/,/g,"");
|
||
return isLicit(fdfz);
|
||
}
|
||
//导入文件提示框
|
||
var toImport=function (cfgRegionCode,cfgType){
|
||
$("#cfgRegionCode").val(cfgRegionCode);
|
||
$("#cfgType").val(cfgType);
|
||
if(cfgType){//针对要下发到不同cfgType的处理
|
||
$('.radio-inline').children('span').each(function(){
|
||
if($(this).hasClass(cfgType)){
|
||
$(this).find("input").removeAttr("disabled");
|
||
if($('.radio-inline').children('span').size()==1){
|
||
$(this).find("input").click();
|
||
}
|
||
}else{
|
||
$(this).find("input").attr("disabled",true).attr("checked",false);
|
||
}
|
||
})
|
||
}
|
||
$("#import_modal").modal({
|
||
backdrop:"static",
|
||
keyboard:false,
|
||
show:true
|
||
});
|
||
}
|
||
//下载模板
|
||
var downLoadXLS=function(){
|
||
var pathName=window.document.location.pathname.substring(0,window.document.location.pathname.lastIndexOf("/"));
|
||
window.location =pathName+"/import/template?functionId="+$("#functionId").val()+"&cfgRegionCode="+$("#cfgRegionCode").val();
|
||
}
|
||
//下载模板
|
||
var openSelct=function(obj){
|
||
$(obj).parent().parent().find(".tree-multiselect").removeClass("hidden");
|
||
}
|
||
//导入配置
|
||
var importCfg=function(){
|
||
if($("#serviceId").val()==""){
|
||
alert("请选择action");
|
||
return ;
|
||
}
|
||
var fileName = $(".fileupload-preview", $("#importForm1")).text();
|
||
var $error = $('.alert-error', $("#importForm1"));
|
||
if(fileName==""){
|
||
|
||
$("span",$error).html("请选择xls或者xlsx格式文件进行导入...");
|
||
$error.removeClass("hide");
|
||
$error.addClass("show");
|
||
return false;
|
||
|
||
}else if(fileName.lastIndexOf("\.")==-1||fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xls' &&fileName.substring(fileName.lastIndexOf("\.")+1).toLowerCase()!='xlsx'){
|
||
$("span",$error).html("导入的文件后缀,必须为xls或者xlsx...");
|
||
$error.removeClass("hide");
|
||
$error.addClass("show");
|
||
return false;
|
||
}
|
||
$("#import_modal").modal('hide');//导入文件隐藏
|
||
$("#importForm1").submit();
|
||
}
|
||
var validateInvisibleCharTag=function(){
|
||
var hasInvisibleCharTags=[];
|
||
var reg = new RegExp(/\t|\r|\n/);
|
||
$(".tagsinput").find(".tag").each(function(){
|
||
var text=$(this).children("span").text();
|
||
if (text.match(reg)) {
|
||
hasInvisibleCharTags.push("'"+text.trim()+"'");
|
||
}
|
||
});
|
||
if(hasInvisibleCharTags.length==1){
|
||
$(".tagsinput").parents(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.hasInvisibleChar.replace("{0}",hasInvisibleCharTags.join(","))+"</label>");
|
||
return false;
|
||
}else if(hasInvisibleCharTags.length>=1){
|
||
$(".tagsinput").parents(".col-md-6").next("div").html("<label class='error'>"+$.validator.messages.haveInvisibleChar.replace("{0}",hasInvisibleCharTags.join(","))+"</label>");
|
||
return false;
|
||
}
|
||
return true;
|
||
}
|
||
var setHexCaseSenstive=function(){
|
||
$("input[name$='configHex']").each(function(){
|
||
var configHex=$(this).val();
|
||
var configNamePrefix=$(this).attr("name").split("configHex")[0]; ;
|
||
if(configHex != ''){
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isHex'][value=1]").parent().addClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isHex'][value=0]").parent().addClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isCaseSenstive'][value=0]").parent().addClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isCaseSenstive'][value=1]").parent().addClass("hidden");
|
||
if(configHex.indexOf("0")>-1){//非十六进制大小写不敏感
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isHex'][value=0]").parent().removeClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isCaseSenstive'][value=0]").parent().removeClass("hidden");
|
||
}
|
||
if(configHex.indexOf("1")>-1){//十六进制大小写不敏感
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isHex'][value=1]").parent().removeClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isCaseSenstive'][value=0]").parent().removeClass("hidden");
|
||
}
|
||
if(configHex.indexOf("2")>-1){//非十六进制大小写敏感
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isHex'][value=0]").parent().removeClass("hidden");
|
||
$(this).parent().find("input[name='"+configNamePrefix+"isCaseSenstive'][value=1]").parent().removeClass("hidden");
|
||
}
|
||
}
|
||
|
||
});
|
||
}
|
||
/**
|
||
* ip默认选项处理
|
||
*/
|
||
var initCommIpVal=function(){
|
||
var regionCode,serviceType,ipPortShow,ipType,
|
||
ipPattern,portPattern,direction,protocol,regionType;
|
||
if($("input[name$='action']:checked").length>0){
|
||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||
}else{
|
||
regionCode=$("input[name$='action']").attr("regionCode");
|
||
}
|
||
if(regionCode){
|
||
if(regionCode.indexOf(",")==-1){
|
||
$("#cfgRegionCode"+regionCode).attr("name","cfgRegionCode");
|
||
$("#cfgType"+regionCode).attr("name","cfgType");
|
||
}else{
|
||
var _region='';
|
||
var regionArr=regionCode.split(',');
|
||
$("input[name$='cfgRegionCode'][regionType='1']").each(function(){
|
||
for(var re in regionArr){
|
||
if($(this).val()==regionArr[re]){
|
||
_region=regionArr[re];
|
||
break;
|
||
}
|
||
}
|
||
});
|
||
if(_region!=''){
|
||
regionCode=_region;
|
||
}
|
||
}
|
||
}
|
||
if(regionCode){//IP域大于1个,根据action获取ip属性
|
||
ipPortShow=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPortShow"),
|
||
ipType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipType"),
|
||
ipPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("ipPattern"),
|
||
portPattern=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("portPattern"),
|
||
direction=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("direction"),
|
||
protocol=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("protocol"),
|
||
regionType=$("input[name$='cfgRegionCode'][value='"+regionCode+"']").attr("regionType");
|
||
}else{//IP域只有一个,获取regionType为1的
|
||
ipPortShow=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPortShow"),
|
||
ipType=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipType"),
|
||
ipPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("ipPattern"),
|
||
portPattern=$("input[name$='cfgRegionCode'][regionType='1']").attr("portPattern"),
|
||
direction=$("input[name$='cfgRegionCode'][regionType='1']").attr("direction"),
|
||
protocol=$("input[name$='cfgRegionCode'][regionType='1']").attr("protocol"),
|
||
regionType=$("input[name$='cfgRegionCode'][regionType='1']").attr("regionType");
|
||
}
|
||
//ip,端口处理
|
||
if(ipPortShow){
|
||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||
$("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||
$("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||
}else{
|
||
$("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||
$("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||
}
|
||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||
$("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||
$("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||
}else{
|
||
$("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||
$("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||
}
|
||
}
|
||
//ip类型处理
|
||
if(ipType){
|
||
var arr=ipType.split(',');
|
||
$("select[name$='ipType'] option").each(function(){
|
||
var has=false;
|
||
for(var type in arr){
|
||
if($(this).val()==arr[type]){
|
||
has=true;
|
||
if($(this).attr("disabled")){
|
||
$(this).removeAttr("disabled")
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if(!has){
|
||
$(this).attr("disabled",true);
|
||
}
|
||
});
|
||
}
|
||
//ip格式处理
|
||
if(ipPattern){
|
||
arr=ipPattern.split(',');
|
||
$("select[name$='ipPattern'] option").each(function(){
|
||
var has=false;
|
||
for(var type in arr){
|
||
if($(this).val()==arr[type]){
|
||
has=true;
|
||
if($(this).attr("disabled")){
|
||
$(this).removeAttr("disabled")
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if(!has){
|
||
$(this).attr("disabled",true);
|
||
}
|
||
});
|
||
}
|
||
//端口格式处理
|
||
if(portPattern){
|
||
arr=portPattern.split(',');
|
||
$("select[name$='portPattern'] option").each(function(){
|
||
var has=false;
|
||
for(var type in arr){
|
||
if($(this).val()==arr[type]){
|
||
has=true;
|
||
if($(this).attr("disabled")){
|
||
$(this).removeAttr("disabled")
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if(!has){
|
||
$(this).attr("disabled",true);
|
||
}
|
||
});
|
||
}
|
||
//方向处理
|
||
if(direction){
|
||
arr=direction.split(',');
|
||
$("select[name$='direction'] option").each(function(){
|
||
var has=false;
|
||
for(var type in arr){
|
||
if($(this).val()==arr[type]){
|
||
has=true;
|
||
if($(this).attr("disabled")){
|
||
$(this).removeAttr("disabled")
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if(!has){
|
||
$(this).attr("disabled",true);
|
||
}
|
||
});
|
||
}
|
||
//协议处理
|
||
if(protocol){
|
||
arr=protocol.split(',');
|
||
$("select[name$='protocol'] option").each(function(){
|
||
var has=false;
|
||
for(var type in arr){
|
||
if($(this).val()==arr[type]){
|
||
has=true;
|
||
if($(this).attr("disabled")){
|
||
$(this).removeAttr("disabled")
|
||
}
|
||
break;
|
||
}
|
||
}
|
||
if(!has){
|
||
$(this).attr("disabled",true);
|
||
}
|
||
});
|
||
}
|
||
} |