Authored by 姜枫

update default branch

@@ -25,11 +25,11 @@ class Build { @@ -25,11 +25,11 @@ class Build {
25 this.silent = true; 25 this.silent = true;
26 } 26 }
27 27
28 - build(env) { 28 + build(branch) {
29 if (typeof config.buildDir === 'undefined') { 29 if (typeof config.buildDir === 'undefined') {
30 throw new Error('please config the buildDir'); 30 throw new Error('please config the buildDir');
31 } 31 }
32 - this.branch = this.project.deploy[env].branchName; 32 + this.branch = branch;
33 let buildTime = moment().format('YYYYMMDDHHmmss') 33 let buildTime = moment().format('YYYYMMDDHHmmss')
34 this.buildTime = buildTime; 34 this.buildTime = buildTime;
35 35
@@ -142,17 +142,19 @@ const p = { @@ -142,17 +142,19 @@ const p = {
142 project_build: async(ctx, next) => { 142 project_build: async(ctx, next) => {
143 let pid = ctx.params.pid; 143 let pid = ctx.params.pid;
144 let env = ctx.request.body.env; 144 let env = ctx.request.body.env;
  145 + let branch = ctx.redirect.body.branch;
145 let p = await Project.findById(pid); 146 let p = await Project.findById(pid);
146 let build = new Build(p); 147 let build = new Build(p);
147 148
148 let { 149 let {
149 buildTime, 150 buildTime,
150 distFile 151 distFile
151 - } = build.build(env); 152 + } = build.build(branch);
152 let buildingDoc = await Building.insert({ 153 let buildingDoc = await Building.insert({
153 buildTime: buildTime, 154 buildTime: buildTime,
154 project: p.name, 155 project: p.name,
155 projectId: pid, 156 projectId: pid,
  157 + branch: branch,
156 env: env, 158 env: env,
157 distFile: distFile, 159 distFile: distFile,
158 state: 'waiting', 160 state: 'waiting',
@@ -32,6 +32,7 @@ @@ -32,6 +32,7 @@
32 <thead> 32 <thead>
33 <tr> 33 <tr>
34 <th>构建版本</th> 34 <th>构建版本</th>
  35 + <th>分支名称</th>
35 <th>状态</th> 36 <th>状态</th>
36 <th>构建时间</th> 37 <th>构建时间</th>
37 <th>操作</th> 38 <th>操作</th>
@@ -96,6 +97,7 @@ @@ -96,6 +97,7 @@
96 ajax: '/projects/{{project._id}}/buildings?env=' + env, 97 ajax: '/projects/{{project._id}}/buildings?env=' + env,
97 columns: [ 98 columns: [
98 { data: "buildTime"}, 99 { data: "buildTime"},
  100 + { data: "branch"},
99 { data: "state"}, 101 { data: "state"},
100 { data: "updatedAt"}, 102 { data: "updatedAt"},
101 { data: "_id" } 103 { data: "_id" }
@@ -33,11 +33,11 @@ @@ -33,11 +33,11 @@
33 <div class="clearfix mt20"> 33 <div class="clearfix mt20">
34 <div class="col-xs-6 project-env" data-id="{{_id}}" data-env="production"> 34 <div class="col-xs-6 project-env" data-id="{{_id}}" data-env="production">
35 <h5 class="md-title nomargin">线上环境</h5> 35 <h5 class="md-title nomargin">线上环境</h5>
36 - <h4 class="nomargin">23</h4> 36 + <h4 class="nomargin">{{deploy.production.target.length}}</h4>
37 </div> 37 </div>
38 <div class="col-xs-6 project-env" data-id="{{_id}}" data-env="test"> 38 <div class="col-xs-6 project-env" data-id="{{_id}}" data-env="test">
39 <h5 class="md-title nomargin">测试环境</h5> 39 <h5 class="md-title nomargin">测试环境</h5>
40 - <h4 class="nomargin">60</h4> 40 + <h4 class="nomargin">{{deploy.test.target.length}}</h4>
41 </div> 41 </div>
42 </div> 42 </div>
43 </div><!-- panel-body --> 43 </div><!-- panel-body -->