fix issue

pull/330/head
vapao 2021-04-26 18:23:50 +08:00
parent 19f5ba5cfb
commit d428933b8f
2 changed files with 29 additions and 22 deletions

View File

@ -130,6 +130,8 @@ class RequestDetailView(View):
outputs['local'] = {'id': 'local', 'data': [f'{human_time()} 读取数据... ']}
response['s_actions'] = json.loads(req.deploy.extend_obj.server_actions)
response['h_actions'] = json.loads(req.deploy.extend_obj.host_actions)
if not response['h_actions']:
response['outputs'] = {'local': outputs['local']}
rds, key, counter = get_redis_connection(), f'{settings.REQUEST_KEY}:{r_id}', 0
data = rds.lrange(key, counter, counter + 9)
while data:
@ -169,6 +171,8 @@ class RequestDetailView(View):
outputs['local'] = {'id': 'local', 'step': 0, 'data': [message]}
s_actions = json.loads(req.deploy.extend_obj.server_actions)
h_actions = json.loads(req.deploy.extend_obj.host_actions)
if not h_actions:
outputs = {'local': outputs['local']}
return json_response({'s_actions': s_actions, 'h_actions': h_actions, 'outputs': outputs})
return json_response({'outputs': outputs})

View File

@ -80,6 +80,7 @@ function Ext2Console(props) {
store.tabModes[props.request.id] = !value
}
const hostOutputs = Object.values(outputs).filter(x => x.id !== 'local');
return store.tabModes[props.request.id] ? (
<Card
className={styles.item}
@ -127,28 +128,30 @@ function Ext2Console(props) {
<OutView records={outputs.local.data}/>
</Collapse.Panel>
</Collapse>
<Collapse
defaultActiveKey="0"
className={styles.collapse}
style={{marginTop: 24}}
expandIcon={({isActive}) => <CaretRightOutlined style={{fontSize: 16}} rotate={isActive ? 90 : 0}/>}>
{Object.values(outputs).filter(x => x.id !== 'local').map((item, index) => (
<Collapse.Panel
key={index}
header={
<div className={styles.header}>
<b className={styles.title}>{item.title}</b>
<Steps size="small" className={styles.step} current={item.step} status={item.status}>
<StepItem title="等待调度" item={item} step={0}/>
{hActions.map((action, index) => (
<StepItem key={index} title={action.title} item={item} step={index + 1}/>
))}
</Steps>
</div>}>
<OutView records={item.data}/>
</Collapse.Panel>
))}
</Collapse>
{hostOutputs.length > 0 && (
<Collapse
defaultActiveKey="0"
className={styles.collapse}
style={{marginTop: 24}}
expandIcon={({isActive}) => <CaretRightOutlined style={{fontSize: 16}} rotate={isActive ? 90 : 0}/>}>
{hostOutputs.map((item, index) => (
<Collapse.Panel
key={index}
header={
<div className={styles.header}>
<b className={styles.title}>{item.title}</b>
<Steps size="small" className={styles.step} current={item.step} status={item.status}>
<StepItem title="等待调度" item={item} step={0}/>
{hActions.map((action, index) => (
<StepItem key={index} title={action.title} item={item} step={index + 1}/>
))}
</Steps>
</div>}>
<OutView records={item.data}/>
</Collapse.Panel>
))}
</Collapse>
)}
</Modal>
)
}