修改APP关联特征配置页面.

This commit is contained in:
zhangwenqing
2019-02-21 09:57:49 +08:00
parent 31ec0cd29a
commit 5e4f48088c
3 changed files with 379 additions and 1 deletions

View File

@@ -99,7 +99,10 @@ public class AppFeatureCfgController extends BaseController {
List<SpecificServiceCfg> l7ProtoList = specificServiceCfgService.findAllSpecificServiceCfg(specificServiceCfg, null);
model.addAttribute("_cfg", entity);
model.addAttribute("l7ProtoList", l7ProtoList);
model.addAttribute("l7ProtoList", l7ProtoList);
if(entity.getFunctionId() == 567) { // APP关联特征配置
return "/cfg/app/appCorrelationFeatureCfgForm";
}
return "/cfg/app/appMultiFeatureCfgForm";
}

View File

@@ -0,0 +1,2 @@
-- APP关联特征配置 增加控管参数组件
INSERT INTO `function_region_dict` (`function_id`, `config_district`, `config_region_code`, `config_region_value`, `config_desc`, `is_valid`, `is_maat`, `region_type`, `creator_id`, `create_time`, `editor_id`, `edit_time`, `config_service_type`, `config_expr_type`, `config_match_method`, `config_ip_type`, `config_hex`, `config_multi_keywords`, `config_ip_pattern`, `config_port_pattern`, `config_direction`, `config_protocol`, `config_ip_port_show`, `config_region_sort`, `is_import`) VALUES ('567', '', '7', 'APP_FEATURE_PROPERTIES', 'APP特征属性组件', '1', '1', '9', NULL, '2019-02-01 10:47:28', NULL, '2019-02-01 10:47:32', '', '1', '', '', '', '', NULL, NULL, NULL, NULL, NULL, '2', '0');

View File

