Authored by qinchao

node工单界面

... ... @@ -86,7 +86,7 @@
</div>
</div>
<div class="form-group">
<div id="environmentDiv" class="form-group">
<label class="col-sm-1 control-label"><strong>环境选择: </strong></label>
<div class="col-sm-8">
<div id="environmentDiv_common">
... ... @@ -135,6 +135,15 @@
</div>
</div>
<div id="environmentNodeDiv" class="form-group">
<label class="col-sm-1 control-label"><strong>环境选择: </strong></label>
<div class="col-sm-8">
<div id="environmentDiv_node">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label"><strong>Branch输入:</strong></label>
<div class="col-sm-8">
... ... @@ -194,7 +203,7 @@
<div class="form-group">
<label class="col-sm-1 control-label"><strong>审核人: </strong></label>
<div class="col-sm-8">
<div class="col-sm-8">
<select id="verifier" name = "verifier" class="form-control" placeholder="" style="width:300px;" >
<option value="" ></option>
<c:forEach items="${verifiers}" var="v">
... ... @@ -287,6 +296,8 @@
var projectType=$("input[name='projectTypes']:checked").val();
var getProjectUrl=contextPath + 'workSystem/getProjectsByPlatform?platform='+platform;
if("DOCKER" == platform){
$("#environmentDiv").show();
$("#environmentNodeDiv").hide();
$("#environmentDiv_common").hide();
$("#environmentDiv_docker").show();
$("#projectTypesDiv").show();
... ... @@ -295,22 +306,47 @@
$("#environmentDiv_common").show();
$("#environmentDiv_docker").hide();
$("#projectTypesDiv").hide();
if("NODE" == platform){
$("#environmentDiv").hide();
$("#environmentNodeDiv").show();
}else{
$("#environmentDiv").show();
$("#environmentNodeDiv").hide();
}
}
$("#projects_div").empty();
$.ajax({
url: getProjectUrl,
type: 'POST',
success: function (data) {
var project_HTML = "";
var checkType='checkbox';
var checkTypeCss='ckbox ckbox-primary';
if("NODE" == platform){
checkType='radio';
checkTypeCss='rdio rdio-default';
}
if(data==null){
return ;
}
for (var i = 0; i < data.length; i++) {
if (i % 4 == 0) {
project_HTML += "</br>";
}
project_HTML += "<div class='ckbox ckbox-primary' style='display: inline'>";
project_HTML += " <input name='project' type='checkbox' id='" + data[i].name + "' value='" + data[i].name + "'/>";
project_HTML += "<div class='"+checkTypeCss+"' style='display: inline'>";
project_HTML += " <input name='project' type='"+checkType+"' id='" + data[i].name + "' value='" + data[i].name +"' ";
if("NODE" == platform){
project_HTML += " onclick = loadNodeEnv('"+data[i].name+"') ";
}
project_HTML += "/>";
project_HTML += "<label for='" + data[i].name + "' style='width: 200px'>" + data[i].name + "</label></div>";
}
document.getElementById("projects_div").innerHTML = project_HTML;
},
error: function (e) {
... ... @@ -320,6 +356,46 @@
testPlatform();
}
//加载环境
function loadNodeEnv(projName){
$("#environmentDiv_node").html("");
$.ajax({
url: contextPath+'workSystem/getNodeEnvByProject?name=' + projName,
type: 'POST',
dataType: 'json',
success: function (data) {
$("#environmentDiv_node").empty();
if ("failed" == data) {
return;
}
var pythonProject = eval("(" + data + ")");
//动态生成环境的组件
var list = pythonProject.envs;
var node_env_HTML = "";
for(var i = 0; i < list.length; i++){
var env = list[i];
if (i % 4 == 0) {
node_env_HTML += "</br>";
}
var show_label=env.name;
if(env.name=='az2'){
show_label=env.name+'(灰度)';
}
node_env_HTML += "<div class='ckbox ckbox-primary' style='display: inline'>";
node_env_HTML += " <input name='environment' type='checkbox' id='node_env_" + env.name + "' value='" + env.name +"' ";
node_env_HTML += "/>";
node_env_HTML += "<label for='node_env_" + env.name + "' style='width: 200px'>" + show_label + "</label></div>";
}
$("#environmentDiv_node").append(node_env_HTML);
},
error: function (e) {
alert("获取项目环境失败");
}
});
}
function testPlatform(){
document.getElementById("test_div").innerHTML = "";
var platform = $('input:radio[name=platform]:checked').val();
... ...
... ... @@ -86,7 +86,7 @@
</div>
</div>
<div id="environmentDiv" class="form-group">
<div class="form-group">
<label class="col-sm-1 control-label"><strong>环境选择: </strong></label>
<div class="col-sm-8">
<div id="environmentDiv_common">
... ... @@ -135,15 +135,6 @@
</div>
</div>
<div id="environmentNodeDiv" class="form-group">
<label class="col-sm-1 control-label"><strong>环境选择: </strong></label>
<div class="col-sm-8">
<div id="environmentDiv_node">
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-1 control-label"><strong>Branch输入:</strong></label>
<div class="col-sm-8">
... ... @@ -203,7 +194,7 @@
<div class="form-group">
<label class="col-sm-1 control-label"><strong>审核人: </strong></label>
<div class="col-sm-8">
<div class="col-sm-8">
<select id="verifier" name = "verifier" class="form-control" placeholder="" style="width:300px;" >
<option value="" ></option>
<c:forEach items="${verifiers}" var="v">
... ... @@ -296,8 +287,6 @@
var projectType=$("input[name='projectTypes']:checked").val();
var getProjectUrl=contextPath + 'workSystem/getProjectsByPlatform?platform='+platform;
if("DOCKER" == platform){
$("#environmentDiv").show();
$("#environmentNodeDiv").hide();
$("#environmentDiv_common").hide();
$("#environmentDiv_docker").show();
$("#projectTypesDiv").show();
... ... @@ -306,47 +295,22 @@
$("#environmentDiv_common").show();
$("#environmentDiv_docker").hide();
$("#projectTypesDiv").hide();
if("NODE" == platform){
$("#environmentDiv").hide();
$("#environmentNodeDiv").show();
}else{
$("#environmentDiv").show();
$("#environmentNodeDiv").hide();
}
}
$("#projects_div").empty();
$.ajax({
url: getProjectUrl,
type: 'POST',
success: function (data) {
var project_HTML = "";
var checkType='checkbox';
var checkTypeCss='ckbox ckbox-primary';
if("NODE" == platform){
checkType='radio';
checkTypeCss='rdio rdio-default';
}
if(data==null){
return ;
}
for (var i = 0; i < data.length; i++) {
if (i % 4 == 0) {
project_HTML += "</br>";
}
project_HTML += "<div class='"+checkTypeCss+"' style='display: inline'>";
project_HTML += " <input name='project' type='"+checkType+"' id='" + data[i].name + "' value='" + data[i].name +"' ";
if("NODE" == platform){
project_HTML += " onclick = loadNodeEnv('"+data[i].name+"') ";
}
project_HTML += "/>";
project_HTML += "<div class='ckbox ckbox-primary' style='display: inline'>";
project_HTML += " <input name='project' type='checkbox' id='" + data[i].name + "' value='" + data[i].name + "'/>";
project_HTML += "<label for='" + data[i].name + "' style='width: 200px'>" + data[i].name + "</label></div>";
}
document.getElementById("projects_div").innerHTML = project_HTML;
},
error: function (e) {
... ... @@ -356,46 +320,6 @@
testPlatform();
}
//加载环境
function loadNodeEnv(projName){
$("#environmentDiv_node").html("");
$.ajax({
url: contextPath+'workSystem/getNodeEnvByProject?name=' + projName,
type: 'POST',
dataType: 'json',
success: function (data) {
$("#environmentDiv_node").empty();
if ("failed" == data) {
return;
}
var pythonProject = eval("(" + data + ")");
//动态生成环境的组件
var list = pythonProject.envs;
var node_env_HTML = "";
for(var i = 0; i < list.length; i++){
var env = list[i];
if (i % 4 == 0) {
node_env_HTML += "</br>";
}
var show_label=env.name;
if(env.name=='az2'){
show_label=env.name+'(灰度)';
}
node_env_HTML += "<div class='ckbox ckbox-primary' style='display: inline'>";
node_env_HTML += " <input name='environment' type='checkbox' id='node_env_" + env.name + "' value='" + env.name +"' ";
node_env_HTML += "/>";
node_env_HTML += "<label for='node_env_" + env.name + "' style='width: 200px'>" + show_label + "</label></div>";
}
$("#environmentDiv_node").append(node_env_HTML);
},
error: function (e) {
alert("获取项目环境失败");
}
});
}
function testPlatform(){
document.getElementById("test_div").innerHTML = "";
var platform = $('input:radio[name=platform]:checked').val();
... ...