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