mirror of https://github.com/openspug/spug
创建发布申请时可以跨环境选择构建版本
parent
9141bc1b61
commit
7e6cba42a0
|
@ -18,13 +18,13 @@ import json
|
|||
class RepositoryView(View):
|
||||
@auth('deploy.repository.view|deploy.request.add|deploy.request.edit')
|
||||
def get(self, request):
|
||||
deploy_id = request.GET.get('deploy_id')
|
||||
app_id = request.GET.get('app_id')
|
||||
data = Repository.objects.annotate(
|
||||
app_name=F('app__name'),
|
||||
env_name=F('env__name'),
|
||||
created_by_user=F('created_by__nickname'))
|
||||
if deploy_id:
|
||||
data = data.filter(deploy_id=deploy_id, status='5')
|
||||
if app_id:
|
||||
data = data.filter(app_id=app_id, status='5')
|
||||
return json_response([x.to_view() for x in data])
|
||||
|
||||
response = dict()
|
||||
|
|
|
@ -49,9 +49,9 @@ export default observer(function () {
|
|||
|
||||
function fetchVersions() {
|
||||
setFetching(true);
|
||||
const deploy_id = store.record.deploy_id
|
||||
const {app_id, deploy_id} = store.record
|
||||
const p1 = http.get(`/api/app/deploy/${deploy_id}/versions/`, {timeout: 300000})
|
||||
const p2 = http.get('/api/repository/', {params: {deploy_id}})
|
||||
const p2 = http.get('/api/repository/', {params: {app_id}})
|
||||
Promise.all([p1, p2])
|
||||
.then(([res1, res2]) => {
|
||||
if (!versions.branches) _initial(res1, res2)
|
||||
|
@ -193,7 +193,7 @@ export default observer(function () {
|
|||
<Select.Option key={item.id} value={item.id} content={item.version}
|
||||
disabled={type === '2' && item.id >= rb_id}>
|
||||
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||
<span>{item.version}</span>
|
||||
<span>{item.env_name} - {item.version}</span>
|
||||
<span style={{color: '#999', fontSize: 12}}>构建于 {moment(item.created_at).fromNow()}</span>
|
||||
</div>
|
||||
</Select.Option>
|
||||
|
|
|
@ -97,8 +97,8 @@ class Store {
|
|||
};
|
||||
|
||||
confirmAdd = (deploy) => {
|
||||
const {id, host_ids, require_upload} = deploy;
|
||||
this.record = {deploy_id: id, app_host_ids: host_ids, require_upload};
|
||||
const {id, app_id, host_ids, require_upload} = deploy;
|
||||
this.record = {app_id, deploy_id: id, app_host_ids: host_ids, require_upload};
|
||||
if (deploy.extend === '1') {
|
||||
this.ext1Visible = true
|
||||
} else {
|
||||
|
@ -108,7 +108,7 @@ class Store {
|
|||
};
|
||||
|
||||
rollback = (info) => {
|
||||
this.record = lds.pick(info, ['deploy_id', 'host_ids', 'deploy_status']);
|
||||
this.record = lds.pick(info, ['app_id', 'deploy_id', 'host_ids', 'deploy_status']);
|
||||
this.record.app_host_ids = info.host_ids;
|
||||
this.record.name = `${info.name} - 回滚`;
|
||||
this.rollbackVisible = true
|
||||
|
|
Loading…
Reference in New Issue