[ARVADOS-WORKBENCH2] updated: 1.2.0-305-g335bd7c

Git user git at public.curoverse.com
Thu Sep 6 06:15:42 EDT 2018


Summary of changes:
 src/views-components/main-app-bar/main-app-bar.tsx | 74 ++++++++--------------
 src/views/workbench/workbench.tsx                  | 66 ++-----------------
 2 files changed, 32 insertions(+), 108 deletions(-)

       via  335bd7cfdc7f978089613a3f4a991f05229c1365 (commit)
      from  bae676cf6c9130ec6ef9708b86343024d11034b2 (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 335bd7cfdc7f978089613a3f4a991f05229c1365
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date:   Thu Sep 6 12:15:27 2018 +0200

    Clean up main-app-bar code
    
    Feature #14149
    
    Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>

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 63bdd8b..bb42e23 100644
--- a/src/views-components/main-app-bar/main-app-bar.tsx
+++ b/src/views-components/main-app-bar/main-app-bar.tsx
@@ -3,14 +3,11 @@
 // SPDX-License-Identifier: AGPL-3.0
 
 import * as React from "react";
-import { AppBar, Toolbar, Typography, Grid, IconButton, Badge, Button, MenuItem, Tooltip } from "@material-ui/core";
+import { AppBar, Toolbar, Typography, Grid } from "@material-ui/core";
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
-import { ArvadosTheme } from '~/common/custom-theme';
 import { Link } from "react-router-dom";
-import { User, getUserFullname } from "~/models/user";
+import { User } from "~/models/user";
 import { SearchBar } from "~/components/search-bar/search-bar";
-import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
-import { DetailsIcon, NotificationIcon, UserPanelIcon, HelpIcon } from "~/components/icon/icon";
 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";
@@ -18,36 +15,21 @@ import { AnonymousMenu } from "~/views-components/main-app-bar/anonymous-menu";
 
 type CssRules = 'link';
 
-const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+const styles: StyleRulesCallback<CssRules> = () => ({
     link: {
         textDecoration: 'none',
         color: 'inherit'
     }
 });
 
-export interface MainAppBarMenuItem {
-    label: string;
-}
-
-export interface MainAppBarMenuItems {
-    accountMenu: MainAppBarMenuItem[];
-    helpMenu: MainAppBarMenuItem[];
-    anonymousMenu: MainAppBarMenuItem[];
-}
-
 interface MainAppBarDataProps {
     searchText: string;
     searchDebounce?: number;
-    breadcrumbs: React.ComponentType<any>;
     user?: User;
-    menuItems: MainAppBarMenuItems;
-    buildInfo: string;
 }
 
 export interface MainAppBarActionProps {
     onSearch: (searchText: string) => void;
-    onMenuItemClick: (menuItem: MainAppBarMenuItem) => void;
-    onDetailsPanelToggle: () => void;
 }
 
 export type MainAppBarProps = MainAppBarDataProps & MainAppBarActionProps & WithStyles<CssRules>;
@@ -63,39 +45,33 @@ export const MainAppBar = withStyles(styles)(
                                 arvados workbench
                             </Link>
                         </Typography>
-                        {/* <Typography variant="body1" color="inherit" noWrap >
-                            {props.buildInfo}
-                        </Typography> */}
                     </Grid>
-                    <Grid item xs={6} container alignItems="center">
-                        {
-                            props.user && <SearchBar
-                                value={props.searchText}
-                                onSearch={props.onSearch}
-                                debounce={props.searchDebounce}
-                            />
-                        }
+                    <Grid
+                        item
+                        xs={6}
+                        container
+                        alignItems="center">
+                        {props.user && <SearchBar
+                            value={props.searchText}
+                            onSearch={props.onSearch}
+                            debounce={props.searchDebounce}
+                        />}
                     </Grid>
-                    <Grid item xs={3} container alignItems="center" justify="flex-end">
-                        {
-                            props.user
-                                ? <>
-                                    <NotificationsMenu />
-                                    <AccountMenu />
-                                </>
-                                : <AnonymousMenu />
-                        }
+                    <Grid
+                        item
+                        xs={3}
+                        container
+                        alignItems="center"
+                        justify="flex-end">
+                        {props.user
+                            ? <>
+                                <NotificationsMenu />
+                                <AccountMenu />
+                            </>
+                            : <AnonymousMenu />}
                     </Grid>
                 </Grid>
             </Toolbar>
-            {/* <Toolbar >
-                {props.user && <props.breadcrumbs />}
-                {props.user && <IconButton color="inherit" onClick={props.onDetailsPanelToggle}>
-                    <Tooltip title="Additional Info">
-                        <DetailsIcon />
-                    </Tooltip>
-                </IconButton>}
-            </Toolbar> */}
         </AppBar>;
     }
 );
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 7c76a0b..c7c3d42 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -6,10 +6,9 @@ import * as React from 'react';
 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
 import { connect, DispatchProp } from "react-redux";
 import { Route, Switch } from "react-router";
