(1)ip地址功能整个asn功能
(2)ip域处理提到单独的js ipRegion.js中
This commit is contained in:
@@ -20,12 +20,14 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
||||
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.SysDataDictionaryItem;
|
||||
import com.nis.domain.basics.PolicyGroupInfo;
|
||||
import com.nis.domain.configuration.CfgIndexInfo;
|
||||
import com.nis.domain.configuration.IpPortCfg;
|
||||
import com.nis.domain.configuration.NtcSubscribeIdCfg;
|
||||
import com.nis.domain.configuration.template.IpAddrTemplate;
|
||||
import com.nis.domain.configuration.template.IpsecTemplate;
|
||||
import com.nis.domain.configuration.template.TunnelIpTemplate;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.web.controller.configuration.CommonController;
|
||||
@@ -57,6 +59,8 @@ public class IpController extends CommonController{
|
||||
}else{
|
||||
initFormCondition(model,entity);
|
||||
}
|
||||
List<ConfigGroupInfo> policyGroups=asnPolicyCfgService.getConfigGroupInfoList(4);
|
||||
model.addAttribute("policyGroups", policyGroups);
|
||||
model.addAttribute("_cfg", entity);
|
||||
return "/cfg/ipaddr/ipForm";
|
||||
}
|
||||
@@ -89,6 +93,9 @@ public class IpController extends CommonController{
|
||||
}
|
||||
}
|
||||
}
|
||||
if(StringUtils.isNotBlank(cfg.getUserRegion4())) {
|
||||
tabList.add(new String[]{"3","ASN"});
|
||||
}
|
||||
model.addAttribute("_cfg", cfg);
|
||||
model.addAttribute("index", index);
|
||||
model.addAttribute("tabList", tabList);
|
||||
@@ -114,11 +121,21 @@ public class IpController extends CommonController{
|
||||
entity.setAuditTime(new Date());
|
||||
entity.setFunctionId(functionId);
|
||||
try {
|
||||
ipCfgService.auditIpCfg(entity,isAudit);
|
||||
} catch (MaatConvertException e) {
|
||||
if(StringUtils.isNoneBlank(entity.getUserRegion4())) {
|
||||
ipCfgService.auditAsnCfg(entity, isAudit);
|
||||
}else {
|
||||
ipCfgService.auditIpCfg(entity,isAudit);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.info("ssl配置下发失败:"+e.getMessage());
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
logger.info("ip配置下发失败:"+e.getMessage());
|
||||
if(e instanceof MaatConvertException) {
|
||||
addMessage(redirectAttributes, e.getMessage());
|
||||
}else {
|
||||
addMessage(redirectAttributes, "audit_failed");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return "redirect:" + adminPath +"/ntc/iplist/list?functionId="+functionId;
|
||||
|
||||
@@ -109,6 +109,18 @@
|
||||
<if test="userRegion1 != null and userRegion1 !=''">
|
||||
AND r.user_region1=#{userRegion1,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="userRegion2 != null and userRegion2 !=''">
|
||||
AND r.user_region2=#{userRegion2,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="userRegion3 != null and userRegion3 !=''">
|
||||
AND r.user_region3=#{userRegion3,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="userRegion4 != null and userRegion4 !=''">
|
||||
AND r.user_region4=#{userRegion4,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="userRegion5 != null and userRegion5 !=''">
|
||||
AND r.user_region5=#{userRegion5,jdbcType=VARCHAR}
|
||||
</if>
|
||||
<if test="functionId != null">
|
||||
AND r.function_id=#{functionId,jdbcType=INTEGER}
|
||||
</if>
|
||||
|
||||
@@ -15,6 +15,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.nis.domain.FunctionRegionDict;
|
||||
import com.nis.domain.Page;
|
||||
import com.nis.domain.basics.AsnIpCfg;
|
||||
import com.nis.domain.callback.InlineIp;
|
||||
import com.nis.domain.configuration.AreaIpCfg;
|
||||
import com.nis.domain.configuration.BaseIpCfg;
|
||||
@@ -29,15 +30,18 @@ import com.nis.domain.maat.MaatCfg.NumBoundaryCfg;
|
||||
import com.nis.domain.maat.MaatCfg.StringCfg;
|
||||
import com.nis.domain.maat.ToMaatBean;
|
||||
import com.nis.domain.maat.ToMaatResult;
|
||||
import com.nis.domain.specific.ConfigGroupInfo;
|
||||
import com.nis.exceptions.MaatConvertException;
|
||||
import com.nis.util.ConfigServiceUtil;
|
||||
import com.nis.util.Configurations;
|
||||
import com.nis.util.Constants;
|
||||
import com.nis.util.DictUtils;
|
||||
import com.nis.util.StringUtil;
|
||||
import com.nis.web.dao.basics.AsnIpCfgDao;
|
||||
import com.nis.web.dao.configuration.AreaIpCfgDao;
|
||||
import com.nis.web.dao.configuration.IpCfgDao;
|
||||
import com.nis.web.dao.configuration.StringCfgDao;
|
||||
import com.nis.web.dao.specific.SpecificServiceCfgDao;
|
||||
import com.nis.web.security.UserUtils;
|
||||
import com.nis.web.service.CrudService;
|
||||
|
||||
@@ -54,6 +58,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
protected StringCfgDao stringCfgDao;
|
||||
@Autowired
|
||||
protected AreaIpCfgDao areaIpCfgDao;
|
||||
@Autowired
|
||||
protected SpecificServiceCfgDao specificServiceCfgDao;
|
||||
@Autowired
|
||||
protected AsnIpCfgDao asnIpCfgDao;
|
||||
/**
|
||||
*
|
||||
* addIpCfg(新增IP类配置)
|
||||
@@ -344,18 +352,29 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}else if(Constants.SERVICE_IP_RATELIMIT==cfg.getServiceId().intValue()){
|
||||
maatCfg.setUserRegion(Constants.USERREGION_RATE_LIMIT+"="+cfg.getRatelimit());
|
||||
}
|
||||
if(!StringUtil.isEmpty(cfg.getUserRegion1())){
|
||||
String userRegion = "";
|
||||
if(cfg.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_URL_KEY+"="+cfg.getUserRegion2();
|
||||
}else{
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_CONTENT_KEY+"="+cfg.getUserRegion2();
|
||||
//限速需要发Droprate=0.001 ,暂不支持Bandwidth=200kbps
|
||||
if(cfg.getAction().equals(Constants.RATELIMIT_ACTION)){
|
||||
if(cfg.getUserRegion1().equals("0")){//丢包率
|
||||
cfg.setUserRegion2(StringUtil.isEmpty(cfg.getUserRegion2()) ? "":cfg.getUserRegion2());
|
||||
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_DROPRATE_USER_REGION_KEY+"="+cfg.getUserRegion2());
|
||||
}else if(cfg.getUserRegion1().equals("1")){//带宽
|
||||
cfg.setUserRegion3(StringUtil.isEmpty(cfg.getUserRegion3()) ? "":cfg.getUserRegion3());
|
||||
maatCfg.setUserRegion(Constants.INTERCEPT_IP_RATELIMIT_BANDWITH_USER_REGION_KEY+"="+cfg.getUserRegion3());
|
||||
}
|
||||
}else {
|
||||
if(!StringUtil.isEmpty(cfg.getUserRegion1())){
|
||||
String userRegion = "";
|
||||
if(cfg.getUserRegion1().startsWith(Constants.REDIRECT_RESPONSE_CODE_STARTWITH)){
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_URL_KEY+"="+cfg.getUserRegion2();
|
||||
}else{
|
||||
userRegion = Constants.REDIRECT_RESPONSE_CODE_KEY+"="+cfg.getUserRegion1()+
|
||||
Constants.USER_REGION_SPLIT+
|
||||
Constants.REDIRECT_CONTENT_KEY+"="+cfg.getUserRegion2();
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
maatCfg.setUserRegion(userRegion);
|
||||
}
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
@@ -656,6 +675,130 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
}
|
||||
}
|
||||
}
|
||||
/**
|
||||
*
|
||||
* @param isAudit
|
||||
* @param isValid
|
||||
* @param ids cfgId
|
||||
* @param functionId
|
||||
*/
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void auditAsnCfg(CfgIndexInfo entity,Integer isAudit){
|
||||
entity.setTableName(CfgIndexInfo.getTablename());
|
||||
entity.setIsAudit(isAudit);
|
||||
ipCfgDao.auditCfg(entity);
|
||||
ToMaatBean maatBean = new ToMaatBean();
|
||||
MaatCfg maatCfg = new MaatCfg();
|
||||
List<MaatCfg> configCompileList = new ArrayList<>();
|
||||
List<GroupCfg> groupRelationList = new ArrayList<>();
|
||||
List<IpCfg> ipRegionList = new ArrayList<>();
|
||||
List<StringCfg> strRegionList = new ArrayList<>();
|
||||
List<NumBoundaryCfg> numRegionList = new ArrayList<>();
|
||||
List<DigestCfg> digestRegionList = new ArrayList<>();
|
||||
List<IpCfg> areaIpRegionList = new ArrayList<>();
|
||||
if(isAudit==Constants.AUDIT_YES) {
|
||||
ConfigGroupInfo group=specificServiceCfgDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
if(group.getIsIssued()==1) {//复用,值下编译跟分组
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entity.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn组复用配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ipaddr asn组复用配置下发响应信息:"+result.getMsg());
|
||||
}else {//首次下发
|
||||
maatCfg.initDefaultValue();
|
||||
BeanUtils.copyProperties(entity, maatCfg);
|
||||
maatCfg.setAction(entity.getAction());
|
||||
maatCfg.setAuditTime(entity.getAuditTime());
|
||||
maatCfg.setStrRegionList(strRegionList);
|
||||
maatCfg.setNumRegionList(numRegionList);
|
||||
maatCfg.setDigestRegionList(digestRegionList);
|
||||
maatCfg.setGroupRelationList(groupRelationList);
|
||||
maatCfg.setAreaIpRegionList(areaIpRegionList);
|
||||
maatCfg.setIsValid(entity.getIsValid());
|
||||
//group
|
||||
GroupCfg groupCfg=new GroupCfg();
|
||||
groupCfg.setCompileId(entity.getCompileId());
|
||||
groupCfg.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
groupCfg.setIsValid(Constants.VALID_YES);
|
||||
groupCfg.setAuditTime(entity.getAuditTime());
|
||||
groupRelationList.add(groupCfg);
|
||||
maatCfg.setGroupNum(groupRelationList.size());
|
||||
//region
|
||||
//查询asn group id下所有的 ip
|
||||
AsnIpCfg asnIpCfg=new AsnIpCfg();
|
||||
asnIpCfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
||||
List<AsnIpCfg> allAsnIpCfgs=asnIpCfgDao.findAllList(asnIpCfg);
|
||||
ipRegionList.addAll(groupReuseCfgAddRemoveConvert(allAsnIpCfgs,Constants.VALID_YES,null));
|
||||
maatCfg.setIpRegionList(ipRegionList);
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.INSERT_ACTION);
|
||||
|
||||
//调用服务接口下发配置数据
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn配置下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.postMaatCfg(json);
|
||||
logger.info("ipaddr asn配置下发响应信息:"+result.getMsg());
|
||||
ConfigGroupInfo info=new ConfigGroupInfo();
|
||||
info.setIsIssued(1);
|
||||
info.setGroupId(Integer.parseInt(entity.getUserRegion4()));
|
||||
specificServiceCfgDao.updateConfigGroupInfobyGroupId(info);
|
||||
AsnIpCfg cfg=new AsnIpCfg();
|
||||
cfg.setIsValid(Constants.VALID_YES);
|
||||
cfg.setAsnIpGroup(Integer.parseInt(entity.getUserRegion4()));
|
||||
asnIpCfgDao.updateIssued(cfg);
|
||||
}
|
||||
}else if(isAudit==Constants.AUDIT_NOT_YES) {//取消审核通过
|
||||
maatCfg.setCompileId(entity.getCompileId());
|
||||
maatCfg.setServiceId(entity.getServiceId());
|
||||
maatCfg.setIsValid(0);//无效
|
||||
configCompileList.add(maatCfg);
|
||||
maatBean.setConfigCompileList(configCompileList);
|
||||
maatBean.setAuditTime(entity.getAuditTime());
|
||||
maatBean.setCreatorName(entity.getCurrentUser().getName());
|
||||
maatBean.setVersion(Constants.MAAT_VERSION);
|
||||
maatBean.setOpAction(Constants.UPDATE_ACTION);
|
||||
//调用服务接口取消配置
|
||||
String json=gsonToJson(maatBean);
|
||||
logger.info("ipaddr asn取消下发配置参数:"+json);
|
||||
//调用服务接口下发配置
|
||||
ToMaatResult result = ConfigServiceUtil.put(json,1);
|
||||
logger.info("ipaddr asn取消配置响应信息:"+result.getMsg());
|
||||
}else {
|
||||
throw new RuntimeException("unknown isAudit value "+isAudit);
|
||||
}
|
||||
|
||||
}
|
||||
@Transactional(readOnly=false,rollbackFor=RuntimeException.class)
|
||||
public void deleteIp(String ids,String compileIds,int functionId){
|
||||
if(StringUtils.isNotBlank(compileIds)){
|
||||
@@ -723,6 +866,10 @@ public class IpCfgService extends CrudService<IpCfgDao,BaseIpCfg> {
|
||||
List<NtcSubscribeIdCfg> subscribeIdList = stringCfgDao.findSubscribeIdCfgListByCfgIndexInfo(entity);
|
||||
entity.setIpPortList(ipPortList);
|
||||
entity.setNtcSubscribeIdCfgList(subscribeIdList);
|
||||
if(StringUtils.isNotBlank(entity.getUserRegion4())) {
|
||||
ConfigGroupInfo info=specificServiceCfgDao.getConfigGroupInfoByGroupId(Integer.parseInt(entity.getUserRegion4().trim()));
|
||||
entity.setAsnIpGroupName(info.getGroupName());
|
||||
}
|
||||
return entity;
|
||||
}
|
||||
public BaseIpCfg getIpCfgById(String tableName,long id){
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
UPDATE function_service_dict SET region_code=1 WHERE function_id=5 AND region_code='1,3';
|
||||
UPDATE function_service_dict SET region_code=2 WHERE function_id=5 AND region_code='2,3';
|
||||
UPDATE function_service_dict SET is_valid=0 WHERE function_id=5 AND ACTION=1;
|
||||
UPDATE function_service_dict SET is_valid=1 WHERE function_id=5 AND ACTION=1;
|
||||
UPDATE function_service_dict SET is_valid=0 WHERE function_id=5 AND ACTION=96;
|
||||
|
||||
INSERT INTO function_service_dict (function_id,protocol_id,ACTION,action_code,service_id,service_name,service_desc,is_valid,region_code) VALUES(5,0,64,'ratelimit',1057,'ip_ratelimit','ip地址限速',1,1);
|
||||
@@ -12,5 +12,18 @@ INSERT INTO sys_data_dictionary_item (item_code,item_value,item_desc,item_sort,S
|
||||
|
||||
UPDATE function_region_dict SET is_valid=0 WHERE function_id=5 AND config_region_value ='NTC_SUBSCRIBE_ID';
|
||||
UPDATE function_region_dict SET config_protocol='0,6,17,1,8,15' WHERE function_id=5 AND config_region_value ='INLINE_IP_CB';
|
||||
UPDATE function_region_dict SET config_protocol='0,6,17,1,8,15' WHERE function_id=5 AND config_region_value ='INLINE_IP_CB';
|
||||
update function_region_dict set config_ip_type='4,6' where region_type=1 and config_ip_type like '%,46,64,10%';
|
||||
UPDATE function_service_dict SET region_code=4 WHERE function_id=5 AND action_code='ratelimit';
|
||||
INSERT INTO function_region_dict (function_id,config_region_code,config_region_value,config_desc,is_valid,is_maat,region_type,config_ip_type,config_ip_pattern,config_port_pattern,config_direction,config_protocol,config_ip_port_show,config_region_sort)VALUES(5,4,'LIMIT_IP','IP限流',1,1,1,'4,6','1,2,3','1,2','0,1','0,6,17','1,2',4);
|
||||
|
||||
update function_region_dict set config_ip_type='4,6' where region_type=1 and config_ip_type like '%,46,64,10%';
|
||||
|
||||
|
||||
#asn region
|
||||
INSERT INTO function_region_dict (config_service_type,function_id,config_region_code,config_region_value,config_desc,is_valid,is_maat,region_type,config_region_sort)
|
||||
VALUES ('asn',5,5,'NTC_ASN_IP','asn',1,1,1,5);
|
||||
# asn service
|
||||
INSERT INTO function_service_dict (function_id,protocol_id,ACTION,action_code,service_id,service_name,service_desc,is_valid,region_code)
|
||||
VALUES (5,0,16,'reject',37,'ans_reject','ANS_REJECT',1,5);
|
||||
INSERT INTO function_service_dict (function_id,protocol_id,ACTION,action_code,service_id,service_name,service_desc,is_valid,region_code)
|
||||
VALUES (5,0,1,'monit',149,'ans_monit','ANS_MONIT',1,5);
|
||||
@@ -95,7 +95,7 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/common.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/jquery.tagsinput.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/app.js" type="text/javascript"></script>
|
||||
|
||||
<script src="${pageContext.request.contextPath}/static/global/scripts/ipRegion.js" type="text/javascript"></script>
|
||||
<!-- 文件导入 -->
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/bootstrap-fileupload.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/bootstrap-fileupload/js/jquery.cookie.min.js" type="text/javascript"></script>
|
||||
@@ -103,4 +103,4 @@
|
||||
<script src="${pageContext.request.contextPath}/static/global/plugins/jquery-tree-multiselect/jquery.tree-multiselect.js" type="text/javascript"></script>
|
||||
|
||||
<!-- 日志界面 -->
|
||||
<script src="${pageContext.request.contextPath}/static/pages/scripts/pageLogs.js" type="text/javascript"></script>
|
||||
<script src="${pageContext.request.contextPath}/static/pages/scripts/pageLogs.js" type="text/javascript"></script>
|
||||
|
||||
@@ -17,26 +17,64 @@
|
||||
$("#cancel").on("click", function() {
|
||||
window.history.back();
|
||||
});*/
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
var action=$(".action:checked").val();
|
||||
/*if(action==32){
|
||||
$(".subscribeId").find(".glyphicon-remove").click();
|
||||
$(".subscribeId").prev("h4").addClass("hidden");
|
||||
}*/
|
||||
var regionCodes=$(".action:checked").attr("regionCode").split(",");
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
var has=false;
|
||||
for(var ind in regionCodes){
|
||||
if($(this).hasClass("ipPortListTitle"+regionCodes[ind])){
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).html("");
|
||||
var asnRegionCode,configType;
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
var regionCode=$(this).val();
|
||||
if("asn"==$(this).attr("servicetype")){
|
||||
asnRegionCode=$(this).val();
|
||||
}
|
||||
});
|
||||
processAction($(".ipPortList"));
|
||||
$(".configType a").on("click",function(){
|
||||
if($(this).attr("id")=="ipCfgTab"){
|
||||
configType="ip";
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
hideAction(1,asnRegionCode);
|
||||
}else{
|
||||
configType="asn";
|
||||
hideAction(0,asnRegionCode);
|
||||
}
|
||||
var region = ($(this).attr("for"));
|
||||
if(region=="ipaddr"){
|
||||
$(".asn").addClass("hidden").addClass("disabled");
|
||||
$(".ipaddr").removeClass("hidden").removeClass("disabled");
|
||||
}else{
|
||||
$(".ipaddr").addClass("hidden").addClass("disabled");
|
||||
$(".asn").removeClass("hidden").removeClass("disabled");
|
||||
}
|
||||
});
|
||||
//切换tab
|
||||
if("${_cfg.cfgId}"==''){
|
||||
configType='ip';
|
||||
$("#ipCfgTab").click();
|
||||
}else if("${_cfg.userRegion4}"==""){
|
||||
configType='ip';
|
||||
$("#ipCfgTab").click();
|
||||
}else{
|
||||
configType='asn';
|
||||
$("#ansCfgTab").click();
|
||||
}
|
||||
if(configType!='asn'){
|
||||
$(".glyphicon-plus").first().click();
|
||||
$(".ipPortList").find(".glyphicon-remove").addClass("hidden")
|
||||
/*if(action==32){
|
||||
$(".subscribeId").find(".glyphicon-remove").click();
|
||||
$(".subscribeId").prev("h4").addClass("hidden");
|
||||
}*/
|
||||
var regionCodes=$(".action:checked").attr("regionCode").split(",");
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
var has=false;
|
||||
for(var ind in regionCodes){
|
||||
if($(this).hasClass("ipPortListTitle"+regionCodes[ind])){
|
||||
has=true;
|
||||
}
|
||||
}
|
||||
if(!has){
|
||||
$(this).addClass("hidden");
|
||||
}
|
||||
});
|
||||
processAction(configType,$(".ipPortList"));
|
||||
}
|
||||
$(".action").on("change", function() {
|
||||
$("#serviceId").val($(this).attr("serviceId"));
|
||||
$("#protocolId").val($(this).attr("protocolId"));
|
||||
@@ -57,8 +95,24 @@
|
||||
$("h4[class*='ipPortListTitle']").each(function(){
|
||||
$(this).find(".ipPortTitle").html(i18nCode);
|
||||
});
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
if($(this).attr("id")!=("cfgRegionCode"+cfgRegionCode)){
|
||||
$(this).removeAttr("name");
|
||||
$("#cfgType"+$(this).val()).removeAttr("name");
|
||||
}else{
|
||||
$(this).attr("name",'cfgRegionCode');
|
||||
$("#cfgType"+$(this).val()).attr("name",'cfgType');
|
||||
}
|
||||
});
|
||||
var tabInfo=$(".ipPortList");
|
||||
processAction(tabInfo);
|
||||
if(tabInfo){
|
||||
tabInfo.find("[name$='cfgType']").val(cfgType);
|
||||
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
|
||||
}
|
||||
if(configType!='asn'){
|
||||
changeIPVal(tabInfo);
|
||||
}
|
||||
processAction(configType,tabInfo);
|
||||
/* if(tabInfo){
|
||||
tabInfo.find("[name$='cfgType']").val(cfgType);
|
||||
tabInfo.find("[name$='cfgRegionCode']").val(cfgRegionCode);
|
||||
@@ -86,6 +140,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) {
|
||||
@@ -145,11 +202,15 @@
|
||||
flag=flag1;
|
||||
}
|
||||
if(flag){
|
||||
if(configType!='asn'){
|
||||
$("input[name='userRegion4']").attr("disabled",true);
|
||||
}
|
||||
$("input[name$='userRegion1']").attr("disabled",false);
|
||||
$("input[name$='exprType']").attr("disabled",false);
|
||||
//将disable属性的元素删除
|
||||
$(".disabled").each(function(){
|
||||
$(this).remove();
|
||||
});
|
||||
$("input[name$='exprType']").attr("disabled",false);
|
||||
loading('onloading...');
|
||||
form.submit();
|
||||
}else{
|
||||
@@ -185,41 +246,126 @@
|
||||
}); */
|
||||
$("." + addBtnClassName).removeClass("hidden");
|
||||
}
|
||||
var processAction=function(obj){
|
||||
var o=$(obj)
|
||||
if(o){
|
||||
var action=$(".action:checked").val();
|
||||
/*处理协议*/
|
||||
var selectedProtocol=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
if(action==32){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17||$(this).attr("value")==1||$(this).attr("value")==8||$(this).attr("value")==15){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
}else if(action==16){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
}else if(action==64){
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
|
||||
var hideAction=function(isHide,regionCode){
|
||||
var action=$(".action:checked").val();
|
||||
var serviceId=$(".action:checked").attr("serviceId");
|
||||
$(".action").each(function(){
|
||||
var regionCodeArr=$(this).attr("regionCode").split(',');
|
||||
var has=false;
|
||||
for(var code in regionCodeArr){
|
||||
if(regionCode==regionCodeArr[code]){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
//切换后如果没找到选项,选任意协议
|
||||
if(o.find("select[name$='protocol'] option[value='"+selectedProtocol+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",selectedProtocol);
|
||||
if(has){
|
||||
if(isHide==1){
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}else{
|
||||
$(this).removeAttr("disabled");
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
if(isHide==1){
|
||||
$(this).removeAttr("disabled");
|
||||
$(this).parent(".radio-inline").removeClass("hidden");
|
||||
}else{
|
||||
$(this).attr("disabled","disabled");
|
||||
$(this).parent(".radio-inline").addClass("hidden");
|
||||
}
|
||||
}
|
||||
});
|
||||
if($("[class*='action'][value='"+action+"']:visible").length>0){
|
||||
$("[class*='action'][value='"+action+"']:visible").click();
|
||||
}else{
|
||||
$(".action:visible").get(0).click();
|
||||
}
|
||||
var reginosNew=$(".action:checked").attr("regioncode").split(",");
|
||||
$("input[id^='cfgRegionCode']").each(function(){
|
||||
var has=false;
|
||||
for(var code in reginosNew){
|
||||
if($(this).val()==reginosNew[code]){
|
||||
has=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(has){
|
||||
$(this).attr("name","cfgRegionCode");
|
||||
$("#cfgType"+$(this).val()).attr("name","cfgType");
|
||||
}else{
|
||||
$(this).removeAttr("name");
|
||||
$("#cfgType"+$(this).val()).removeAttr("name");
|
||||
}
|
||||
});
|
||||
}
|
||||
var processAction=function(configType,obj){
|
||||
var action=$(".action:checked").val();
|
||||
if(configType!='asn'){
|
||||
var o=$(obj)
|
||||
if(o){
|
||||
/*处理协议*/
|
||||
var selectedProtocol=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
if(action==32){
|
||||
//先清空,再添加
|
||||
/* o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17||$(this).attr("value")==1||$(this).attr("value")==8||$(this).attr("value")==15){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
}) */
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}else if(action==16){
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}else if(action==64){
|
||||
//先清空,再添加
|
||||
/* o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
}) */
|
||||
$(".ratelimitAction").removeClass("hidden");
|
||||
var rateLimitType=$("input[name='userRegion1']:checked").val();
|
||||
if(rateLimitType == 0){//丢包率
|
||||
$(".bandwith").find("input[name='userRegion3']").attr("disabled",true);
|
||||
$(".droprate").find("input[name='userRegion2']").removeAttr("disabled");
|
||||
}
|
||||
if(rateLimitType == 1){//带宽
|
||||
$(".bandwith").find("input[name='userRegion3']").removeAttr("disabled");
|
||||
$(".droprate").find("input[name='userRegion2']").attr("disabled",true);
|
||||
}
|
||||
}else if(action==1){
|
||||
//先清空,再添加
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
if($(this).attr("value")==0||$(this).attr("value")==6||$(this).attr("value")==17){
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
}
|
||||
})
|
||||
$(".ratelimitAction").addClass("hidden");
|
||||
$(".ratelimitAction").find("input[name^='userRegion'],select[name^='userRegion']").attr("disabled",true);
|
||||
}
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
//切换后如果没找到选项,选任意协议
|
||||
if(o.find("select[name$='protocol'] option[value='"+selectedProtocol+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",selectedProtocol);
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
@@ -227,7 +373,7 @@ var processAction=function(obj){
|
||||
<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>
|
||||
<div class="page-content">
|
||||
<%-- <h3 class="page-title">
|
||||
<%-- <h3 class="page-title">
|
||||
<spring:message code="ip_control"></spring:message>
|
||||
</h3> --%>
|
||||
<div class="row">
|
||||
@@ -270,178 +416,264 @@ var processAction=function(obj){
|
||||
value="${region.configRegionCode}">
|
||||
</c:forEach>
|
||||
<div class="form-body">
|
||||
<div class="row">
|
||||
<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">
|
||||
<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:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog begin-->
|
||||
<div class="row doLog">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${dict.itemCode eq _cfg.doLog}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog end-->
|
||||
<c:set var="ipCfgIndex" value="0"></c:set>
|
||||
<c:set var="strCfgIndex" value="0"></c:set>
|
||||
<c:set var="subscribeIdIndex" value="0"></c:set>
|
||||
<c:forEach items="${regionList}" var="region" varStatus="status">
|
||||
<c:if test="${region.regionType eq 1 }">
|
||||
<c:if test="${ipCfgIndex==0}">
|
||||
<!--ip info-->
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section ipPortListTitle${region.configRegionCode}">
|
||||
<span class="ipPortTitle"><spring:message code="${region.configRegionValue}" /></span>
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
|
||||
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
|
||||
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1}"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1 }"></c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
<!--/ip info-->
|
||||
</c:if>
|
||||
<c:if test="${region.regionType eq 2 }">
|
||||
<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:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${subscribeIdIndex}]"></c:set>
|
||||
</c:if>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
|
||||
<c:set var="isBreak" value="false" ></c:set>
|
||||
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
|
||||
<c:choose>
|
||||
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
<div class="portlet-body flip-scroll">
|
||||
<div class="row-fluid">
|
||||
<div class="span12">
|
||||
<div class="tabbable tabbable-custom tabs-left">
|
||||
<!-- Only required for left/right tabs -->
|
||||
<ul class="nav nav-tabs tabs-left">
|
||||
<li class="configType"><a href="#ip_tab" id="ipCfgTab"
|
||||
data-toggle="tab" for="ipaddr"
|
||||
data_dldk="<spring:message code="IP"/>"><spring:message
|
||||
code="IP" /></a></li>
|
||||
<li class="configType"><a href="#asn_tab" data-toggle="tab" for="asn" id="ansCfgTab"
|
||||
data_dldk="<spring:message code="ASN"/>"><spring:message
|
||||
code="ASN" /></a></li>
|
||||
</ul>
|
||||
<div class="tab-content">
|
||||
<div class="row">
|
||||
<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>
|
||||
<c:set var="isBreak" value="true" ></c:set>
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:forEach>
|
||||
<c:if test="${!isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
<div class="col-md-6">
|
||||
<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.serviceId==service.serviceId || (_cfg.serviceId==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:if>
|
||||
</label>
|
||||
</c:forEach>
|
||||
</div>
|
||||
<div for="action"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- dolog begin-->
|
||||
<div class="row doLog">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><spring:message code="do_log" /></label>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:choose>
|
||||
<c:when test="${dict.itemCode eq _cfg.doLog}">
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" checked value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<label class="radio-inline">
|
||||
<input type="radio" name="doLog" value="${dict.itemCode}" ><spring:message code="${dict.itemValue}"/>
|
||||
</label>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
|
||||
</c:forEach>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row ratelimitAction hidden">
|
||||
<div class="col-md-6 hidden">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="limit_rate_type"/></label>
|
||||
<div class="col-md-6">
|
||||
<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" placeholder="0.001" 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>
|
||||
<!-- dolog end-->
|
||||
<c:set var="ipCfgIndex" value="0"></c:set>
|
||||
<c:set var="strCfgIndex" value="0"></c:set>
|
||||
<c:set var="subscribeIdIndex" value="0"></c:set>
|
||||
<c:forEach items="${regionList}" var="region" varStatus="status">
|
||||
<c:if test="${region.regionType eq 1 }">
|
||||
<c:if test="${ipCfgIndex==0}">
|
||||
<div class="ipaddr">
|
||||
<!--ip info-->
|
||||
<c:set var="tabName" value="${region.configRegionValue}Tab"></c:set>
|
||||
<h4 class="form-section ipPortListTitle${region.configRegionCode}">
|
||||
<span class="ipPortTitle"><spring:message code="${region.configRegionValue}" /></span>
|
||||
<small> <span
|
||||
class="glyphicon glyphicon-plus ${tabName}Add"
|
||||
onClick="addContent(this,'${tabName}')" title="add"></span></small>
|
||||
</h4>
|
||||
<c:set var="cfgName" value="ipPortList[${ipCfgIndex}]"></c:set>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ipPortList)>0 and ipCfgIndex<fn:length(_cfg.ipPortList) }">
|
||||
<c:forEach items="${_cfg.ipPortList}" var="ipPort">
|
||||
<c:if test="${region.configRegionValue eq ipPort.cfgType }">
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1}"></c:set>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid ipPortList ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/ipCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="ipCfgIndex" value="${ipCfgIndex+1 }"></c:set>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${region.configServiceType ne 'subscribe_id' }">
|
||||
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
|
||||
<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>
|
||||
<!--/ip info-->
|
||||
</c:if>
|
||||
<c:if test="${region.regionType eq 2 }">
|
||||
<div class="ipaddr">
|
||||
<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:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="cfgName" value="ntcSubscribeIdCfgList[${subscribeIdIndex}]"></c:set>
|
||||
</c:if>
|
||||
<%-- <c:set var="regionValue" value="${region.configRegionValue}"></c:set> --%>
|
||||
<c:choose>
|
||||
<c:when test="${fn:length(_cfg.ntcSubscribeIdCfgList)>0}">
|
||||
<c:set var="isBreak" value="false" ></c:set>
|
||||
<c:forEach items="${_cfg.ntcSubscribeIdCfgList}" var="cfg">
|
||||
<c:choose>
|
||||
<c:when test="${region.configRegionValue eq cfg.cfgType and !isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index}">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:set var="isBreak" value="true" ></c:set>
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:when>
|
||||
</c:choose>
|
||||
</c:forEach>
|
||||
<c:if test="${!isBreak}">
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:if>
|
||||
</c:when>
|
||||
<c:otherwise>
|
||||
<div class="row boxSolid subscribeId ${tabName}${status.index} hidden disabled">
|
||||
<%@include file="/WEB-INF/views/cfg/complexCfgForm.jsp"%>
|
||||
</div>
|
||||
<c:if test="${region.configServiceType eq 'subscribe_id' }">
|
||||
<c:set var="subscribeIdIndex" value="${subscribeIdIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
<c:if test="${region.configServiceType ne 'subscribe_id' }">
|
||||
<c:set var="strCfgIndex" value="${strCfgIndex+1 }"></c:set>
|
||||
</c:if>
|
||||
</c:otherwise>
|
||||
</c:choose>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
<div class="asn">
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="form-group">
|
||||
<label class="control-label col-md-3"><font color="red">*</font><spring:message code="group"/></label>
|
||||
<div class="col-md-6">
|
||||
<select name="userRegion4" class="selectpicker show-tick form-control required" data-live-search="true" data-live-search-placeholder="search">
|
||||
<c:forEach items="${policyGroups }" var="policyGroup">
|
||||
<option value="${policyGroup.groupId}" <c:if test="${_cfg.userRegion1==policyGroup.groupId }">selected</c:if>><spring:message code="${policyGroup.groupName}"/></option>
|
||||
</c:forEach>
|
||||
</select>
|
||||
</div>
|
||||
<div for="userRegion4"></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/areaInfo.jsp"%>
|
||||
<br>
|
||||
<%@include file="/WEB-INF/include/form/basicInfo.jsp"%>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</form>
|
||||
<!-- END FORM-->
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
<form:select id="actionSelect" path="action" class="selectpicker select2 input-small" >
|
||||
<form:option value=""><spring:message code="select"/></form:option>
|
||||
<c:forEach items="${serviceList}" var="service">
|
||||
<form:option value="${service.action }"><spring:message code="action_${service.actionCode }"/></form:option>
|
||||
<form:option value="${service.action }"><spring:message code="${service.serviceName}"/> <spring:message code="action_${service.actionCode }"/></form:option>
|
||||
</c:forEach>
|
||||
</form:select>
|
||||
<form:select path="isValid" class="selectpicker select2 input-small" >
|
||||
@@ -319,6 +319,7 @@
|
||||
<th class="sort-column a.compile_id" style="display: none"><spring:message code="cfg_id"/></th>
|
||||
<th class="sort-column a.cfg_desc cfgDesc"><spring:message code="config_describe"/></th>
|
||||
<th class="sort-column a.action"><spring:message code="block_type"/></th>
|
||||
<th><spring:message code="ratelimit"/></th>
|
||||
<th><spring:message code="do_log"/></th>
|
||||
<th><spring:message code="whether_area_block"/></th>
|
||||
<th><spring:message code="letter"/></th>
|
||||
@@ -352,6 +353,7 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</td>
|
||||
<td>${indexCfg.userRegion2 }</td>
|
||||
<td>
|
||||
<c:forEach items="${fns:getDictList('DO_LOG') }" var="dict">
|
||||
<c:if test="${dict.itemCode eq indexCfg.doLog }">
|
||||
|
||||
@@ -218,5 +218,19 @@
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</c:if>
|
||||
<c:if test="${(region[0] eq 3) && (not empty _cfg.userRegion4)}">
|
||||
<div id="${region[1]}Info${index}" class="content" name="subCfg${index}">
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label><spring:message code='group'/>:</label>
|
||||
<label>
|
||||
${_cfg.asnIpGroupName}
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</c:if>
|
||||
</c:forEach>
|
||||
</html>
|
||||
@@ -1,14 +1,4 @@
|
||||
$(function(){
|
||||
$.ipcommon=function(){
|
||||
return {};
|
||||
}
|
||||
$.extend($.ipcommon, {
|
||||
ipType:[],
|
||||
ipPattern:[],
|
||||
portPattern:[],
|
||||
protocol:[],
|
||||
direction:[]
|
||||
});
|
||||
$("input[name$='isCaseSenstive']").on("change",function(){
|
||||
setIsHexBin(this);
|
||||
});
|
||||
@@ -425,7 +415,6 @@ $(function(){
|
||||
window.history.back();
|
||||
return false;
|
||||
});
|
||||
initCommIpVal();
|
||||
//去掉首尾空格
|
||||
$("input,textarea").on("blur",function(){
|
||||
var val=$(this).val();
|
||||
@@ -1675,185 +1664,6 @@ var setHexCaseSenstive=function(){
|
||||
|
||||
});
|
||||
}
|
||||
/**
|
||||
* ip默认选项处理
|
||||
*/
|
||||
var initCommIpVal=function(){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType;
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
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(',');
|
||||
$.ipcommon.ipType=$("select[name$='ipType'] option");
|
||||
$("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).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.ipType=[];
|
||||
}
|
||||
//ip格式处理
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
|
||||
$("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).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.ipPattern=[];
|
||||
}
|
||||
//端口格式处理
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
|
||||
$("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).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.portPattern=[];
|
||||
}
|
||||
//方向处理
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
$.ipcommon.direction=$("select[name$='direction'] option");
|
||||
$("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).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.direction=[];
|
||||
}
|
||||
//协议处理
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
$.ipcommon.protocol=$("select[name$='protocol'] option");
|
||||
$("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).remove();
|
||||
}
|
||||
});
|
||||
}else{
|
||||
$.ipcommon.protocol=[];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function heightDiv(type){
|
||||
var hei=document.documentElement.clientHeight;
|
||||
|
||||
371
src/main/webapp/static/global/scripts/ipRegion.js
Normal file
371
src/main/webapp/static/global/scripts/ipRegion.js
Normal file
@@ -0,0 +1,371 @@
|
||||
/**
|
||||
* 处理IP域值
|
||||
*/
|
||||
;(function($){
|
||||
$.extend({
|
||||
ipcommon:function(){
|
||||
return {};
|
||||
}
|
||||
});
|
||||
$.extend($.ipcommon, {
|
||||
ipType:[],
|
||||
ipPattern:[],
|
||||
portPattern:[],
|
||||
protocol:[],
|
||||
direction:[]
|
||||
});
|
||||
})(jQuery);
|
||||
$(function(){
|
||||
initCommIpVal();
|
||||
});
|
||||
window.$.ipcommon=$.ipcommon;
|
||||
/**
|
||||
* ip默认选项处理
|
||||
*/
|
||||
var initCommIpVal=function(){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType;
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
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类型处理
|
||||
$.ipcommon.ipType=$("select[name$='ipType'] option");
|
||||
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).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//ip格式处理
|
||||
$.ipcommon.ipPattern=$("select[name$='ipPattern'] option");
|
||||
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).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//端口格式处理
|
||||
$.ipcommon.portPattern=$("select[name$='portPattern'] option");
|
||||
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).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//方向处理
|
||||
$.ipcommon.direction=$("select[name$='direction'] option");
|
||||
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).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
//协议处理
|
||||
$.ipcommon.protocol=$("select[name$='protocol'] option");
|
||||
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).remove();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* ip切换默认值处理
|
||||
*/
|
||||
var changeIPVal=function(obj){
|
||||
var action,regionCode,serviceType,ipPortShow,ipType,
|
||||
ipPattern,portPattern,direction,protocol,regionType,o;
|
||||
o=$(obj);
|
||||
if($("input[name$='action']:checked").length>0){
|
||||
regionCode=$("input[name$='action']:checked").attr("regionCode");
|
||||
action=$("input[name$='action']:checked").val();
|
||||
}else{
|
||||
regionCode=$("input[name$='action']").attr("regionCode");
|
||||
action=$("input[name$='action']").val();
|
||||
}
|
||||
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");
|
||||
}
|
||||
if(o){
|
||||
//ip,端口处理
|
||||
if(ipPortShow){
|
||||
if(ipPortShow.indexOf('1')>-1){//展示源IP,端口
|
||||
o.find("input[name$='srcIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
o.find("input[name$='srcPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
o.find("input[name$='srcIpAddress']").parents(".form-group").addClass("hidden");
|
||||
o.find("input[name$='srcPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
if(ipPortShow.indexOf('2')>-1){//展示目的IP,端口
|
||||
o.find("input[name$='destIpAddress']").parents(".form-group").removeClass("hidden");
|
||||
o.find("input[name$='destPort']").parents(".form-group").removeClass("hidden");
|
||||
}else{
|
||||
o.find("input[name$='destIpAddress']").parents(".form-group").addClass("hidden");
|
||||
o.find("input[name$='destPort']").parents(".form-group").addClass("hidden");
|
||||
}
|
||||
}
|
||||
//ip类型处理
|
||||
if(ipType){
|
||||
var arr=ipType.split(',');
|
||||
var ipTypeVal=o.find("select[name$='ipType'] option:selected").attr("value");
|
||||
o.find("select[name$='ipType']").empty();
|
||||
$.ipcommon.ipType.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='ipType']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='ipType']").selectpicker("refresh");
|
||||
if(o.find("select[name$='ipType'] option[value='"+ipTypeVal+"']").length>0){
|
||||
o.find("select[name$='ipType']").selectpicker("val",ipTypeVal);
|
||||
}else{
|
||||
o.find("select[name$='ipType']").selectpicker("val",4);
|
||||
}
|
||||
|
||||
}
|
||||
//ip格式处理
|
||||
if(ipPattern){
|
||||
arr=ipPattern.split(',');
|
||||
var ipPatternVal=o.find("select[name$='ipPattern'] option:selected").attr("value");
|
||||
o.find("select[name$='ipPattern']").empty();
|
||||
$.ipcommon.ipPattern.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='ipPattern']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='ipPattern']").selectpicker("refresh");
|
||||
if(o.find("select[name$='ipPattern'] option[value='"+ipPatternVal+"']").length>0){
|
||||
o.find("select[name$='ipPattern']").selectpicker("val",ipPatternVal);
|
||||
}else{
|
||||
o.find("select[name$='ipPattern']").selectpicker("val",1);
|
||||
}
|
||||
}
|
||||
//端口格式处理
|
||||
if(portPattern){
|
||||
arr=portPattern.split(',');
|
||||
var portPatternVal=o.find("select[name$='portPattern'] option:selected").attr("value");
|
||||
o.find("select[name$='portPattern']").empty();
|
||||
$.ipcommon.portPattern.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='portPattern']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='portPattern']").selectpicker("refresh");
|
||||
if(o.find("select[name$='portPattern'] option[value='"+portPatternVal+"']").length>0){
|
||||
o.find("select[name$='portPattern']").selectpicker("val",portPatternVal);
|
||||
}else{
|
||||
o.find("select[name$='portPattern']").selectpicker("val",1);
|
||||
}
|
||||
}
|
||||
//方向处理
|
||||
if(direction){
|
||||
arr=direction.split(',');
|
||||
var directionVal=o.find("select[name$='direction'] option:selected").attr("value");
|
||||
o.find("select[name$='direction']").empty();
|
||||
$.ipcommon.direction.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='direction']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='direction']").selectpicker("refresh");
|
||||
if(o.find("select[name$='direction'] option[value='"+directionVal+"']").length>0){
|
||||
o.find("select[name$='direction']").selectpicker("val",directionVal);
|
||||
}else{
|
||||
o.find("select[name$='direction']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
//协议处理
|
||||
if(protocol){
|
||||
arr=protocol.split(',');
|
||||
var protocolVal=o.find("select[name$='protocol'] option:selected").attr("value");
|
||||
o.find("select[name$='protocol']").empty();
|
||||
$.ipcommon.protocol.each(function(){
|
||||
var has=false;
|
||||
for(var type in arr){
|
||||
if($(this).val()==arr[type]){
|
||||
has=true;
|
||||
o.find("select[name$='protocol']").append($(this));
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
o.find("select[name$='protocol']").selectpicker("refresh");
|
||||
if(o.find("select[name$='protocol'] option[value='"+protocolVal+"']").length>0){
|
||||
o.find("select[name$='protocol']").selectpicker("val",protocolVal);
|
||||
}else{
|
||||
o.find("select[name$='protocol']").selectpicker("val",0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user