X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/2f876eb97698de8825c0a3fe95ed57e5e00584a7..b4fa8e69af5429da361aae1eea93301b6c1d725f:/src/views-components/main-app-bar/main-app-bar.tsx

diff --git a/src/views-components/main-app-bar/main-app-bar.tsx b/src/views-components/main-app-bar/main-app-bar.tsx
index ec2a511a..7bec7b24 100644
--- a/src/views-components/main-app-bar/main-app-bar.tsx
+++ b/src/views-components/main-app-bar/main-app-bar.tsx
@@ -7,12 +7,14 @@ import { AppBar, Toolbar, Typography, Grid } from "@material-ui/core";
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { Link } from "react-router-dom";
 import { User } from "~/models/user";
-import { SearchBar } from "~/components/search-bar/search-bar";
+import { SearchBar } from "~/views-components/search-bar/search-bar";
 import { Routes } from '~/routes/routes';
 import { NotificationsMenu } from "~/views-components/main-app-bar/notifications-menu";
 import { AccountMenu } from "~/views-components/main-app-bar/account-menu";
-import { AnonymousMenu } from "~/views-components/main-app-bar/anonymous-menu";
-import { HelpMenu } from './help-menu';
+import { HelpMenu } from '~/views-components/main-app-bar/help-menu';
+import { ReactNode } from "react";
+import { AdminMenu } from "~/views-components/main-app-bar/admin-menu";
+import { pluginConfig } from '~/plugins';
 
 type CssRules = 'toolbar' | 'link';
 
@@ -27,41 +29,34 @@ const styles: StyleRulesCallback<CssRules> = () => ({
 });
 
 interface MainAppBarDataProps {
-    searchText: string;
-    searchDebounce?: number;
     user?: User;
     buildInfo?: string;
+    children?: ReactNode;
+    uuidPrefix: string;
+    siteBanner: string;
 }
 
-export interface MainAppBarActionProps {
-    onSearch: (searchText: string) => void;
-}
-
-export type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles<CssRules>;
+export type MainAppBarProps = MainAppBarDataProps & WithStyles<CssRules>;
 
 export const MainAppBar = withStyles(styles)(
     (props: MainAppBarProps) => {
-        return <AppBar position="static">
+        return <AppBar position="absolute">
             <Toolbar className={props.classes.toolbar}>
                 <Grid container justify="space-between">
-                    <Grid container item xs={3} direction="column" justify="center">
-                        <Typography variant="title" color="inherit" noWrap>
+                    {pluginConfig.appBarLeft || <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
+                                <span dangerouslySetInnerHTML={{ __html: props.siteBanner }} /> ({props.uuidPrefix})
                             </Link>
                         </Typography>
                         <Typography variant="caption" color="inherit">{props.buildInfo}</Typography>
-                    </Grid>
+                    </Grid>}
                     <Grid
                         item
                         xs={6}
                         container
                         alignItems="center">
-                        {props.user && <SearchBar
-                            value={props.searchText}
-                            onSearch={props.onSearch}
-                            debounce={props.searchDebounce}
-                        />}
+                        {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
                     </Grid>
                     <Grid
                         item
@@ -70,16 +65,18 @@ export const MainAppBar = withStyles(styles)(
                         alignItems="center"
                         justify="flex-end"
                         wrap="nowrap">
-                        {props.user
-                            ? <>
+                        {pluginConfig.appBarRight ||
+                            (props.user ? <>
                                 <NotificationsMenu />
                                 <AccountMenu />
+                                {props.user.isAdmin && <AdminMenu />}
                                 <HelpMenu />
-                            </>
-                            : <AnonymousMenu />}
+                            </> :
+                                <HelpMenu />)}
                     </Grid>
                 </Grid>
             </Toolbar>
+            {props.children}
         </AppBar>;
     }
 );
