mirror of https://github.com/openspug/spug
upgrade deploy rollback
parent
1f0144fea3
commit
11bf8d1f7d
|
@ -236,6 +236,7 @@ def post_request_1(request):
|
||||||
Argument('name', help='请输申请标题'),
|
Argument('name', help='请输申请标题'),
|
||||||
Argument('repository_id', type=int, help='请选择发布版本'),
|
Argument('repository_id', type=int, help='请选择发布版本'),
|
||||||
Argument('host_ids', type=list, filter=lambda x: len(x), help='请选择要部署的主机'),
|
Argument('host_ids', type=list, filter=lambda x: len(x), help='请选择要部署的主机'),
|
||||||
|
Argument('type', default='1'),
|
||||||
Argument('desc', required=False),
|
Argument('desc', required=False),
|
||||||
).parse(request.body)
|
).parse(request.body)
|
||||||
if error is None:
|
if error is None:
|
||||||
|
|
|
@ -36,6 +36,7 @@ export default observer(function () {
|
||||||
const formData = form.getFieldsValue();
|
const formData = form.getFieldsValue();
|
||||||
formData['id'] = store.record.id;
|
formData['id'] = store.record.id;
|
||||||
formData['host_ids'] = host_ids;
|
formData['host_ids'] = host_ids;
|
||||||
|
formData['type'] = store.record.type;
|
||||||
formData['deploy_id'] = store.record.deploy_id;
|
formData['deploy_id'] = store.record.deploy_id;
|
||||||
http.post('/api/deploy/request/1/', formData)
|
http.post('/api/deploy/request/1/', formData)
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
@ -45,6 +46,7 @@ export default observer(function () {
|
||||||
}, () => setLoading(false))
|
}, () => setLoading(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const {app_host_ids, type, rb_id,} = store.record;
|
||||||
return (
|
return (
|
||||||
<Modal
|
<Modal
|
||||||
visible
|
visible
|
||||||
|
@ -58,12 +60,10 @@ export default observer(function () {
|
||||||
<Form.Item required name="name" label="申请标题">
|
<Form.Item required name="name" label="申请标题">
|
||||||
<Input placeholder="请输入申请标题"/>
|
<Input placeholder="请输入申请标题"/>
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
<Form.Item required name="repository_id" label="发布版本">
|
<Form.Item required name="repository_id" label={type === '2' ? '回滚版本' : '发布版本'}>
|
||||||
<Select placeholder="请选择">
|
<Select placeholder="请选择">
|
||||||
{versions.map(item => (
|
{versions.map(item => (
|
||||||
<Select.Option
|
<Select.Option key={item.id} value={item.id} disabled={type === '2' && item.id >= rb_id}>
|
||||||
key={item.id}
|
|
||||||
value={item.id}>
|
|
||||||
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||||
<span>{item.remarks ? `${item.version} (${item.remarks})` : item.version}</span>
|
<span>{item.remarks ? `${item.version} (${item.remarks})` : 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>
|
||||||
|
@ -82,7 +82,7 @@ export default observer(function () {
|
||||||
</Form>
|
</Form>
|
||||||
{visible && <HostSelector
|
{visible && <HostSelector
|
||||||
host_ids={host_ids}
|
host_ids={host_ids}
|
||||||
app_host_ids={store.record.app_host_ids}
|
app_host_ids={app_host_ids}
|
||||||
onCancel={() => setVisible(false)}
|
onCancel={() => setVisible(false)}
|
||||||
onOk={ids => setHostIds(ids)}/>}
|
onOk={ids => setHostIds(ids)}/>}
|
||||||
</Modal>
|
</Modal>
|
||||||
|
|
|
@ -92,7 +92,7 @@ function ComTable() {
|
||||||
<Action.Button
|
<Action.Button
|
||||||
auth="deploy.request.do"
|
auth="deploy.request.do"
|
||||||
disabled={info.type === '2'}
|
disabled={info.type === '2'}
|
||||||
onClick={() => handleRollback(info)}>回滚</Action.Button>
|
onClick={() => store.rollback(info)}>回滚</Action.Button>
|
||||||
</Action>;
|
</Action>;
|
||||||
case '3':
|
case '3':
|
||||||
return <Action>
|
return <Action>
|
||||||
|
@ -102,7 +102,7 @@ function ComTable() {
|
||||||
<Action.Button
|
<Action.Button
|
||||||
auth="deploy.request.do"
|
auth="deploy.request.do"
|
||||||
disabled={info.type === '2'}
|
disabled={info.type === '2'}
|
||||||
onClick={() => handleRollback(info)}>回滚</Action.Button>
|
onClick={() => store.rollback(info)}>回滚</Action.Button>
|
||||||
</Action>;
|
</Action>;
|
||||||
case '-1':
|
case '-1':
|
||||||
return <Action>
|
return <Action>
|
||||||
|
|
|
@ -19,7 +19,6 @@ class Store {
|
||||||
@observable ext1Visible = false;
|
@observable ext1Visible = false;
|
||||||
@observable ext2Visible = false;
|
@observable ext2Visible = false;
|
||||||
@observable approveVisible = false;
|
@observable approveVisible = false;
|
||||||
@observable rbVisible = false;
|
|
||||||
|
|
||||||
@observable f_status = 'all';
|
@observable f_status = 'all';
|
||||||
@observable f_app_id;
|
@observable f_app_id;
|
||||||
|
@ -93,6 +92,18 @@ class Store {
|
||||||
this.addVisible = false
|
this.addVisible = false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
rollback = (info) => {
|
||||||
|
this.record = lds.pick(info, ['deploy_id', 'app_host_ids', 'host_ids']);
|
||||||
|
this.record.type = '2';
|
||||||
|
this.record.rb_id = info.repository_id;
|
||||||
|
this.record.name = `${info.name} - 回滚`;
|
||||||
|
if (info.app_extend === '1') {
|
||||||
|
this.ext1Visible = true
|
||||||
|
} else {
|
||||||
|
this.ext2Visible = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showForm = (info) => {
|
showForm = (info) => {
|
||||||
this.record = info;
|
this.record = info;
|
||||||
if (info['app_extend'] === '1') {
|
if (info['app_extend'] === '1') {
|
||||||
|
|
Loading…
Reference in New Issue