mirror of https://github.com/openspug/spug
A web update
parent
e2055a27cb
commit
2f2e554916
|
@ -105,13 +105,10 @@ class RequestDetailView(View):
|
||||||
return json_response(error='为找到指定发布申请')
|
return json_response(error='为找到指定发布申请')
|
||||||
hosts = Host.objects.filter(id__in=json.loads(req.host_ids))
|
hosts = Host.objects.filter(id__in=json.loads(req.host_ids))
|
||||||
targets = [{'id': x.id, 'title': f'{x.name}({x.hostname}:{x.port})'} for x in hosts]
|
targets = [{'id': x.id, 'title': f'{x.name}({x.hostname}:{x.port})'} for x in hosts]
|
||||||
server_steps, host_steps = [], []
|
server_actions, host_actions = [], []
|
||||||
if req.app.extend == '2':
|
if req.app.extend == '2':
|
||||||
for item in json.loads(req.app.extend_obj.actions):
|
server_actions = json.loads(req.app.extend_obj.server_actions)
|
||||||
if item['target'] == 'server':
|
host_actions = json.loads(req.app.extend_obj.host_actions)
|
||||||
server_steps.append(item['name'])
|
|
||||||
else:
|
|
||||||
host_steps.append(item['name'])
|
|
||||||
return json_response({
|
return json_response({
|
||||||
'app_name': req.app.name,
|
'app_name': req.app.name,
|
||||||
'env_name': req.app.env.name,
|
'env_name': req.app.env.name,
|
||||||
|
@ -119,8 +116,8 @@ class RequestDetailView(View):
|
||||||
'type': req.type,
|
'type': req.type,
|
||||||
'status_alias': req.get_status_display(),
|
'status_alias': req.get_status_display(),
|
||||||
'targets': targets,
|
'targets': targets,
|
||||||
'server_steps': server_steps,
|
'server_actions': server_actions,
|
||||||
'host_steps': host_steps
|
'host_actions': host_actions
|
||||||
})
|
})
|
||||||
|
|
||||||
def post(self, request, r_id):
|
def post(self, request, r_id):
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { observer } from 'mobx-react';
|
import { observer } from 'mobx-react';
|
||||||
import { Steps, PageHeader, Spin, Tag, Button, Icon } from 'antd';
|
import { Steps, Collapse, PageHeader, Spin, Tag, Button, Icon } from 'antd';
|
||||||
import http from 'libs/http';
|
import http from 'libs/http';
|
||||||
import history from 'libs/history';
|
import history from 'libs/history';
|
||||||
import styles from './index.module.css';
|
import styles from './index.module.css';
|
||||||
|
@ -8,7 +8,7 @@ import store from './store';
|
||||||
import lds from 'lodash';
|
import lds from 'lodash';
|
||||||
|
|
||||||
@observer
|
@observer
|
||||||
class Ext2Index extends React.Component {
|
class Ext1Index extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -27,7 +27,7 @@ class Ext2Index extends React.Component {
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.socket) this.socket.close();
|
if (this.socket) this.socket.close();
|
||||||
store.request = {targets: []};
|
store.request = {targets: [], server_actions: [], host_actions: []};
|
||||||
store.outputs = {};
|
store.outputs = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ class Ext2Index extends React.Component {
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const {app_name, env_name, status} = store.request;
|
const {app_name, env_name, status, server_actions, host_actions} = store.request;
|
||||||
return (
|
return (
|
||||||
<Spin spinning={this.state.fetching}>
|
<Spin spinning={this.state.fetching}>
|
||||||
<PageHeader
|
<PageHeader
|
||||||
|
@ -95,16 +95,46 @@ class Ext2Index extends React.Component {
|
||||||
extra={<Button loading={this.state.loading} type="primary" disabled={!['1', '-3'].includes(status)}
|
extra={<Button loading={this.state.loading} type="primary" disabled={!['1', '-3'].includes(status)}
|
||||||
onClick={this.handleDeploy}>发布</Button>}
|
onClick={this.handleDeploy}>发布</Button>}
|
||||||
onBack={() => history.goBack()}/>
|
onBack={() => history.goBack()}/>
|
||||||
<div className={styles.ext2Block}>
|
<Collapse defaultActiveKey={1} className={styles.collapse}>
|
||||||
<Steps direction="vertical" className={styles.ext2Step}>
|
<Collapse.Panel showArrow={false} key={1} header={
|
||||||
|
<Steps style={{maxWidth: 400 + server_actions.length * 200}}>
|
||||||
<Steps.Step {...this.getStatus('local', 0)} title="建立连接"/>
|
<Steps.Step {...this.getStatus('local', 0)} title="建立连接"/>
|
||||||
<Steps.Step {...this.getStatus('local', 1)} title="发布准备"/>
|
<Steps.Step {...this.getStatus('local', 1)} title="发布准备"/>
|
||||||
|
{server_actions.map((item, index) => (
|
||||||
|
<Steps.Step {...this.getStatus('local', 2)} key={index} title={item.title}/>
|
||||||
|
))}
|
||||||
|
</Steps>}>
|
||||||
|
<pre className={styles.ext1Console}>{lds.get(store.outputs, 'local.data')}</pre>
|
||||||
|
</Collapse.Panel>
|
||||||
|
</Collapse>
|
||||||
|
|
||||||
|
{host_actions.length > 0 && (
|
||||||
|
<Collapse
|
||||||
|
defaultActiveKey={'0'}
|
||||||
|
className={styles.collapse}
|
||||||
|
expandIcon={({isActive}) => <Icon type="caret-right" style={{fontSize: 16}} rotate={isActive ? 90 : 0}/>}>
|
||||||
|
{store.request.targets.map((item, index) => (
|
||||||
|
<Collapse.Panel key={index} header={
|
||||||
|
<div style={{display: 'flex', justifyContent: 'space-between'}}>
|
||||||
|
<b>{item.title}</b>
|
||||||
|
<Steps size="small" style={{maxWidth: 150 + host_actions.length * 150}}>
|
||||||
|
<Steps.Step {...this.getStatus(item.id, 1)} title="数据准备"/>
|
||||||
|
{host_actions.map((item, index) => (
|
||||||
|
<Steps.Step {...this.getStatus(item.id, 2)} key={index} title={item.title}/>
|
||||||
|
))}
|
||||||
</Steps>
|
</Steps>
|
||||||
<pre className={styles.ext2Console}>{lds.get(store.outputs, 'local.data')}</pre>
|
</div>}>
|
||||||
</div>
|
<pre className={styles.ext1Console}>{lds.get(store.outputs, `${item.id}.data`)}</pre>
|
||||||
|
</Collapse.Panel>
|
||||||
|
))}
|
||||||
|
</Collapse>
|
||||||
|
)}
|
||||||
|
{host_actions.length === 0 && this.state.fetching === false && (
|
||||||
|
<div className={styles.ext2Tips}>无目标主机动作</div>
|
||||||
|
)}
|
||||||
</Spin>
|
</Spin>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default Ext2Index
|
export default Ext1Index
|
|
@ -39,6 +39,11 @@
|
||||||
height: 100px;
|
height: 100px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ext2Tips {
|
||||||
|
color: #888;
|
||||||
|
margin-top: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
pre {
|
pre {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
|
@ -4,6 +4,8 @@ class Store {
|
||||||
@observable outputs = {};
|
@observable outputs = {};
|
||||||
@observable request = {
|
@observable request = {
|
||||||
targets: [],
|
targets: [],
|
||||||
|
host_actions: [],
|
||||||
|
server_actions: []
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue