...
|
...
|
@@ -24,7 +24,7 @@ const p = { |
|
|
/**
|
|
|
* 所有项目首页
|
|
|
*/
|
|
|
index_page: async(ctx, next) => {
|
|
|
index_page: async (ctx, next) => {
|
|
|
let projects = await Project.findAll();
|
|
|
projects.forEach((p, i) => {
|
|
|
p.color = colors[i % colors.length];
|
...
|
...
|
@@ -36,7 +36,7 @@ const p = { |
|
|
/**
|
|
|
* 单个项目首页
|
|
|
*/
|
|
|
project_index: async(ctx, next) => {
|
|
|
project_index: async (ctx, next) => {
|
|
|
let id = ctx.params.id;
|
|
|
let env = ctx.request.query.env;
|
|
|
let project = await Project.findById(id);
|
...
|
...
|
@@ -45,9 +45,9 @@ const p = { |
|
|
deploy.name = envs[env];
|
|
|
|
|
|
|
|
|
let promises = deploy.target.map( (host) => {
|
|
|
let promises = deploy.target.map((host) => {
|
|
|
console.log('read host :' + host);
|
|
|
return await DeployInfo.findOne({
|
|
|
return DeployInfo.findOne({
|
|
|
projectId: project._id,
|
|
|
host: host,
|
|
|
env: env
|
...
|
...
|
@@ -69,7 +69,7 @@ const p = { |
|
|
});
|
|
|
},
|
|
|
|
|
|
new_page: async(ctx, next) => {
|
|
|
new_page: async (ctx, next) => {
|
|
|
let serversAll = await Server.findAll();
|
|
|
let servers = {};
|
|
|
serversAll.forEach(s => {
|
...
|
...
|
@@ -89,7 +89,7 @@ const p = { |
|
|
}
|
|
|
});
|
|
|
},
|
|
|
edit_page: async(ctx, next) => {
|
|
|
edit_page: async (ctx, next) => {
|
|
|
let id = ctx.query.id;
|
|
|
let project = await Project.findById(id);
|
|
|
|
...
|
...
|
@@ -111,7 +111,7 @@ const p = { |
|
|
servers: servers
|
|
|
});
|
|
|
},
|
|
|
save: async(ctx, next) => {
|
|
|
save: async (ctx, next) => {
|
|
|
let project = ctx.request.body;
|
|
|
let id = project._id;
|
|
|
delete project._id;
|
...
|
...
|
@@ -127,7 +127,7 @@ const p = { |
|
|
ctx.redirect('/projects');
|
|
|
ctx.status = 301;
|
|
|
},
|
|
|
buildings_table: async(ctx, next) => {
|
|
|
buildings_table: async (ctx, next) => {
|
|
|
let env = ctx.request.query.env;
|
|
|
let pid = ctx.params.id;
|
|
|
let buildings = await Building.cfind({
|
...
|
...
|
@@ -143,7 +143,7 @@ const p = { |
|
|
data: buildings
|
|
|
};
|
|
|
},
|
|
|
project_build: async(ctx, next) => {
|
|
|
project_build: async (ctx, next) => {
|
|
|
let pid = ctx.params.pid;
|
|
|
let env = ctx.request.body.env;
|
|
|
let branch = ctx.request.body.branch;
|
...
|
...
|
@@ -175,7 +175,7 @@ const p = { |
|
|
};
|
|
|
await next();
|
|
|
},
|
|
|
project_deploy: async(ctx) => {
|
|
|
project_deploy: async (ctx) => {
|
|
|
let buildingId = ctx.params.building;
|
|
|
let building = await Building.findById(buildingId);
|
|
|
if (!building) {
|
...
|
...
|
@@ -187,7 +187,7 @@ const p = { |
|
|
let project = await Project.findByName(building.project);
|
|
|
let targets = project.deploy[building.env].target;
|
|
|
|
|
|
targets.forEach(async(host) => {
|
|
|
targets.forEach(async (host) => {
|
|
|
let info = {
|
|
|
projectId: project._id,
|
|
|
host: host,
|
...
|
...
|
|