X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/a3d23b09663e49a187f3505f1dd41c97f3d79d51..3c7e3cdc547ad5468421e1c049daa94b0d4b8bc0:/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx diff --git a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx index 291041b3..b5f7d5f5 100644 --- a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx +++ b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx @@ -2,19 +2,17 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { connect } from 'react-redux'; import { Grid, Typography, Button, Card, CardContent, TableBody, TableCell, TableHead, TableRow, Table, Tooltip } from '@material-ui/core'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles'; -import { ArvadosTheme } from '~/common/custom-theme'; -import { DefaultCodeSnippet } from '~/components/default-code-snippet/default-code-snippet'; -import { Link } from 'react-router-dom'; +import { ArvadosTheme } from 'common/custom-theme'; import { compose, Dispatch } from 'redux'; -import { saveRequestedDate, loadVirtualMachinesUserData } from '~/store/virtual-machines/virtual-machines-actions'; -import { RootState } from '~/store/store'; -import { ListResults } from '~/services/common-service/common-service'; -import { HelpIcon } from '~/components/icon/icon'; -import { Routes } from '~/routes/routes'; +import { saveRequestedDate, loadVirtualMachinesUserData } from 'store/virtual-machines/virtual-machines-actions'; +import { RootState } from 'store/store'; +import { ListResults } from 'services/common-service/common-service'; +import { HelpIcon } from 'components/icon/icon'; +// import * as CopyToClipboard from 'react-copy-to-clipboard'; type CssRules = 'button' | 'codeSnippet' | 'link' | 'linkIcon' | 'rightAlign' | 'cardWithoutMachines' | 'icon'; @@ -61,6 +59,9 @@ const mapStateToProps = (state: RootState) => { return { requestedDate: state.virtualMachines.date, userUuid: state.auth.user!.uuid, + helpText: state.auth.config.clusterConfig.Workbench.SSHHelpPageHTML, + hostSuffix: state.auth.config.clusterConfig.Workbench.SSHHelpHostSuffix || "", + webShell: state.auth.config.clusterConfig.Services.Workbench1.ExternalURL, ...state.virtualMachines }; }; @@ -75,6 +76,9 @@ interface VirtualMachinesPanelDataProps { virtualMachines: ListResults; userUuid: string; links: ListResults; + helpText: string; + hostSuffix: string; + webShell: string; } interface VirtualMachinesPanelActionProps { @@ -161,44 +165,41 @@ const virtualMachinesTable = (props: VirtualMachineProps) => Host name Login name Command line - Web shell + {props.webShell !== "" && Web shell} - {props.virtualMachines.items.map((it, index) => - - {it.hostname} - {getUsername(props.links, props.userUuid)} - ssh {getUsername(props.links, props.userUuid)}@{it.hostname}.arvados - - - Log in as {getUsername(props.links, props.userUuid)} - - - - )} + {props.virtualMachines.items.map(it => + props.links.items.map(lk => { + if (lk.tailUuid === props.userUuid) { + const username = lk.properties.username; + const command = `ssh ${username}@${it.hostname}${props.hostSuffix}`; + return + {it.hostname} + {username} + + {command} + + {props.webShell !== "" && + + Log in as {username} + + } + ; + } + return; + } + ))} ; -const getUsername = (links: ListResults, userUuid: string) => { - return links.items.map(it => it.tailUuid === userUuid ? it.properties.username : ''); -}; - const CardSSHSection = (props: VirtualMachineProps) => - - In order to access virtual machines using SSH, add an SSH key to your account and add a section like this to your SSH configuration file ( ~/.ssh/config): + +
- ; - -const textSSH = `Host *.arvados - TCPKeepAlive yes - ServerAliveInterval 60 - ProxyCommand ssh -p2222 turnout@switchyard.api.ardev.roche.com -x -a $SSH_PROXY_FLAGS %h`; \ No newline at end of file