Authored by 姜枫

fix bug

@@ -24,7 +24,7 @@ const p = { @@ -24,7 +24,7 @@ const p = {
24 /** 24 /**
25 * 所有项目首页 25 * 所有项目首页
26 */ 26 */
27 - index_page: async(ctx, next) => { 27 + index_page: async (ctx, next) => {
28 let projects = await Project.findAll(); 28 let projects = await Project.findAll();
29 projects.forEach((p, i) => { 29 projects.forEach((p, i) => {
30 p.color = colors[i % colors.length]; 30 p.color = colors[i % colors.length];
@@ -36,18 +36,18 @@ const p = { @@ -36,18 +36,18 @@ const p = {
36 /** 36 /**
37 * 单个项目首页 37 * 单个项目首页
38 */ 38 */
39 - project_index: async(ctx, next) => { 39 + project_index: async (ctx, next) => {
40 let id = ctx.params.id; 40 let id = ctx.params.id;
41 let env = ctx.request.query.env; 41 let env = ctx.request.query.env;
42 let project = await Project.findById(id); 42 let project = await Project.findById(id);
43 let deploy = project.deploy[env]; 43 let deploy = project.deploy[env];
44 deploy.env = env; 44 deploy.env = env;
45 deploy.name = envs[env]; 45 deploy.name = envs[env];
46 -  
47 46
48 - let promises = deploy.target.map( (host) => { 47 +
  48 + let promises = deploy.target.map((host) => {
49 console.log('read host :' + host); 49 console.log('read host :' + host);
50 - return await DeployInfo.findOne({ 50 + return DeployInfo.findOne({
51 projectId: project._id, 51 projectId: project._id,
52 host: host, 52 host: host,
53 env: env 53 env: env
@@ -69,7 +69,7 @@ const p = { @@ -69,7 +69,7 @@ const p = {
69 }); 69 });
70 }, 70 },
71 71
72 - new_page: async(ctx, next) => { 72 + new_page: async (ctx, next) => {
73 let serversAll = await Server.findAll(); 73 let serversAll = await Server.findAll();
74 let servers = {}; 74 let servers = {};
75 serversAll.forEach(s => { 75 serversAll.forEach(s => {
@@ -89,7 +89,7 @@ const p = { @@ -89,7 +89,7 @@ const p = {
89 } 89 }
90 }); 90 });
91 }, 91 },
92 - edit_page: async(ctx, next) => { 92 + edit_page: async (ctx, next) => {
93 let id = ctx.query.id; 93 let id = ctx.query.id;
94 let project = await Project.findById(id); 94 let project = await Project.findById(id);
95 95
@@ -111,7 +111,7 @@ const p = { @@ -111,7 +111,7 @@ const p = {
111 servers: servers 111 servers: servers
112 }); 112 });
113 }, 113 },
114 - save: async(ctx, next) => { 114 + save: async (ctx, next) => {
115 let project = ctx.request.body; 115 let project = ctx.request.body;
116 let id = project._id; 116 let id = project._id;
117 delete project._id; 117 delete project._id;
@@ -119,15 +119,15 @@ const p = { @@ -119,15 +119,15 @@ const p = {
119 await Project.update({ 119 await Project.update({
120 _id: id 120 _id: id
121 }, { 121 }, {
122 - $set: project  
123 - }); 122 + $set: project
  123 + });
124 } else { 124 } else {
125 await Project.insert(project); 125 await Project.insert(project);
126 } 126 }
127 ctx.redirect('/projects'); 127 ctx.redirect('/projects');
128 ctx.status = 301; 128 ctx.status = 301;
129 }, 129 },
130 - buildings_table: async(ctx, next) => { 130 + buildings_table: async (ctx, next) => {
131 let env = ctx.request.query.env; 131 let env = ctx.request.query.env;
132 let pid = ctx.params.id; 132 let pid = ctx.params.id;
133 let buildings = await Building.cfind({ 133 let buildings = await Building.cfind({
@@ -143,7 +143,7 @@ const p = { @@ -143,7 +143,7 @@ const p = {
143 data: buildings 143 data: buildings
144 }; 144 };
145 }, 145 },
146 - project_build: async(ctx, next) => { 146 + project_build: async (ctx, next) => {
147 let pid = ctx.params.pid; 147 let pid = ctx.params.pid;
148 let env = ctx.request.body.env; 148 let env = ctx.request.body.env;
149 let branch = ctx.request.body.branch; 149 let branch = ctx.request.body.branch;
@@ -175,7 +175,7 @@ const p = { @@ -175,7 +175,7 @@ const p = {
175 }; 175 };
176 await next(); 176 await next();
177 }, 177 },
178 - project_deploy: async(ctx) => { 178 + project_deploy: async (ctx) => {
179 let buildingId = ctx.params.building; 179 let buildingId = ctx.params.building;
180 let building = await Building.findById(buildingId); 180 let building = await Building.findById(buildingId);
181 if (!building) { 181 if (!building) {
@@ -187,7 +187,7 @@ const p = { @@ -187,7 +187,7 @@ const p = {
187 let project = await Project.findByName(building.project); 187 let project = await Project.findByName(building.project);
188 let targets = project.deploy[building.env].target; 188 let targets = project.deploy[building.env].target;
189 189
190 - targets.forEach(async(host) => { 190 + targets.forEach(async (host) => {
191 let info = { 191 let info = {
192 projectId: project._id, 192 projectId: project._id,
193 host: host, 193 host: host,