[ARVADOS-WORKBENCH2] updated: 2.1.0-217-g9cc4f706

Git user git at public.arvados.org
Sat Feb 27 04:44:26 UTC 2021


Summary of changes:
 src/common/plugintypes.ts                          |  6 +++++
 src/plugins.tsx                                    |  7 ++++--
 src/plugins/blank/index.tsx                        |  5 ++++
 src/views-components/main-app-bar/main-app-bar.tsx | 15 ++++++------
 .../main-content-bar/main-content-bar.tsx          | 28 ++++++++++++++++------
 5 files changed, 45 insertions(+), 16 deletions(-)

       via  9cc4f706feecd621f9d0121942bb0faa881ec926 (commit)
      from  f18efe026ee07b02e56a2c972c509c2f8b742712 (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 9cc4f706feecd621f9d0121942bb0faa881ec926
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Feb 26 23:43:35 2021 -0500

    17426: Add plugin ability to override app bar.
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/common/plugintypes.ts b/src/common/plugintypes.ts
index 489568ea..dfbe7c45 100644
--- a/src/common/plugintypes.ts
+++ b/src/common/plugintypes.ts
@@ -26,4 +26,10 @@ export interface PluginConfig {
 
     // Add handlers for navigation actions
     locationChangeHandlers: LocationChangeMatcher[];
+
+    appBarLeft?: React.ReactElement;
+
+    appBarMiddle?: React.ReactElement;
+
+    appBarRight?: React.ReactElement;
 }
diff --git a/src/plugins.tsx b/src/plugins.tsx
index fb52aade..83593f23 100644
--- a/src/plugins.tsx
+++ b/src/plugins.tsx
@@ -9,12 +9,15 @@ export const pluginConfig: PluginConfig = {
     sidePanelCategories: [],
     dialogs: [],
     navigateToHandlers: [],
-    locationChangeHandlers: []
+    locationChangeHandlers: [],
+    appBarLeft: undefined,
+    appBarMiddle: undefined,
+    appBarRight: undefined,
 };
 
 // Starting here, import and register your Workbench 2 plugins. //
 
-// import { register as blankUIPluginRegister } from '~/plugins/blank/index';
+import { register as blankUIPluginRegister } from '~/plugins/blank/index';
 import { register as examplePluginRegister, routePath as exampleRoutePath } from '~/plugins/example/index';
 import { register as rootRedirectRegister } from '~/plugins/root-redirect/index';
 
diff --git a/src/plugins/blank/index.tsx b/src/plugins/blank/index.tsx
index 416de42d..9471372d 100644
--- a/src/plugins/blank/index.tsx
+++ b/src/plugins/blank/index.tsx
@@ -5,10 +5,15 @@
 // Example plugin.
 
 import { PluginConfig } from '~/common/plugintypes';
+import * as React from 'react';
 
 export const register = (pluginConfig: PluginConfig) => {
 
     pluginConfig.centerPanelList.push((elms) => []);
 
     pluginConfig.sidePanelCategories.push((cats: string[]): string[] => []);
+
+    pluginConfig.appBarLeft = <span />;
+    pluginConfig.appBarMiddle = <span />;
+    pluginConfig.appBarRight = <span />;
 };
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 ce1cab4c..7bec7b24 100644
--- a/src/views-components/main-app-bar/main-app-bar.tsx
+++ b/src/views-components/main-app-bar/main-app-bar.tsx
@@ -14,6 +14,7 @@ import { AccountMenu } from "~/views-components/main-app-bar/account-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';
 
@@ -42,20 +43,20 @@ export const MainAppBar = withStyles(styles)(
         return <AppBar position="absolute">
             <Toolbar className={props.classes.toolbar}>
                 <Grid container justify="space-between">
-                    <Grid container item xs={3} direction="column" justify="center">
+                    {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}>
                                 <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 && props.user.isActive && <SearchBar />}
+                        {pluginConfig.appBarMiddle || (props.user && props.user.isActive && <SearchBar />)}
                     </Grid>
                     <Grid
                         item
@@ -64,14 +65,14 @@ 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 />
-                            </>
-                            : <HelpMenu />}
+                            </> :
+                                <HelpMenu />)}
                     </Grid>
                 </Grid>
             </Toolbar>
diff --git a/src/views-components/main-content-bar/main-content-bar.tsx b/src/views-components/main-content-bar/main-content-bar.tsx
index cad73a3a..60adab66 100644
--- a/src/views-components/main-content-bar/main-content-bar.tsx
+++ b/src/views-components/main-content-bar/main-content-bar.tsx
@@ -30,13 +30,27 @@ interface MainContentBarProps {
 
 const isButtonVisible = ({ router }: RootState) => {
     const pathname = router.location ? router.location.pathname : '';
-    return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
-        !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
-        !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) &&
-        !Routes.matchSiteManagerRoute(pathname) &&
-        !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
-        !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
-        !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname);
+    return Routes.matchCollectionsContentAddressRoute(pathname) ||
+        Routes.matchPublicFavoritesRoute(pathname) ||
+        Routes.matchGroupDetailsRoute(pathname) ||
+        Routes.matchGroupsRoute(pathname) ||
+        Routes.matchUsersRoute(pathname) ||
+        Routes.matchSearchResultsRoute(pathname) ||
+        Routes.matchSharedWithMeRoute(pathname) ||
+        Routes.matchProcessRoute(pathname) ||
+        Routes.matchCollectionRoute(pathname) ||
+        Routes.matchProjectRoute(pathname) ||
+        Routes.matchAllProcessesRoute(pathname) ||
+        Routes.matchTrashRoute(pathname) ||
+        Routes.matchFavoritesRoute(pathname);
+
+    /* return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
+     *     !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) &&
+     *     !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) &&
+     *     !Routes.matchSiteManagerRoute(pathname) &&
+     *     !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) &&
+     *     !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) &&
+     *     !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname); */
 };
 
 export const MainContentBar =

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list