Merge branch 'master' into 15530-wb2-logincluster
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Mon, 28 Oct 2019 15:52:17 +0000 (11:52 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Mon, 28 Oct 2019 15:52:17 +0000 (11:52 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

1  2 
src/common/config.ts
src/views/login-panel/login-panel.tsx

index 3dc34ce510411c67c4e6afc623a7f193c95c8357,1f668292c32c3a5abfbdefee99dd2b3a7ecee441..758a77ba91ed688c5c81ea2dd8d2be3dd6dff23e
@@@ -44,10 -44,8 +44,11 @@@ export interface ClusterConfigJSON 
          ArvadosDocsite: string;
          VocabularyURL: string;
          FileViewersConfigURL: string;
+         WelcomePageHTML: string;
      };
 +    Login: {
 +        LoginCluster: string;
 +    };
  }
  
  export class Config {
@@@ -63,7 -61,7 +64,8 @@@
      workbench2Url: string;
      vocabularyUrl: string;
      fileViewersConfigUrl: string;
 +    loginCluster: string;
+     clusterConfig: ClusterConfigJSON;
  }
  
  export const fetchConfig = () => {
@@@ -115,7 -113,7 +117,8 @@@ remove the entire ${varName} entry fro
                  config.workbench2Url = clusterConfigJSON.Services.Workbench2.ExternalURL;
                  config.workbenchUrl = clusterConfigJSON.Services.Workbench1.ExternalURL;
                  config.keepWebServiceUrl = clusterConfigJSON.Services.WebDAV.ExternalURL;
 +                config.loginCluster = clusterConfigJSON.Login.LoginCluster;
+                 config.clusterConfig = clusterConfigJSON;
                  mapRemoteHosts(clusterConfigJSON, config);
  
                  return { config, apiHost: workbenchConfig.API_HOST };
@@@ -130,6 -128,25 +133,28 @@@ export const mapRemoteHosts = (clusterC
      delete config.remoteHosts["*"];
  };
  
+ export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): ClusterConfigJSON => ({
+     ClusterID: "",
+     RemoteClusters: {},
+     Services: {
+         Controller: { ExternalURL: "" },
+         Workbench1: { ExternalURL: "" },
+         Workbench2: { ExternalURL: "" },
+         Websocket: { ExternalURL: "" },
+         WebDAV: { ExternalURL: "" },
+     },
+     Workbench: {
+         ArvadosDocsite: "",
+         VocabularyURL: "",
+         FileViewersConfigURL: "",
+         WelcomePageHTML: "",
+     },
++    Login: {
++        LoginCluster: "",
++    },
+     ...config
+ });
  export const mockConfig = (config: Partial<Config>): Config => ({
      baseUrl: "",
      keepWebServiceUrl: "",
      workbench2Url: "",
      vocabularyUrl: "",
      fileViewersConfigUrl: "",
-     loginCluster: ""
++    loginCluster: "",
+     clusterConfig: mockClusterConfigJSON({}),
+     ...config
  });
  
  const getDefaultConfig = (): WorkbenchConfig => {
index cca4027ddbc5bd3b5e73af51b3f1c64bfd4bd27b,afc35f7156b24022cbc8aa4e1f34d10f61b09799..293026c3d6733f19ad86f84b00006d8c143b03f9
@@@ -53,7 -51,7 +51,8 @@@ type LoginPanelProps = DispatchProp<any
      remoteHosts: { [key: string]: string },
      homeCluster: string,
      uuidPrefix: string,
-     loginCluster: string
++    loginCluster: string,
+     welcomePage: string
  };
  
  export const LoginPanel = withStyles(styles)(
          remoteHosts: state.auth.remoteHosts,
          homeCluster: state.auth.homeCluster,
          uuidPrefix: state.auth.localCluster,
-         loginCluster: state.auth.loginCluster
-     }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix, loginCluster }: LoginPanelProps) =>
++        loginCluster: state.auth.loginCluster,
+         welcomePage: state.config.clusterConfig.Workbench.WelcomePageHTML
 -    }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix, welcomePage }: LoginPanelProps) =>
++    }))(({ classes, dispatch, remoteHosts, homeCluster, uuidPrefix, loginCluster, welcomePage }: LoginPanelProps) =>
          <Grid container justify="center" alignItems="center"
              className={classes.root}
              style={{ marginTop: 56, overflowY: "auto", height: "100%" }}>
              <Grid item className={classes.container}>
-                 <Typography variant='h6' align="center" className={classes.title}>
-                     Welcome to the Arvados Workbench
-               </Typography>
-                 <Typography className={classes.content}>
-                     The "Log in" button below will show you a Google sign-in page.
-                     After you assure Google that you want to log in here with your Google account, you will be redirected back here to Arvados Workbench.
-               </Typography>
-                 <Typography className={classes.content}>
-                     If you have never used Arvados Workbench before, logging in for the first time will automatically create a new account.
-               </Typography>
-                 <Typography variant='body1' className={classNames(classes.content, classes.content__bolder)}>
-                     IMPORTANT: Please keep in mind to store exploratory data only but not any information used for clinical decision making.
-               </Typography>
-                 <Typography className={classes.content}>
-                     Arvados Workbench uses your name and email address only for identification, and does not retrieve any other personal information from Google.
-               </Typography>
+                 <Typography>
+                     <div dangerouslySetInnerHTML={{ __html: welcomePage }} style={{ margin: "1em" }} />
+                 </Typography>
 -                {Object.keys(remoteHosts).length > 1 &&
 +                {Object.keys(remoteHosts).length > 1 && loginCluster === "" &&
++
                      <Typography component="div" align="right">
                          <label>Please select the cluster that hosts your user account:</label>
                          <Select native value={homeCluster} style={{ margin: "1em" }}
  
                  <Typography component="div" align="right">
                      <Button variant="contained" color="primary" style={{ margin: "1em" }} className={classes.button}
 -                        onClick={() => dispatch(login(uuidPrefix, homeCluster, remoteHosts))}>
 -                        Log in to {uuidPrefix}
 -                        {uuidPrefix !== homeCluster &&
 -                            <span>&nbsp;with user from {homeCluster}</span>}
 +                        onClick={() => dispatch(login(uuidPrefix, homeCluster, loginCluster, remoteHosts))}>
 +                        Log in
-                         {uuidPrefix !== homeCluster && loginCluster !== homeCluster &&
++                      {uuidPrefix !== homeCluster && loginCluster !== homeCluster &&
 +                            <span>&nbsp;to {uuidPrefix} with user from {homeCluster}</span>}
                      </Button>
                  </Typography>
              </Grid>