@@ -0,0 +1,373 @@
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ include file="/WEB-INF/include/taglib.jsp"%>
<html>
<head>
<title><spring:message code="${cfgName}"></spring:message></title>
<script type="text/javascript">
$(function(){
$(".action").on("change", function() {
$("#serviceId").val($(this).attr("serviceId"));
});
$(".boxSolid:visible").find(".district").each(function(){
$(this).change();
});
$("#serviceId").val($(".action:checked").attr("serviceId"));
if($("#serviceId").val()==1025 && $("#cfgId").val()!=null){
$("input:radio[name$='exprType']").each(function(){
if($(this).attr("checked") && $(this).val()==3){
changeKeywordFormate($(this).val(),$(this));
}
});
}
$("#cfgFrom").validate({
errorPlacement: function(error,element){
if($(element).parents().hasClass("tagsinput")){
$(element).parents(".col-md-6").next("div").append(error);
}else{
$(element).parents(".form-group").find("div[for='"+element.attr("name")+"']").append(error);
}
},
submitHandler: function(form){
//代表所有业务都隐藏了,提示必须增加一种业务数据
if($(".boxSolid").length ==$(".boxSolid.hidden").length){
top.$.jBox.tip("<spring:message code='one_more'/>", "<spring:message code='info'/>");
return;
}
//将disable属性的元素删除
$(".disabled").each(function(){
$(this).remove();
});
if($("input[name$='exprType']").attr("disabled")){
$("input[name$='exprType']").attr("disabled",false);
}
$("#appCode").val($("#specServiceIdId").val());
loading('onloading...');
form.submit();
},
errorContainer: "#messageBox",
});
// 初始clone
ipInfoDiv = $(".ipDiv").clone();
if($(".ipDiv").hasClass("hidden")){
$(".ipDiv").remove();
}
$(".addDiv").removeClass("hidden");
ipInfoDiv.removeClass("ipDiv");
ipInfoDiv.removeClass("hidden");
resetIndex();
});
var resetDiv = function(obj){
// 添加 or 删除
if($(obj).hasClass("addDiv")){
$(".ipInfo").last().after(ipInfoDiv.clone());
}else{
if($(".ipInfo").length == 1){
top.$.jBox.tip("<spring:message code='one_more'/>");
return;
}else{
$(obj).parents(".ipInfo:first").remove();
}
}
$(".selectpicker").selectpicker("render");// 重新渲染
$("select[name$='ipType']").on("change",function(){
switchIpInfo(this);
});
$("select[name$='ipPattern']").on("change",function(){
switchIpInfo(this);
});
resetIndex();
}
var resetIndex = function(){
// 设置索引
$(".ipInfo").not(".hidden").each(function(index,element){
var ind = index;
$(this).find("input,select").each(function(){
var oldName = $(this).attr("name");
//var newName = oldName.replace(oldName.match(/\[(\S*)\]/)[1],ind);
var newName = oldName;
$(this).attr("name",newName);
$(this).parents(".form-group").find("div[for='"+oldName+"']").attr("for",newName);
});
});
}
//业务窗口打开
var addContent = function(obj, contentClassName) {
var showDiv = $(obj).parent().parent().next();
$(showDiv).removeClass("hidden").removeClass(
"disabled");
$("select[name$='portPattern']").parents(".port").removeClass("hidden");
$("input[name$='destIpAddress']").parents(".destPort").removeClass("hidden");
$(".moreBtn").data("click-times",2);
$(obj).addClass("hidden");
}
//业务窗口关闭
var delContent = function(contentClassName, addBtnClassName) {
$("." + contentClassName).addClass("hidden").addClass("disabled");
$("." + addBtnClassName).removeClass("hidden");
}
</script>
</head>
<body>
<span id="keywordError" style="display:none"><spring:message
code="required"></spring:message></span>
<span id="tagsinputTip" style="display:none"><spring:message
code="multiple_keywords_tip"></spring:message></span>
<span id="l3_header_error" style="display:none"><spring:message
code="l3_header_error"></spring:message></span>
<div class="page-content">
<c:forEach items="${serviceList}" var="service">
<c:if test="${cfg.functionId eq service.functionId}">
<c:set var="serviceName" value="${service.serviceName}"/>
</c:if>
</c:forEach>
<h3 class="page-title">
<spring:message code="${_cfg.menuNameCode }"></spring:message>
</h3>
<div class="row">
<div class="col-md-12">
<div class="portlet box blue">
<div class="portlet-title">
<div class="caption">
<i class="fa fa-gift"></i>
<c:if test="${empty _cfg.cfgId}">
<spring:message code="add"></spring:message>
</c:if>
<c:if test="${not empty _cfg.cfgId}">
<spring:message code="edit"></spring:message>
</c:if>
</div>
</div>
<div class="portlet-body form">
<!-- BEGIN FORM-->
<form id="cfgFrom" action="${ctx}/app/feature/saveAppMultiFeatureCfg"
method="post" class="form-horizontal">
<input type="hidden" name="cfgId" id="cfgId" value="${_cfg.cfgId}">
<input type="hidden" name="compileId" value="${_cfg.compileId}">
<input type="hidden" name="functionId" value="${_cfg.functionId}">
<input type="hidden" id="serviceId" name="serviceId" value="${_cfg.serviceId}">
<input type="hidden" id="appCode" name="appCode" value="${_cfg.appCode}">
<input type="hidden" id="behavCode" name="behavCode" value="${_cfg.behavCode}">
<input type="hidden" id="doLog" name="doLog" value="2">
<c:set var="serviceId" value="${_cfg.serviceId}" />
<!-- 配置域类型 -->
<div class="form-body">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<c:set var="spec_service_id"><spring:message code="social_app"/></c:set>
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="social_app"/></label>
<div class="col-md-6">
<sys:treeselect id="specServiceId" name="specServiceId" value="${_cfg.specServiceId}" enableSearch="true"
labelName="parent.specServiceName" notAllowSelectRoot="true" notAllowSelectParent="true" enableAddBtn="true"
labelValue="${empty _cfg.specServiceId?spec_service_id:fns:getBySpecServiceId(_cfg.specServiceId).specServiceName}"
title="${spec_service_id}" url="/specific/specificServiceCfg/treeData?isLeafShow=false&cfgType=1" extId=""
cssClass="form-control required"/>
</div>
<div for="parent.specServiceName"></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="config_describe" /></label>
<div class="col-md-6">
<input class="form-control" type="text" name="cfgDesc"
value="${_cfg.cfgDesc}">
</div>
</div>
</div>
<div class="col-md-6 hidden">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="action" /></label>
<div class="col-md-6">
<c:forEach items="${serviceList}" var="service"
varStatus="satus">
<label class="radio-inline"> <c:if
test="${_cfg.functionId eq service.functionId}">
<input type="radio" name="action"
serviceId="${service.serviceId }"
protocolId="${service.protocolId }"
regionCode="${service.regionCode }"
value="${service.action }" class="required action"
<c:if test="${_cfg.action==service.action || (_cfg.action==null && satus.index==0)}">checked</c:if>>
<c:forEach items="${fns:getDictList('SERVICE_ACTION') }"
var="dict">
<c:if test="${dict.itemCode eq service.action }">
<spring:message code="${dict.itemValue }" />
</c:if>
</c:forEach>
<c:set var="serviceId" value="${service.serviceId}" />
</c:if>
</label>
</c:forEach>
</div>
<div for="action"></div>
</div>
</div>
</div>
<c:if test="${fns:getUser().isAdmin() or fns:getUser().loginId eq 'appUser' }">
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message
code="user_region" /></label>
<div class="col-md-6">
<input class="form-control" type="text" name="userRegion1" maxlength="1024"
value="${_cfg.userRegion1}">
</div>
<div for="userRegion1"></div>
</div>
</div>
</div>
</c:if>
<!-- 关联特征配置 start -->
<h4 class="form-section">
<spring:message code="Correlation Feature" />
<small>
<span class="glyphicon glyphicon-plus addDiv"
onClick="resetDiv(this)" title="add"></span>
</small>
</h4>
<div class="row ipInfo boxSolid ipDiv">
<div class="row">
<div class="pull-right">
<span class="glyphicon glyphicon-remove pull-right" title="remove"
onClick="resetDiv(this);" />
</div>
</div>
<div class="row">
<!-- 特征种类 -->
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="Feature Type"/></label>
<div class="col-md-6">
<select name="" class="selectpicker show-tick form-control">
<option value=""><spring:message code="select"/></option>
<option value="ip"><spring:message code="IP"/></option>
<option value="domain"><spring:message code="Domain"/></option>
<option value="payload"><spring:message code="Payload"/></option>
<option value="http"><spring:message code="HTTP"/></option>
<option value="dns"><spring:message code="DNS"/></option>
<option value="ssl"><spring:message code="SSL"/></option>
</select>
</div>
<div for=""></div>
</div>
</div>
<!-- 特征属性 -->
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="Feature Attributes"/></label>
<div class="col-md-6">
<select name="" class="selectpicker show-tick form-control" multiple="multiple">
<option value=""><spring:message code="weak_feature"/></option>
<option value=""><spring:message code="whitelist_feature"/></option>
<option value=""><spring:message code="extend_scan_pktNum"/></option>
<option value=""><spring:message code="long_stream_lock_time"/></option>
<option value=""><spring:message code="correlation_block_after"/></option>
<option value=""><spring:message code="correlation_valid_time"/></option>
</select>
</div>
<div for=""></div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="Feature Configs"/></label>
<div class="col-md-6">
<select name="" class="selectpicker show-tick form-control" data-live-search="true" data-live-search-placeholder="search">
<option value=""><spring:message code="select"/></option>
<option value="cfg1">APP_Feature_Cfg_1</option>
<option value="cfg2">APP_Feature_Cfg_2</option>
<option value="cfg3">APP_Feature_Cfg_3</option>
</select>
</div>
<div for=""></div>
</div>
</div>
<div class="col-md-6">
<div class="form-group">
<label class="control-label col-md-3"><spring:message code="Hit Counts" /></label>
<div class="col-md-6">
<input class="form-control number digits" placeholder="1" min="1" max="16" type="text" name="">
</div>
<div for=""></div>
</div>
</div>
</div>
</div>
<!-- 关联特征配置 end -->
<c:set var="strCfgIndex" value="0"></c:set>
<c:forEach items="${regionList}" var="region" varStatus="status">
<c:if test="${region.regionType eq 9 }">
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
<h4 class="form-section"><spring:message code="${region.configRegionValue}" />
<small>
<span class="glyphicon glyphicon-plus ${tabName}Add"
onClick="addContent(this,'${tabName}')" title="add"></span></small>
</h4>
<c:set var="cfgName" value="appFeaturePropCfgList[0]"></c:set>
<div class="row boxSolid ${tabName}${status.index} <c:if test="${fn:length(_cfg.appFeaturePropCfgList)==0}"> hidden disabled</c:if>">
<input type="hidden" name="cfgRegionValue" value="${region.configRegionValue }">
<input type="hidden" name="cfgRegionType" value="${region.regionType }">
<input type="hidden" name="cfgRegionCode1" value="${region.configRegionCode }">
<%@include file="/WEB-INF/views/cfg/app/appFeatureProp.jsp"%>
</div>
</c:if>
</c:forEach>
<input name="isAreaEffective" type="hidden" value="0">
<input type="hidden" name="requestId" value="0" />
<input type="hidden" name="classify" value="0" />
<input type="hidden" name="attribute" value="0" />
<input type="hidden" name="lable" value="0" />
<div class="form-actions">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-offset-3 col-md-8">
<button id="save" type="submit" class="btn green">
<spring:message code="submit" />
</button>
<button id="cancel" type="button" class="btn default">
<spring:message code="cancel" />
</button>
</div>
</div>
</div>
<div class="col-md-6"></div>
</div>
</div>
</div>
</form>
<!-- END FORM-->
</div>
</div>
</div>
</div>
</div>
</body>
</html>