From d428933b8f6cba99ab80707ea985bf616f5bc3fd Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 26 Apr 2021 18:23:50 +0800 Subject: [PATCH] fix issue --- spug_api/apps/deploy/views.py | 4 ++ .../src/pages/deploy/request/Ext2Console.js | 47 ++++++++++--------- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/spug_api/apps/deploy/views.py b/spug_api/apps/deploy/views.py index 6840580..14fcd40 100644 --- a/spug_api/apps/deploy/views.py +++ b/spug_api/apps/deploy/views.py @@ -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}) diff --git a/spug_web/src/pages/deploy/request/Ext2Console.js b/spug_web/src/pages/deploy/request/Ext2Console.js index 95914d3..aa9d527 100644 --- a/spug_web/src/pages/deploy/request/Ext2Console.js +++ b/spug_web/src/pages/deploy/request/Ext2Console.js @@ -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] ? ( - }> - {Object.values(outputs).filter(x => x.id !== 'local').map((item, index) => ( - - {item.title} - - - {hActions.map((action, index) => ( - - ))} - - }> - - - ))} - + {hostOutputs.length > 0 && ( + }> + {hostOutputs.map((item, index) => ( + + {item.title} + + + {hActions.map((action, index) => ( + + ))} + + }> + + + ))} + + )} ) }