Authored by mlge

java发布项目分类

@@ -20,6 +20,8 @@ public class Project { @@ -20,6 +20,8 @@ public class Project {
20 //项目支持的发布环境,add by craig.qin 2018/4/9 20 //项目支持的发布环境,add by craig.qin 2018/4/9
21 private List<String> supportEnvList=new ArrayList<>(); 21 private List<String> supportEnvList=new ArrayList<>();
22 22
  23 + private String groupType;//类型--方便前端分类展示
  24 +
23 public Project(){ 25 public Project(){
24 26
25 } 27 }
@@ -32,12 +34,13 @@ public class Project { @@ -32,12 +34,13 @@ public class Project {
32 this.supportEnvList.addAll(ProjectOnline.getJavaEnvListALL()); 34 this.supportEnvList.addAll(ProjectOnline.getJavaEnvListALL());
33 }*/ 35 }*/
34 36
35 - public Project(String order, String name, String projectid, String group,String supportEnv){ 37 + public Project(String order, String name, String projectid, String group,String supportEnv, String groupType){
36 this.order = order; 38 this.order = order;
37 this.name = name; 39 this.name = name;
38 this.projectid = projectid; 40 this.projectid = projectid;
39 this.group = group; 41 this.group = group;
40 this.supportEnvList.addAll(Arrays.asList(supportEnv.split(","))); 42 this.supportEnvList.addAll(Arrays.asList(supportEnv.split(",")));
  43 + this.groupType = groupType;
41 } 44 }
42 45
43 public Project(String order, String name, String projectid, String group,List<String> supportEnvs){ 46 public Project(String order, String name, String projectid, String group,List<String> supportEnvs){
@@ -84,4 +87,12 @@ public class Project { @@ -84,4 +87,12 @@ public class Project {
84 public List<String> getSupportEnvList() { 87 public List<String> getSupportEnvList() {
85 return supportEnvList; 88 return supportEnvList;
86 } 89 }
  90 +
  91 + public String getGroupType() {
  92 + return groupType;
  93 + }
  94 +
  95 + public void setGroupType(String groupType) {
  96 + this.groupType = groupType;
  97 + }
87 } 98 }
@@ -22,37 +22,37 @@ public class ProjectOnline { @@ -22,37 +22,37 @@ public class ProjectOnline {
22 22
23 static{ 23 static{
24 // java 核心服务 24 // java 核心服务
25 - JAVA_LIST.add(new Project("1","yohobuy-activity","129","yoho30",JAVA_ENV_ALL));  
26 - JAVA_LIST.add(new Project("1","yohobuy-wechat","248","yoho30",JAVA_ENV_ALL));  
27 - JAVA_LIST.add(new Project("1","yoho-sns","125","yoho30",JAVA_ENV_ALL));  
28 - JAVA_LIST.add(new Project("1","yoho-erp-gateway","977","yoho30",JAVA_ENV_ALL));  
29 - JAVA_LIST.add(new Project("1","yoho-message","123","yoho30","aws,qcloud,qcloud_gray,"+JAVA_ENV_QCLOUD_AZ2));  
30 - JAVA_LIST.add(new Project("1","uic","439","yoho30",JAVA_ENV_ALL));  
31 - JAVA_LIST.add(new Project("1","yoho-users","134","yoho30",JAVA_ENV_ALL));  
32 - JAVA_LIST.add(new Project("1","yohobuy-resources","122","yoho30",JAVA_ENV_ALL));  
33 - JAVA_LIST.add(new Project("1","yohobuy-promotion","140","yoho30",JAVA_ENV_ALL));  
34 - JAVA_LIST.add(new Project("1","yohobuy-product","143","yoho30",JAVA_ENV_ALL));  
35 - JAVA_LIST.add(new Project("1","yohobuy-order","124","yoho30",JAVA_ENV_ALL));  
36 - JAVA_LIST.add(new Project("1","yohobuy-brower","131","yoho30",JAVA_ENV_ALL));  
37 - JAVA_LIST.add(new Project("1","yohobuy-bigdata","144","yoho30",JAVA_ENV_ALL));  
38 - JAVA_LIST.add(new Project("1","yoho-gateway","126","yoho30",JAVA_ENV_ALL));  
39 - JAVA_LIST.add(new Project("1","yohobuy-risk","932","yoho30",JAVA_ENV_ALL)); 25 + JAVA_LIST.add(new Project("1","yohobuy-activity","129","yoho30",JAVA_ENV_ALL, "java 核心服务"));
  26 + JAVA_LIST.add(new Project("1","yohobuy-wechat","248","yoho30",JAVA_ENV_ALL, "java 核心服务"));
  27 + JAVA_LIST.add(new Project("1","yoho-sns","125","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  28 + JAVA_LIST.add(new Project("1","yoho-erp-gateway","977","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  29 + JAVA_LIST.add(new Project("1","yoho-message","123","yoho30","aws,qcloud,qcloud_gray,"+JAVA_ENV_QCLOUD_AZ2,"java 核心服务"));
  30 + JAVA_LIST.add(new Project("1","uic","439","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  31 + JAVA_LIST.add(new Project("1","yoho-users","134","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  32 + JAVA_LIST.add(new Project("1","yohobuy-resources","122","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  33 + JAVA_LIST.add(new Project("1","yohobuy-promotion","140","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  34 + JAVA_LIST.add(new Project("1","yohobuy-product","143","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  35 + JAVA_LIST.add(new Project("1","yohobuy-order","124","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  36 + JAVA_LIST.add(new Project("1","yohobuy-brower","131","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  37 + JAVA_LIST.add(new Project("1","yohobuy-bigdata","144","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  38 + JAVA_LIST.add(new Project("1","yoho-gateway","126","yoho30",JAVA_ENV_ALL,"java 核心服务"));
  39 + JAVA_LIST.add(new Project("1","yohobuy-risk","932","yoho30",JAVA_ENV_ALL,"java 核心服务"));
40 40
41 //只有qcloud_gray: 媒体java (灰度) 41 //只有qcloud_gray: 媒体java (灰度)
42 - JAVA_LIST.add(new Project("1", "yoho-now", "690", "YOHONow","qcloud_gray"));  
43 - JAVA_LIST.add(new Project("1","yoho-mars","737","media","qcloud_gray"));  
44 - JAVA_LIST.add(new Project("1","yohomars-platform","764","media","qcloud_gray"));  
45 - JAVA_LIST.add(new Project("1","yohonow-platform","775","media","qcloud_gray")); 42 + JAVA_LIST.add(new Project("1", "yoho-now", "690", "YOHONow","qcloud_gray","媒体java (灰度)"));
  43 + JAVA_LIST.add(new Project("1","yoho-mars","737","media","qcloud_gray","媒体java (灰度)"));
  44 + JAVA_LIST.add(new Project("1","yohomars-platform","764","media","qcloud_gray","媒体java (灰度)"));
  45 + JAVA_LIST.add(new Project("1","yohonow-platform","775","media","qcloud_gray","媒体java (灰度)"));
46 46
47 //只有qcloud : java服务-单中心 47 //只有qcloud : java服务-单中心
48 - JAVA_LIST.add(new Project("1","yoho-push","137","yoho30","qcloud"));  
49 - JAVA_LIST.add(new Project("1","cms_push","514","yoho30","qcloud"));  
50 - JAVA_LIST.add(new Project("1","yoho-social","353","yoho30","qcloud"));  
51 - JAVA_LIST.add(new Project("1","yohobuy-union","133","yoho30","qcloud"));  
52 - JAVA_LIST.add(new Project("1","yohobuy-crm","275","yoho30","qcloud"));  
53 - JAVA_LIST.add(new Project("1","yohobuy-task","138","yoho30","qcloud"));  
54 - JAVA_LIST.add(new Project("1","yoho-message-controller","684","yoho30","qcloud"));  
55 - JAVA_LIST.add(new Project("1","yoho-message-sender","685","yoho30","qcloud")); 48 + JAVA_LIST.add(new Project("1","yoho-push","137","yoho30","qcloud","java服务-单中心"));
  49 + JAVA_LIST.add(new Project("1","cms_push","514","yoho30","qcloud","java服务-单中心"));
  50 + JAVA_LIST.add(new Project("1","yoho-social","353","yoho30","qcloud","java服务-单中心"));
  51 + JAVA_LIST.add(new Project("1","yohobuy-union","133","yoho30","qcloud","java服务-单中心"));
  52 + JAVA_LIST.add(new Project("1","yohobuy-crm","275","yoho30","qcloud","java服务-单中心"));
  53 + JAVA_LIST.add(new Project("1","yohobuy-task","138","yoho30","qcloud","java服务-单中心"));
  54 + JAVA_LIST.add(new Project("1","yoho-message-controller","684","yoho30","qcloud","java服务-单中心"));
  55 + JAVA_LIST.add(new Project("1","yoho-message-sender","685","yoho30","qcloud","java服务-单中心"));
56 56
57 57
58 //JAVA_LIST.add(new Project("1","yoho-cobar","461","yoho30")); 58 //JAVA_LIST.add(new Project("1","yoho-cobar","461","yoho30"));
@@ -61,19 +61,19 @@ public class ProjectOnline { @@ -61,19 +61,19 @@ public class ProjectOnline {
61 //JAVA_LIST.add(new Project("1","yoho-union-recomand","789","yoho30")); 61 //JAVA_LIST.add(new Project("1","yoho-union-recomand","789","yoho30"));
62 62
63 //只有qcloud、 qcloud灰度。 线下店java服务 63 //只有qcloud、 qcloud灰度。 线下店java服务
64 - JAVA_LIST.add(new Project("1","yohobuy-shops","490","yoho30",JAVA_ENV_QCLOUD));  
65 - JAVA_LIST.add(new Project("1","yohobuy-portal-gateway","557","yoho30",JAVA_ENV_QCLOUD));  
66 - JAVA_LIST.add(new Project("1","yohobuy-extendstore","852","yoho30",JAVA_ENV_QCLOUD)); 64 + JAVA_LIST.add(new Project("1","yohobuy-shops","490","yoho30",JAVA_ENV_QCLOUD,"线下店java服务"));
  65 + JAVA_LIST.add(new Project("1","yohobuy-portal-gateway","557","yoho30",JAVA_ENV_QCLOUD,"线下店java服务"));
  66 + JAVA_LIST.add(new Project("1","yohobuy-extendstore","852","yoho30",JAVA_ENV_QCLOUD,"线下店java服务"));
67 67
68 68
69 69
70 - JAVA_LIST.add(new Project("2","yoho-search-service","12","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2));  
71 - JAVA_LIST.add(new Project("2","yoho-search-consumer","8","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2));  
72 - JAVA_LIST.add(new Project("2","yoho-search-producer","7","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2));  
73 - JAVA_LIST.add(new Project("2","yohomars-search-service","554","yoho-search",JAVA_ENV_QCLOUD_AWS));  
74 - JAVA_LIST.add(new Project("2","yoho-search-adaptor","13","yoho-search","aws,qcloud")); 70 + JAVA_LIST.add(new Project("2","yoho-search-service","12","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2,""));
  71 + JAVA_LIST.add(new Project("2","yoho-search-consumer","8","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2,""));
  72 + JAVA_LIST.add(new Project("2","yoho-search-producer","7","yoho-search","aws,qcloud,"+JAVA_ENV_QCLOUD_AZ2,""));
  73 + JAVA_LIST.add(new Project("2","yohomars-search-service","554","yoho-search",JAVA_ENV_QCLOUD_AWS,""));
  74 + JAVA_LIST.add(new Project("2","yoho-search-adaptor","13","yoho-search","aws,qcloud",""));
75 75
76 - JAVA_LIST.add(new Project("3","yohobuy-platform","110","platform",JAVA_ENV_QCLOUD_AWS)); 76 + JAVA_LIST.add(new Project("3","yohobuy-platform","110","platform",JAVA_ENV_QCLOUD_AWS,""));
77 77
78 //把list转成map,放到最后 78 //把list转成map,放到最后
79 JAVA_MAP=JAVA_LIST.stream().collect(Collectors.toMap(Project::getName,Project->Project)); 79 JAVA_MAP=JAVA_LIST.stream().collect(Collectors.toMap(Project::getName,Project->Project));
@@ -197,7 +197,7 @@ @@ -197,7 +197,7 @@
197 <script src="<%=basePath %>/js/unicorn.js"></script> 197 <script src="<%=basePath %>/js/unicorn.js"></script>
198 <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script> 198 <script src="<%=basePath %>js/bootstrap-plugin/bootstrap.dialog.js" charset="UTF-8" type="text/javascript"></script>
199 <script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script> 199 <script src="<%=basePath %>script/common/genarate_left_panel.js?v=<%=ProjectConstant.MENU_VERSION %>"></script>
200 -<script src="<%=basePath%>script/build/project.js?v=20180416"></script> 200 +<script src="<%=basePath%>script/build/project.js?v=20180417"></script>
201 <script type="text/javascript"> 201 <script type="text/javascript">
202 $("#li_project").addClass("active open"); 202 $("#li_project").addClass("active open");
203 $("#li_projectRelease").addClass("active"); 203 $("#li_projectRelease").addClass("active");
@@ -42,46 +42,45 @@ function getProjects() { @@ -42,46 +42,45 @@ function getProjects() {
42 var order1HTML = "<div class='ckbox ckbox-primary'>"; 42 var order1HTML = "<div class='ckbox ckbox-primary'>";
43 order1HTML += " <input name='project1all' type='checkbox' id='project1all' value='project1all' onclick='projectcheckall(this,\"project1\");'/>"; 43 order1HTML += " <input name='project1all' type='checkbox' id='project1all' value='project1all' onclick='projectcheckall(this,\"project1\");'/>";
44 order1HTML += "<label for='project1all' style='width: 200px'>yoho30 全选</label></div>"; 44 order1HTML += "<label for='project1all' style='width: 200px'>yoho30 全选</label></div>";
45 - order1HTML += "<span style='display: none'>replace begin</span>";  
46 var order2HTML = "<div class='ckbox ckbox-warning'>"; 45 var order2HTML = "<div class='ckbox ckbox-warning'>";
47 order2HTML += " <input name='project2all' type='checkbox' id='project2all' value='project2all' onclick='projectcheckall(this,\"project2\");'/>"; 46 order2HTML += " <input name='project2all' type='checkbox' id='project2all' value='project2all' onclick='projectcheckall(this,\"project2\");'/>";
48 order2HTML += "<label for='project2all' style='width: 200px'>yoho-search 全选</label></div>"; 47 order2HTML += "<label for='project2all' style='width: 200px'>yoho-search 全选</label></div>";
49 - 48 + order2HTML += "<div style='border:1px dashed ;padding-left: 8px'>";
50 var order3HTML = "<div class='ckbox ckbox-success'>"; 49 var order3HTML = "<div class='ckbox ckbox-success'>";
51 order3HTML += " <input name='project3all' type='checkbox' id='project3all' value='project3all' onclick='projectcheckall(this,\"project3\");'/>"; 50 order3HTML += " <input name='project3all' type='checkbox' id='project3all' value='project3all' onclick='projectcheckall(this,\"project3\");'/>";
52 order3HTML += "<label for='project3all' style='width: 200px'>platform 全选</label></div>"; 51 order3HTML += "<label for='project3all' style='width: 200px'>platform 全选</label></div>";
53 -  
54 - var order1num = 1; 52 + order3HTML += "<div style='border:1px dashed ;padding-left: 8px'>";
55 var order2num = 1; 53 var order2num = 1;
56 var order3num = 1; 54 var order3num = 1;
  55 + var order1HTMLMap = new Map();//div 名字 and 具体html内容
  56 + var order1HTMLMapCount = new Map();//计数的,控制换行
57 57
58 for (var i = 0; i < obj.length; i++) { 58 for (var i = 0; i < obj.length; i++) {
59 - var order = obj[i].order; 59 + var order = obj[i].order;//大分类
60 var name = obj[i].name; 60 var name = obj[i].name;
61 var checkstr=""; 61 var checkstr="";
62 if(default_releaseWorkJob_project!=null&&default_releaseWorkJob_project.indexOf(name+",")>=0){ 62 if(default_releaseWorkJob_project!=null&&default_releaseWorkJob_project.indexOf(name+",")>=0){
63 checkstr = " checked "; 63 checkstr = " checked ";
64 } 64 }
65 - if ("1" == order) {  
66 - order1HTML += "<div class='ckbox ckbox-primary' style='display: inline'>";  
67 - order1HTML += " <input name='project1' type='checkbox' " + checkstr ;  
68 - order1HTML += " onclick='loadProjectEnvs()' ";  
69 - order1HTML += " id='" + name + "' value='" + name + "'/>";  
70 - order1HTML += "<label for='" + name + "' style='width: 200px'>" + name + "</label></div>";  
71 - if (order1num % 4 == 0) {  
72 - order1HTML += "</br>"; 65 + if ("1" == order) {//第一大类--java 核心服务
  66 + var groupType = obj[i].groupType;//再细分类别
  67 + var currentCount = order1HTMLMapCount[groupType];
  68 + var currentHtml = order1HTMLMap[groupType];//当前的html
  69 + if(currentCount == null || currentCount == 0){//div 的头部
  70 + currentCount = 0;
  71 + currentHtml= "<div style='border:1px dashed ;'> <fieldset><legend style='height:25px;margin-left:0px;margin-top:4px;margin-bottom: 4px;font-size: 14px; background-color: #c9cecf'>&nbsp;&nbsp;"+groupType+":</legend><div style='margin-left: 8px'>";
73 } 72 }
74 73
75 - if("yohobuy-risk"==name){  
76 - var changeBr="</br>";  
77 - if(order1num % 4 == 0){  
78 - changeBr="";  
79 - }  
80 - order1HTML += "<span style='display: none'>replace end</span>"+changeBr;  
81 - order1num = 0;//重置 74 + if (currentCount > 0 && currentCount % 4 == 0) {//换行
  75 + currentHtml += "</br>";
82 } 76 }
83 - order1num += 1;  
84 - 77 + currentHtml += "<div class='ckbox ckbox-primary' style='display: inline'>";
  78 + currentHtml += " <input name='project1' type='checkbox' " + checkstr ;
  79 + currentHtml += " onclick='loadProjectEnvs()' ";
  80 + currentHtml += " id='" + name + "' value='" + name + "'/>";
  81 + currentHtml += "<label for='" + name + "' style='width: 200px'>" + name + "</label></div>";
  82 + order1HTMLMap[groupType] = currentHtml;//显示的内容
  83 + order1HTMLMapCount[groupType] = currentCount + 1;//计数器
85 } 84 }
86 if ("2" == order) { 85 if ("2" == order) {
87 order2HTML += "<div class='ckbox ckbox-warning' style='display: inline'>"; 86 order2HTML += "<div class='ckbox ckbox-warning' style='display: inline'>";
@@ -105,14 +104,15 @@ function getProjects() { @@ -105,14 +104,15 @@ function getProjects() {
105 order3HTML += "</br>"; 104 order3HTML += "</br>";
106 } 105 }
107 order3num += 1; 106 order3num += 1;
108 -  
109 } 107 }
110 -  
111 } 108 }
112 - order1HTML=order1HTML.replace("<span style='display: none'>replace begin</span>","<div style='border:1px dashed gray'>");  
113 - order1HTML=order1HTML.replace("<span style='display: none'>replace end</span>","</div>"); 109 + //循环遍历,给每一种类型结尾
  110 + for(var html1Map in order1HTMLMap){
  111 + order1HTMLMap[html1Map] += "</fieldset></div></div>";//div 结尾
  112 + order1HTML += order1HTMLMap[html1Map] +"</br>";
  113 + }
114 114
115 - document.getElementById("project-div").innerHTML = order1HTML + "<hr>" + order2HTML + "<hr>" + order3HTML; 115 + document.getElementById("project-div").innerHTML = order1HTML + "</br>" + order2HTML + "</div><hr>" + order3HTML +"</div>";
116 branchdefault(); 116 branchdefault();
117 } else {//回滚单选框 117 } else {//回滚单选框
118 var order1HTML = ""; 118 var order1HTML = "";