Commit 0105d1b7 authored by tywldx's avatar tywldx

fix

parent 15b73732
...@@ -277,9 +277,9 @@ process.argv.forEach(function(val, index, array) { ...@@ -277,9 +277,9 @@ process.argv.forEach(function(val, index, array) {
function getListAttr(projects, attr) { function getListAttr(projects, attr) {
var list = []; var list = [];
for (var i = 0; i < projects.length; i++) { for (var i = 0; i < projects.length; i++) {
if (projects[i].is_active) { // if (projects[i].is_active) {
list.push(projects[i][attr]) list.push(projects[i][attr])
} // }
} }
return list.join(" "); return list.join(" ");
} }
...@@ -326,13 +326,13 @@ configFunction.prototype = { ...@@ -326,13 +326,13 @@ configFunction.prototype = {
} }
}else{ }else{
for (var i = 0; i < projects.length; i++) { for (var i = 0; i < projects.length; i++) {
if (projects[i].is_active){ // if (projects[i].is_active){
var li = [projects[i]["name"]]; var li = [projects[i]["name"]];
for (var j = 0; j < attrs.length; j++) { for (var j = 0; j < attrs.length; j++) {
li.push(projects[i][attrs[j]]); li.push(projects[i][attrs[j]]);
} }
list.push(li.join("|")); list.push(li.join("|"));
} // }
} }
} }
return list.join(" "); return list.join(" ");
......
...@@ -102,7 +102,6 @@ admin.get('/get_project_attr/:name', function (req, res) { ...@@ -102,7 +102,6 @@ admin.get('/get_project_attr/:name', function (req, res) {
// 获取所有域名 // 获取所有域名
admin.get('/get_hosts', function (req, res) { admin.get('/get_hosts', function (req, res) {
res.setHeader("Content-Type","application/json"); res.setHeader("Content-Type","application/json");
var comstr = attrComsArr.join("/");
var str = execSync(`node ./get_project_config.js -type hosts`) var str = execSync(`node ./get_project_config.js -type hosts`)
var items = String(str); var items = String(str);
res.send(items); res.send(items);
...@@ -111,16 +110,15 @@ admin.get('/get_hosts', function (req, res) { ...@@ -111,16 +110,15 @@ admin.get('/get_hosts', function (req, res) {
// 根据类型获取系统名称 // 根据类型获取系统名称
admin.get('/get_systems_by_type', function (req, res) { admin.get('/get_systems_by_type', function (req, res) {
res.setHeader("Content-Type","application/json"); res.setHeader("Content-Type","application/json");
var comstr = attrComsArr.join("/");
var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`) var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`)
ui_str = String(ui_str) ui_str = String(ui_str)
.replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui") .replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui")
.replace(/paycenter-ui/g,"").replace(/new-paycenter-ui/,"paycenter-ui--new-paycenter-ui") .replace(/new-paycenter-ui/g,"").replace(/paycenter-ui/,"paycenter-ui--new-paycenter-ui")
.replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1); .replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1);
var java_str = execSync(`node ./get_project_config.js -type java -attr name`) var java_str = execSync(`node ./get_project_config.js -type java -attr name`)
var node_str = execSync(`node ./get_project_config.js -type node -attr name`) var node_str = execSync(`node ./get_project_config.js -type node -attr name`)
var python_str = execSync(`node ./get_project_config.js -type python -attr name`) var python_str = execSync(`node ./get_project_config.js -type python -attr name`)
var server_str = `${String(java_str)}${String(node_str)}${String(python_str)}` var server_str = `${String(java_str)} ${String(node_str)} ${String(python_str)}`
server_str = server_str.replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1);; server_str = server_str.replace(/\s+/g,",").replace(/\n/g,"").slice(0, -1);;
res.send({ res.send({
frontend:ui_str, frontend:ui_str,
...@@ -128,19 +126,21 @@ admin.get('/get_systems_by_type', function (req, res) { ...@@ -128,19 +126,21 @@ admin.get('/get_systems_by_type', function (req, res) {
}); });
}); });
// 给jenkins使用根据类型获取系统名称 // 给jenkins使用根据类型获取系统名称
admin.get('/get_systems_by_type_for_jenkins', function (req, res) { admin.get('/get_systems_by_type_for_jenkins/:_type', function (req, res) {
res.setHeader("Content-Type","application/json"); let str = ""
var comstr = attrComsArr.join("/"); if(req.params._type === "frontend"){
var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`) var ui_str = execSync(`node ./get_project_config.js -type ui -attr name`)
ui_str = String(ui_str) str = String(ui_str)
.replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui") .replace(/xyqb-ui/g,"").replace(/xjd-ui/,"xyqb-ui--xjd-ui")
.replace(/paycenter-ui/g,"").replace(/new-paycenter-ui/,"paycenter-ui--new-paycenter-ui"); .replace(/new-paycenter-ui/g,"").replace(/paycenter-ui/,"paycenter-ui--new-paycenter-ui");
}else{
var java_str = execSync(`node ./get_project_config.js -type java -attr name`) var java_str = execSync(`node ./get_project_config.js -type java -attr name`)
var node_str = execSync(`node ./get_project_config.js -type node -attr name`) var node_str = execSync(`node ./get_project_config.js -type node -attr name`)
var python_str = execSync(`node ./get_project_config.js -type python -attr name`) var python_str = execSync(`node ./get_project_config.js -type python -attr name`)
var server_str = `${ui_str} ${String(java_str)}${String(node_str)}${String(python_str)}` str = `${String(java_str)} ${String(node_str)} ${String(python_str)}`
server_str = server_str.replace(/\n/g,"").slice(0, -1).replace(/\s+/g,"\n"); }
res.send(server_str); str = str.replace(/\n/g,"").replace(/\s+/g,"\n");
res.send(str);
}); });
// 增加一个新的nginx映射 // 增加一个新的nginx映射
admin.post('/add_new_proxy', function (req, res) { admin.post('/add_new_proxy', function (req, res) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment