[ARVADOS-WORKBENCH2] updated: 1.2.0-956-gefbf876

Git user git at public.curoverse.com
Tue Nov 27 03:46:53 EST 2018


Summary of changes:
 src/models/link.ts                                 |  3 +-
 .../virtual-machines/virtual-machines-actions.ts   |  5 --
 .../virtual-machine-panel.tsx                      | 73 +++++++++++-----------
 3 files changed, 37 insertions(+), 44 deletions(-)

       via  efbf87610d0d483416a14a5364a5f8c61bdee10b (commit)
      from  8f09a9c122d86154f98644a37a92c5b4bc3cec7e (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit efbf87610d0d483416a14a5364a5f8c61bdee10b
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Tue Nov 27 09:46:43 2018 +0100

    cr changes
    
    Feature #13864
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/models/link.ts b/src/models/link.ts
index 0b5053d..baaff65 100644
--- a/src/models/link.ts
+++ b/src/models/link.ts
@@ -3,13 +3,14 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import { Resource } from "./resource";
+import { TagProperty } from "~/models/tag";
 
 export interface LinkResource extends Resource {
     headUuid: string;
     tailUuid: string;
     linkClass: string;
     name: string;
-    properties: any;
+    properties: TagProperty;
 }
 
 export enum LinkClass {
diff --git a/src/store/virtual-machines/virtual-machines-actions.ts b/src/store/virtual-machines/virtual-machines-actions.ts
index c9283af..9bd7988 100644
--- a/src/store/virtual-machines/virtual-machines-actions.ts
+++ b/src/store/virtual-machines/virtual-machines-actions.ts
@@ -48,11 +48,6 @@ export const loadVirtualMachinesData = () =>
         });
         dispatch(virtualMachinesActions.SET_VIRTUAL_MACHINES(virtualMachines));
         dispatch(virtualMachinesActions.SET_LINKS(links));
-        // const logins = await services.virtualMachineService.logins(virtualMachines.items[0].uuid);
-        // console.log(logins);
-        // const getAllLogins = await services.virtualMachineService.getAllLogins();
-        // console.log(getAllLogins);  
-        // dispatch(virtualMachinesActions.SET_LOGINS(getAllLogins));
     };
 
 export const saveRequestedDate = () =>
diff --git a/src/views/virtual-machine-panel/virtual-machine-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-panel.tsx
index 94197c6..c94c3a7 100644
--- a/src/views/virtual-machine-panel/virtual-machine-panel.tsx
+++ b/src/views/virtual-machine-panel/virtual-machine-panel.tsx
@@ -14,10 +14,10 @@ import { saveRequestedDate, loadVirtualMachinesData } from '~/store/virtual-mach
 import { RootState } from '~/store/store';
 import { ListResults } from '~/services/common-service/common-resource-service';
 import { HelpIcon } from '~/components/icon/icon';
-import { VirtualMachinesLoginsResource } from '~/models/virtual-machines';
+import { VirtualMachinesLoginsResource, VirtualMachinesResource } from '~/models/virtual-machines';
 import { Routes } from '~/routes/routes';
 
-type CssRules = 'button' | 'codeSnippet' | 'link' | 'linkIcon' | 'rightAlign' | 'cardWithoutMachines';
+type CssRules = 'button' | 'codeSnippet' | 'link' | 'linkIcon' | 'rightAlign' | 'cardWithoutMachines' | 'icon';
 
 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     button: {
@@ -58,19 +58,17 @@ const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
     }
 });
 
-const mapStateToProps = (state: RootState) => {
+const mapStateToProps = ({ virtualMachines }: RootState) => {
     return {
-        requestedDate: state.virtualMachines.date,
-        virtualMachines: state.virtualMachines.virtualMachines,
-        logins: state.virtualMachines.logins,
-        links: state.virtualMachines.links
+        requestedDate: virtualMachines.date,
+        ...virtualMachines
     };
 };
 
-const mapDispatchToProps = (dispatch: Dispatch) => ({
-    saveRequestedDate: () => dispatch<any>(saveRequestedDate()),
-    loadVirtualMachinesData: () => dispatch<any>(loadVirtualMachinesData())
-});
+const mapDispatchToProps = {
+    saveRequestedDate,
+    loadVirtualMachinesData
+};
 
 interface VirtualMachinesPanelDataProps {
     requestedDate: string;
@@ -95,55 +93,55 @@ export const VirtualMachinePanel = compose(
             }
 
             render() {
-                const { classes, saveRequestedDate, requestedDate, virtualMachines, links } = this.props;
+                const { virtualMachines, links } = this.props;
                 return (
                     <Grid container spacing={16}>
-                        {virtualMachines.itemsAvailable === 0 && cardContentWithNoVirtualMachines(requestedDate, saveRequestedDate, classes)}
-                        {virtualMachines.itemsAvailable > 0 && links.itemsAvailable > 0 && cardContentWithVirtualMachines(requestedDate, saveRequestedDate, virtualMachines, links, classes)}
-                        {cardSSHSection(classes)}
+                        {virtualMachines.itemsAvailable === 0 && <CardContentWithNoVirtualMachines {...this.props} />}
+                        {virtualMachines.itemsAvailable > 0 && links.itemsAvailable > 0 && <CardContentWithVirtualMachines {...this.props} />}
+                        {<CardSSHSection {...this.props} />}
                     </Grid>
                 );
             }
         }
     );
 
-const cardContentWithNoVirtualMachines = (requestedDate: string, saveRequestedDate: () => void, classes: any) =>
+const CardContentWithNoVirtualMachines = (props: VirtualMachineProps) =>
     <Grid item xs={12}>
         <Card>
-            <CardContent className={classes.cardWithoutMachines}>
+            <CardContent className={props.classes.cardWithoutMachines}>
                 <Grid item xs={6}>
                     <Typography variant="body2">
                         You do not have access to any virtual machines. Some Arvados features require using the command line. You may request access to a hosted virtual machine with the command line shell.
                     </Typography>
                 </Grid>
-                <Grid item xs={6} className={classes.rightAlign}>
-                    <Button variant="contained" color="primary" className={classes.button} onClick={saveRequestedDate}>
+                <Grid item xs={6} className={props.classes.rightAlign}>
+                    <Button variant="contained" color="primary" className={props.classes.button} onClick={props.saveRequestedDate}>
                         SEND REQUEST FOR SHELL ACCESS
                     </Button>
-                    {requestedDate &&
+                    {props.requestedDate &&
                         <Typography variant="body1">
-                            A request for shell access was sent on {requestedDate}
+                            A request for shell access was sent on {props.requestedDate}
                         </Typography>}
                 </Grid>
             </CardContent>
         </Card>
     </Grid>;
 
-const cardContentWithVirtualMachines = (requestedDate: string, saveRequestedDate: () => void, virtualMachines: ListResults<any>, links: ListResults<any>, classes: any) =>
+const CardContentWithVirtualMachines = (props: VirtualMachineProps) =>
     <Grid item xs={12}>
         <Card>
             <CardContent>
-                <div className={classes.rightAlign}>
-                    <Button variant="contained" color="primary" className={classes.button} onClick={saveRequestedDate}>
+                <div className={props.classes.rightAlign}>
+                    <Button variant="contained" color="primary" className={props.classes.button} onClick={props.saveRequestedDate}>
                         SEND REQUEST FOR SHELL ACCESS
                     </Button>
-                    {requestedDate &&
+                    {props.requestedDate &&
                         <Typography variant="body1">
-                            A request for shell access was sent on {requestedDate}
+                            A request for shell access was sent on {props.requestedDate}
                         </Typography>}
                 </div>
-                <div className={classes.icon}>
-                    <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" className={classes.linkIcon}>
+                <div className={props.classes.icon}>
+                    <a href="https://doc.arvados.org/user/getting_started/vm-login-with-webshell.html" target="_blank" className={props.classes.linkIcon}>
                         <Tooltip title="Access VM using webshell">
                             <HelpIcon />
                         </Tooltip>
@@ -159,14 +157,14 @@ const cardContentWithVirtualMachines = (requestedDate: string, saveRequestedDate
                         </TableRow>
                     </TableHead>
                     <TableBody>
-                        {virtualMachines.items.map((it, index) =>
+                        {props.virtualMachines.items.map((it, index) =>
                             <TableRow key={index}>
                                 <TableCell>{it.hostname}</TableCell>
-                                <TableCell>{getUsername(links, it)}</TableCell>
-                                <TableCell>ssh {getUsername(links, it)}@shell.arvados</TableCell>
+                                <TableCell>{getUsername(props.links, it)}</TableCell>
+                                <TableCell>ssh {getUsername(props.links, it)}@shell.arvados</TableCell>
                                 <TableCell>
-                                    <a href={`https://workbench.c97qk.arvadosapi.com${it.href}/webshell/${getUsername(links, it)}`} target="_blank" className={classes.link}>
-                                        Log in as {getUsername(links, it)}
+                                    <a href={`https://workbench.c97qk.arvadosapi.com${it.href}/webshell/${getUsername(props.links, it)}`} target="_blank" className={props.classes.link}>
+                                        Log in as {getUsername(props.links, it)}
                                     </a>
                                 </TableCell>
                             </TableRow>
@@ -177,21 +175,20 @@ const cardContentWithVirtualMachines = (requestedDate: string, saveRequestedDate
         </Card>
     </Grid>;
 
-const getUsername = (links: ListResults<any>, virtualMachine: any) => {
-    console.log(links);
+const getUsername = (links: ListResults<any>, virtualMachine: VirtualMachinesResource) => {
     const link = links.items.find((item: any) => item.headUuid === virtualMachine.uuid);
     return link.properties.username || undefined;
 };
 
-const cardSSHSection = (classes: any) =>
+const CardSSHSection = (props: VirtualMachineProps) =>
     <Grid item xs={12}>
         <Card>
             <CardContent>
                 <Typography variant="body2">
-                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS} className={classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
+                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS} className={props.classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
                 </Typography>
                 <DefaultCodeSnippet
-                    className={classes.codeSnippet}
+                    className={props.classes.codeSnippet}
                     lines={[textSSH]} />
             </CardContent>
         </Card>

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list