},
});
-const mapStateToProps = ({ virtualMachines }: RootState) => {
+const mapStateToProps = (state: RootState) => {
return {
- logins: virtualMachines.logins,
- ...virtualMachines
+ logins: state.virtualMachines.logins,
+ userUuid: state.auth.user!.uuid,
+ ...state.virtualMachines
};
};
interface VirtualMachinesPanelDataProps {
virtualMachines: ListResults<any>;
logins: VirtualMachineLogins;
+ userUuid: string;
}
interface VirtualMachinesPanelActionProps {
<TableRow key={index}>
<TableCell>{it.uuid}</TableCell>
<TableCell>{it.hostname}</TableCell>
- <TableCell>["{props.logins.items[0].username}"]</TableCell>
+ <TableCell>["{props.logins.items.map(it => it.userUuid === props.userUuid ? it.username : '')}"]</TableCell>
<TableCell className={props.classes.moreOptions}>
<Tooltip title="More options" disableFocusListener>
<IconButton onClick={event => props.onOptionsMenuOpen(event, it)} className={props.classes.moreOptionsButton}>
}
});
-const mapStateToProps = ({ virtualMachines }: RootState) => {
+const mapStateToProps = (state: RootState) => {
return {
- requestedDate: virtualMachines.date,
- ...virtualMachines
+ requestedDate: state.virtualMachines.date,
+ userUuid: state.auth.user!.uuid,
+ ...state.virtualMachines
};
};
interface VirtualMachinesPanelDataProps {
requestedDate: string;
virtualMachines: ListResults<any>;
+ userUuid: string;
links: ListResults<any>;
}
{props.virtualMachines.items.map((it, index) =>
<TableRow key={index}>
<TableCell>{it.hostname}</TableCell>
- <TableCell>{getUsername(props.links)}</TableCell>
- <TableCell>ssh {getUsername(props.links)}@{it.hostname}.arvados</TableCell>
+ <TableCell>{getUsername(props.links, props.userUuid)}</TableCell>
+ <TableCell>ssh {getUsername(props.links, props.userUuid)}@{it.hostname}.arvados</TableCell>
<TableCell>
- <a href={`https://workbench.c97qk.arvadosapi.com${it.href}/webshell/${getUsername(props.links)}`} target="_blank" className={props.classes.link}>
- Log in as {getUsername(props.links)}
+ <a href={`https://workbench.c97qk.arvadosapi.com${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>
</TableBody>
</Table>;
-const getUsername = (links: ListResults<any>) => {
- return links.items[0].properties.username;
+const getUsername = (links: ListResults<any>, userUuid: string) => {
+ return links.items.map(it => it.tailUuid === userUuid ? it.properties.username : '');
};
const CardSSHSection = (props: VirtualMachineProps) =>