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