Authored by 姜枫

每次构建支持输入分支

... ... @@ -142,7 +142,7 @@ const p = {
project_build: async(ctx, next) => {
let pid = ctx.params.pid;
let env = ctx.request.body.env;
let branch = ctx.redirect.body.branch;
let branch = ctx.request.body.branch;
let p = await Project.findById(pid);
let build = new Build(p);
... ...
... ... @@ -118,13 +118,13 @@
html += data + '</span>';
return html;
},
targets: 1
targets: 2
}, {
render: function(data, type, row){
var disabled = row.state !== 'success';
return '<button '+(disabled? 'disabled' : '')+' class="btn btn-success btn-xs deploy-btn" data-id="'+data+'" data-build='+row.buildTime+'>分发</button>';
},
targets: 3
targets: 4
}]
});
... ... @@ -153,11 +153,18 @@
$('.build-btn').click(function(){
var env = $(this).parents('.panel').data('env');
$.post('/projects/build/{{project._id}}', {env: env}, function(ret){
if(ret.code == 200) {
tables[env].ajax.reload();
}
var i = layer.prompt({
title: '请输入需要构建的分支,默认为 {{deploy.branchName}}'
}, function(branch){
branch = branch || '{{deploy.branchName}}';
$.post('/projects/build/{{project._id}}', {env: env, branch: branch}, function(ret){
if(ret.code == 200) {
tables[env].ajax.reload();
layer.close(i);
}
});
});
});
... ...