-import { login, logout } from "~/store/auth/auth-action";
 import { User } from "~/models/user";
 import { RootState } from "~/store/store";
-import { MainAppBar, MainAppBarActionProps, MainAppBarMenuItem } from '~/views-components/main-app-bar/main-app-bar';
+import { MainAppBar } from '~/views-components/main-app-bar/main-app-bar';
 import { push } from 'react-router-redux';
 import { ProjectPanel } from "~/views/project-panel/project-panel";
 import { DetailsPanel } from '~/views-components/details-panel/details-panel';
@@ -28,7 +27,6 @@ import { Routes } from '~/routes/routes';
 import { SidePanel } from '~/views-components/side-panel/side-panel';
 import { ProcessPanel } from '~/views/process-panel/process-panel';
 import { ProcessLogPanel } from '~/views/process-log-panel/process-log-panel';
-import { Breadcrumbs } from '~/views-components/breadcrumbs/breadcrumbs';
 import { CreateProjectDialog } from '~/views-components/dialog-forms/create-project-dialog';
 import { CreateCollectionDialog } from '~/views-components/dialog-forms/create-collection-dialog';
 import { CopyCollectionDialog } from '~/views-components/dialog-forms/copy-collection-dialog';
@@ -86,24 +84,12 @@ interface WorkbenchGeneralProps {
     buildInfo: string;
 }
 
-interface WorkbenchActionProps {
-}
-
-type WorkbenchProps = WorkbenchDataProps & WorkbenchGeneralProps & WorkbenchActionProps & DispatchProp<any> & WithStyles<CssRules>;
-
-interface NavMenuItem extends MainAppBarMenuItem {
-    action: () => void;
-}
+type WorkbenchProps = WorkbenchDataProps & WorkbenchGeneralProps & DispatchProp<any> & WithStyles<CssRules>;
 
 interface WorkbenchState {
     isCurrentTokenDialogOpen: boolean;
     anchorEl: any;
     searchText: string;
-    menuItems: {
-        accountMenu: NavMenuItem[],
-        helpMenu: NavMenuItem[],
-        anonymousMenu: NavMenuItem[]
-    };
 }
 
 export const Workbench = withStyles(styles)(
@@ -118,35 +104,6 @@ export const Workbench = withStyles(styles)(
                 isCurrentTokenDialogOpen: false,
                 anchorEl: null,
                 searchText: "",
-                breadcrumbs: [],
-                menuItems: {
-                    accountMenu: [
-                        {
-                            label: 'Current token',
-                            action: () => this.toggleCurrentTokenModal()
-                        },
-                        {
-                            label: "Logout",
-                            action: () => this.props.dispatch(logout())
-                        },
-                        {
-                            label: "My account",
-                            action: () => this.props.dispatch(push("/my-account"))
-                        }
-                    ],
-                    helpMenu: [
-                        {
-                            label: "Help",
-                            action: () => this.props.dispatch(push("/help"))
-                        }
-                    ],
-                    anonymousMenu: [
-                        {
-                            label: "Sign in",
-                            action: () => this.props.dispatch(login())
-                        }
-                    ]
-                }
             };
 
             render() {
@@ -155,12 +112,9 @@ export const Workbench = withStyles(styles)(
                     <div className={classes.root}>
                         <div className={classes.appBar}>
                             <MainAppBar
-                                breadcrumbs={Breadcrumbs}
                                 searchText={this.state.searchText}
                                 user={this.props.user}
-                                menuItems={this.state.menuItems}
-                                buildInfo={this.props.buildInfo}
-                                {...this.mainAppBarActions} />
+                                onSearch={this.onSearch} />
                         </div>
                         {user && <SidePanel />}
                         <main className={classes.contentWrapper}>
@@ -200,16 +154,10 @@ export const Workbench = withStyles(styles)(
                 );
             }
 
-            mainAppBarActions: MainAppBarActionProps = {
-                onSearch: searchText => {
-                    this.setState({ searchText });
-                    this.props.dispatch(push(`/search?q=${searchText}`));
-                },
-                onMenuItemClick: (menuItem: NavMenuItem) => menuItem.action(),
-                onDetailsPanelToggle: () => {
-                    this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());
-                },
-            };
+            onSearch = (searchText: string) => {
+                this.setState({ searchText });
+                this.props.dispatch(push(`/search?q=${searchText}`));
+            }
 
             toggleDetailsPanel = () => {
                 this.props.dispatch(detailsPanelActions.TOGGLE_DETAILS_PANEL());

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list