Merge branch '15669-search-params' refs #15669
authorPeter Amstutz <pamstutz@veritasgenetics.com>
Tue, 29 Oct 2019 19:22:35 +0000 (15:22 -0400)
committerPeter Amstutz <pamstutz@veritasgenetics.com>
Tue, 29 Oct 2019 19:22:35 +0000 (15:22 -0400)
Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <pamstutz@veritasgenetics.com>

src/common/config.ts
src/views-components/main-app-bar/main-app-bar.tsx
src/views/inactive-panel/inactive-panel.tsx
src/views/main-panel/main-panel-root.tsx
src/views/main-panel/main-panel.tsx

index 758a77ba91ed688c5c81ea2dd8d2be3dd6dff23e..e5f7b1c6d70e2a163c6dd29a11e393d9c6c04b28 100644 (file)
@@ -45,6 +45,8 @@ export interface ClusterConfigJSON {
         VocabularyURL: string;
         FileViewersConfigURL: string;
         WelcomePageHTML: string;
+        InactivePageHTML: string;
+        SiteName: string;
     };
     Login: {
         LoginCluster: string;
@@ -148,6 +150,8 @@ export const mockClusterConfigJSON = (config: Partial<ClusterConfigJSON>): Clust
         VocabularyURL: "",
         FileViewersConfigURL: "",
         WelcomePageHTML: "",
+        InactivePageHTML: "",
+        SiteName: "",
     },
     Login: {
         LoginCluster: "",
index 475b29e1254f1ffcb0cdc6d720e30074bc5c4515..ce1cab4ca01b0b985554d0134ad6dcb3a5ef48b2 100644 (file)
@@ -32,6 +32,7 @@ interface MainAppBarDataProps {
     buildInfo?: string;
     children?: ReactNode;
     uuidPrefix: string;
+    siteBanner: string;
 }
 
 export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
@@ -44,7 +45,7 @@ export const MainAppBar = withStyles(styles)(
                     <Grid container item xs={3} direction="column" justify="center">
                         <Typography variant='h6' color="inherit" noWrap>
                             <Link to={Routes.ROOT} className={props.classes.link}>
-                                arvados workbench ({props.uuidPrefix})
+                                <span dangerouslySetInnerHTML={{ __html: props.siteBanner }} /> ({props.uuidPrefix})
                             </Link>
                         </Typography>
                         <Typography variant="caption" color="inherit">{props.buildInfo}</Typography>
index 8d53a21ecaa060fd659d6c92ac7d9e4f83e6b692..91b4a51df8c41b150613077c277d7406b3226f7a 100644 (file)
@@ -9,7 +9,7 @@ import { Grid, Typography, Button } from '@material-ui/core';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { ArvadosTheme } from '~/common/custom-theme';
 import { navigateToLinkAccount } from '~/store/navigation/navigation-action';
-
+import { RootState } from '~/store/store';
 
 type CssRules = 'root' | 'ontop' | 'title';
 
@@ -47,31 +47,32 @@ const mapDispatchToProps = (dispatch: Dispatch): InactivePanelActionProps => ({
     }
 });
 
-type InactivePanelProps =  WithStyles<CssRules> & InactivePanelActionProps;
+export interface InactivePanelStateProps {
+    inactivePageText: string;
+}
+
+type InactivePanelProps = WithStyles<CssRules> & InactivePanelActionProps & InactivePanelStateProps;
 
-export const InactivePanel = connect(null, mapDispatchToProps)(withStyles(styles)((({ classes, startLinking }: InactivePanelProps) =>
-        <Grid container justify="center" alignItems="center" direction="column" spacing={24}
-            className={classes.root}
-            style={{ marginTop: 56, height: "100%" }}>
-            <Grid item>
-                <Typography variant='h6' align="center" className={classes.title}>
-                    Hi! You're logged in, but...
-                </Typography>
-            </Grid>
-            <Grid item>
-                <Typography align="center">
-                    Your account is inactive. An administrator must activate your account before you can get any further.
-                </Typography>
-            </Grid>
-            <Grid item>
-                <Typography align="center">
-                    If you would like to use this login to access another account click "Link Account".
-                </Typography>
-            </Grid>
-            <Grid item>
-                <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
-                    Link Account
-                </Button>
-            </Grid>
-        </Grid >
-    )));
+export const InactivePanel = connect((state: RootState) => ({
+    inactivePageText: state.config.clusterConfig.Workbench.InactivePageHTML
+}), mapDispatchToProps)(withStyles(styles)((({ classes, startLinking, inactivePageText }: InactivePanelProps) =>
+    <Grid container justify="center" alignItems="center" direction="column" spacing={24}
+        className={classes.root}
+        style={{ marginTop: 56, height: "100%" }}>
+        <Grid item>
+            <Typography>
+                <div dangerouslySetInnerHTML={{ __html: inactivePageText }} style={{ margin: "1em" }} />
+            </Typography>
+        </Grid>
+        <Grid item>
+            <Typography align="center">
+                If you would like to use this login to access another account click "Link Account".
+           </Typography>
+        </Grid>
+        <Grid item>
+            <Button className={classes.ontop} color="primary" variant="contained" onClick={() => startLinking()}>
+                Link Account
+           </Button>
+        </Grid>
+    </Grid >
+)));
index 16fc7a1f05a41d5bd4604ce0943eb605da2a0670..e7daaf00932f0a0c8080946b22f340e2114870f9 100644 (file)
@@ -30,23 +30,26 @@ export interface MainPanelRootDataProps {
     uuidPrefix: string;
     isNotLinking: boolean;
     isLinkingPath: boolean;
+    siteBanner: string;
 }
 
 type MainPanelRootProps = MainPanelRootDataProps & WithStyles<CssRules>;
 
 export const MainPanelRoot = withStyles(styles)(
-    ({ classes, loading, working, user, buildInfo, uuidPrefix, isNotLinking, isLinkingPath }: MainPanelRootProps) =>
+    ({ classes, loading, working, user, buildInfo, uuidPrefix,
+        isNotLinking, isLinkingPath, siteBanner }: MainPanelRootProps) =>
         loading
             ? <WorkbenchLoadingScreen />
             : <>
-               isNotLinking && <MainAppBar
+                {isNotLinking && <MainAppBar
                     user={user}
                     buildInfo={buildInfo}
-                    uuidPrefix={uuidPrefix}>
+                    uuidPrefix={uuidPrefix}
+                    siteBanner={siteBanner}>
                     {working ? <LinearProgress color="secondary" /> : null}
-               </MainAppBar> }
+                </MainAppBar>}
                 <Grid container direction="column" className={classes.root}>
-                    { user ? (user.isActive || (!user.isActive && isLinkingPath) ? <WorkbenchPanel isNotLinking={isNotLinking} isUserActive={user.isActive} /> : <InactivePanel />) : <LoginPanel /> }
+                    {user ? (user.isActive || (!user.isActive && isLinkingPath) ? <WorkbenchPanel isNotLinking={isNotLinking} isUserActive={user.isActive} /> : <InactivePanel />) : <LoginPanel />}
                 </Grid>
             </>
 );
index 5bf03da3986afbe73c8999c43cd119f438652785..dab4533fa306107b89bd6f28aabb22565e826c6b 100644 (file)
@@ -18,7 +18,8 @@ const mapStateToProps = (state: RootState): MainPanelRootDataProps => {
         buildInfo: state.appInfo.buildInfo,
         uuidPrefix: state.auth.localCluster,
         isNotLinking: state.linkAccountPanel.status === LinkAccountPanelStatus.NONE || state.linkAccountPanel.status === LinkAccountPanelStatus.INITIAL,
-        isLinkingPath:  state.router.location ? matchLinkAccountRoute(state.router.location.pathname) !== null : false
+        isLinkingPath: state.router.location ? matchLinkAccountRoute(state.router.location.pathname) !== null : false,
+        siteBanner: state.config.clusterConfig.Workbench.SiteName
     };
 };