[ARVADOS-WORKBENCH2] created: 1.4.1-288-gdb5a3f09
Git user
git at public.arvados.org
Thu Feb 27 15:03:18 UTC 2020
at db5a3f09820e8d41aeef7000d95b0ea67507c5a3 (commit)
commit db5a3f09820e8d41aeef7000d95b0ea67507c5a3
Author: Peter Amstutz <peter.amstutz at curii.com>
Date: Thu Feb 27 10:02:32 2020 -0500
16181: Support SSHHelpHostSuffix, fix user VM page render issues
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>
diff --git a/src/common/config.ts b/src/common/config.ts
index 58fa13ae..0a13f4e1 100644
--- a/src/common/config.ts
+++ b/src/common/config.ts
@@ -53,6 +53,7 @@ export interface ClusterConfigJSON {
WelcomePageHTML: string;
InactivePageHTML: string;
SSHHelpPageHTML: string;
+ SSHHelpHostSuffix: string;
SiteName: string;
};
Login: {
@@ -122,7 +123,7 @@ export const fetchConfig = () => {
return Axios.get<ClusterConfigJSON>(getClusterConfigURL(workbenchConfig.API_HOST)).then(async response => {
const clusterConfigJSON = response.data;
const apiRevision = await getApiRevision(clusterConfigJSON.Services.Controller.ExternalURL);
- const config = {...buildConfig(clusterConfigJSON), apiRevision};
+ const config = { ...buildConfig(clusterConfigJSON), apiRevision };
const warnLocalConfig = (varName: string) => console.warn(
`A value for ${varName} was found in ${WORKBENCH_CONFIG_URL}. To use the Arvados centralized configuration instead, \
remove the entire ${varName} entry from ${WORKBENCH_CONFIG_URL}`);
@@ -181,6 +182,7 @@ export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): Clust
WelcomePageHTML: "",
InactivePageHTML: "",
SSHHelpPageHTML: "",
+ SSHHelpHostSuffix: "",
SiteName: "",
},
Login: {
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 a641ec63..5e131861 100644
--- a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
+++ b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
@@ -12,6 +12,7 @@ import { saveRequestedDate, loadVirtualMachinesUserData } from '~/store/virtual-
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';
@@ -59,6 +60,7 @@ const mapStateToProps = (state: RootState) => {
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.WebShell.ExternalURL,
...state.virtualMachines
};
@@ -75,6 +77,7 @@ interface VirtualMachinesPanelDataProps {
userUuid: string;
links: ListResults<any>;
helpText: string;
+ hostSuffix: string;
webShell: string;
}
@@ -166,25 +169,30 @@ const virtualMachinesTable = (props: VirtualMachineProps) =>
</TableRow>
</TableHead>
<TableBody>
- {props.virtualMachines.items.map((it, index) =>
- <TableRow key={index}>
- <TableCell>{it.hostname}</TableCell>
- <TableCell>{getUsername(props.links, props.userUuid)}</TableCell>
- <TableCell>ssh {getUsername(props.links, props.userUuid)}@{it.hostname}</TableCell>
- {props.webShell !== "" && <TableCell>
- <a href={`${props.webShell}${it.href}/webshell/${getUsername(props.links, props.userUuid)}`} target="_blank" className={props.classes.link}>
- Log in as {getUsername(props.links, props.userUuid)}
- </a>
- </TableCell>}
- </TableRow>
- )}
+ {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 <TableRow key={lk.uuid}>
+ <TableCell>{it.hostname}</TableCell>
+ <TableCell>{username}</TableCell>
+ <TableCell>
+ {command}
+ </TableCell>
+ {props.webShell !== "" && <TableCell>
+ <a href={`${props.webShell}${it.href}/webshell/${username}`} target="_blank" className={props.classes.link}>
+ Log in as {username}
+ </a>
+ </TableCell>}
+ </TableRow>;
+ }
+ return;
+ }
+ ))}
</TableBody>
</Table>;
-const getUsername = (links: ListResults<any>, userUuid: string) => {
- return links.items.map(it => it.tailUuid === userUuid ? it.properties.username : '');
-};
-
const CardSSHSection = (props: VirtualMachineProps) =>
<Grid item xs={12}>
<Card>
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list