From c5838f1287c3bd26753b3e2c6e3627e4d507651e Mon Sep 17 00:00:00 2001 From: vapao Date: Mon, 20 Sep 2021 01:58:22 +0800 Subject: [PATCH] fix issues --- spug_web/src/pages/exec/task/ExecConsole.js | 25 ++++++++++++++----- .../src/pages/exec/task/index.module.less | 15 +++++++++-- 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/spug_web/src/pages/exec/task/ExecConsole.js b/spug_web/src/pages/exec/task/ExecConsole.js index 362ed1af..1a2270dc 100644 --- a/spug_web/src/pages/exec/task/ExecConsole.js +++ b/spug_web/src/pages/exec/task/ExecConsole.js @@ -24,6 +24,7 @@ import store from './store'; class ExecConsole extends React.Component { constructor(props) { super(props); + this.lastOutputs = {}; this.socket = null; this.terms = {}; this.outputs = {}; @@ -49,6 +50,7 @@ class ExecConsole extends React.Component { const {key, data, status} = JSON.parse(e.data); if (status !== undefined) store.outputs[key].status = status; if (data) { + if (data.replace(/\r\n/g, '')) this.lastOutputs[key] = data.trim() this.handleWrite(key, data) } } @@ -80,16 +82,24 @@ class ExecConsole extends React.Component { } } - genExtra = (status) => { + genExtra = (status, key) => { if (status === -2) { return ; } else if (status === 0) { - return + return ( +
+
{this.lastOutputs[key]}
+ +
+ ) } else { return ( - - - +
+
{this.lastOutputs[key]}
+ + + +
) } }; @@ -124,7 +134,10 @@ class ExecConsole extends React.Component { onChange={key => this.handleUpdate({activeKey: key})} expandIcon={({isActive}) => }> {Object.entries(store.outputs).map(([key, item], index) => ( - {item['title']}} extra={this.genExtra(item.status)}> + {item['title']}} + extra={this.genExtra(item.status, key)}> this.outputs[key]} diff --git a/spug_web/src/pages/exec/task/index.module.less b/spug_web/src/pages/exec/task/index.module.less index 5fb30abe..10302332 100644 --- a/spug_web/src/pages/exec/task/index.module.less +++ b/spug_web/src/pages/exec/task/index.module.less @@ -20,12 +20,23 @@ color: #000; } -.header { +.header1 { + display: inline-block; overflow: hidden; text-overflow: ellipsis; + white-space: nowrap; max-width: 400px; + font-weight: bold; + margin: 0; +} + +.header2 { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + max-width: 450px; padding-right: 20px; - margin: 0 + margin: 0; } pre {