From 9c7e77f50601e4eb863f1b87336404ff333fd6b2 Mon Sep 17 00:00:00 2001 From: vapao Date: Thu, 28 Oct 2021 10:16:09 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E6=89=B9=E9=87=8F=E6=89=A7=E8=A1=8C?= =?UTF-8?q?=E7=AA=97=E5=8F=A3=E5=A2=9E=E5=8A=A0=E7=9B=B4=E6=8E=A5=E6=89=93?= =?UTF-8?q?=E5=BC=80web=E7=BB=88=E7=AB=AF=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/deploy/request/Ext1Console.js | 7 +-- .../src/pages/deploy/request/Ext2Console.js | 5 +- spug_web/src/pages/exec/task/ExecConsole.js | 57 ++++++++++--------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/spug_web/src/pages/deploy/request/Ext1Console.js b/spug_web/src/pages/deploy/request/Ext1Console.js index 94007a4..b8473d1 100644 --- a/spug_web/src/pages/deploy/request/Ext1Console.js +++ b/spug_web/src/pages/deploy/request/Ext1Console.js @@ -6,7 +6,7 @@ import React, { useEffect, useState } from 'react'; import { observer, useLocalStore } from 'mobx-react'; import { Card, Progress, Modal, Collapse, Steps, Skeleton } from 'antd'; -import { ShrinkOutlined, CaretRightOutlined, LoadingOutlined, CloseOutlined, CodeOutlined } from '@ant-design/icons'; +import { ShrinkOutlined, LoadingOutlined, CloseOutlined, CodeOutlined } from '@ant-design/icons'; import OutView from './OutView'; import { http, X_TOKEN } from 'libs'; import styles from './index.module.less'; @@ -161,10 +161,7 @@ function Ext1Console(props) { )} - }> + {Object.entries(hosts).map(([key, item], index) => ( 0 ? 24 : 0}} - expandIcon={({isActive}) => }> + style={{marginTop: sActions.length > 0 ? 24 : 0}}> {hostOutputs.map((item, index) => ( { - if (status === -2) { - return ; - } else if (status === 0) { - return ( -
-
{this.lastOutputs[key]}
- -
- ) - } else { - return ( -
-
{this.lastOutputs[key]}
- - - -
- ) - } - }; + StatusExtra = (props) => ( +
+ {props.status === -2 ? ( + + ) : ( + <> +
{this.lastOutputs[props.id]}
+ {props.status === 0 ? ( + + ) : ( + + + + )} + + )} + this.openTerminal(e, props.id)}/> +
+ ) handleUpdate = (data) => { this.setState(data, () => { @@ -111,6 +110,11 @@ class ExecConsole extends React.Component { }) } + openTerminal = (e, key) => { + e.stopPropagation() + window.open(`/ssh?id=${key}`) + } + render() { const {isFullscreen, activeKey} = this.state; return ( @@ -131,13 +135,12 @@ class ExecConsole extends React.Component { accordion className={styles.collapse} activeKey={activeKey} - onChange={key => this.handleUpdate({activeKey: key})} - expandIcon={({isActive}) => }> + onChange={key => this.handleUpdate({activeKey: key})}> {Object.entries(store.outputs).map(([key, item], index) => ( {item['title']}} - extra={this.genExtra(item.status, key)}> + header={
{item.title}
} + extra={}> this.outputs[key]}