From: Janicki Artur Date: Wed, 12 Dec 2018 09:55:10 +0000 (+0100) Subject: Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14512_admin_links X-Git-Tag: 1.4.0~91^2~1 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/454ef1c106b3d738526d65ecfae8db98ad7bebc2 Merge branch 'master' of git.curoverse.com:arvados-workbench2 into 14512_admin_links refs #2 14512 Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- 454ef1c106b3d738526d65ecfae8db98ad7bebc2 diff --cc src/views-components/main-app-bar/admin-menu.tsx index 00000000,40ba9161..88aafbae mode 000000,100644..100644 --- a/src/views-components/main-app-bar/admin-menu.tsx +++ b/src/views-components/main-app-bar/admin-menu.tsx @@@ -1,0 -1,45 +1,43 @@@ + // Copyright (C) The Arvados Authors. All rights reserved. + // + // SPDX-License-Identifier: AGPL-3.0 + + import * as React from "react"; + import { MenuItem } from "@material-ui/core"; + import { User } from "~/models/user"; + import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu"; + import { AdminMenuIcon } from "~/components/icon/icon"; + import { DispatchProp, connect } from 'react-redux'; + import { logout } from '~/store/auth/auth-action'; + import { RootState } from "~/store/store"; + import { openRepositoriesPanel } from "~/store/repositories/repositories-actions"; -import { - navigateToSshKeysAdmin, navigateToKeepServices, navigateToComputeNodes, - navigateToApiClientAuthorizations -} from '~/store/navigation/navigation-action'; ++import * as NavigationAction from '~/store/navigation/navigation-action'; + import { openAdminVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions"; + import { openUserPanel } from "~/store/users/users-actions"; + + interface AdminMenuProps { + user?: User; + } + + const mapStateToProps = (state: RootState): AdminMenuProps => ({ + user: state.auth.user + }); + + export const AdminMenu = connect(mapStateToProps)( + ({ user, dispatch }: AdminMenuProps & DispatchProp) => + user + ? } + id="admin-menu" + title="Admin Panel"> + dispatch(openRepositoriesPanel())}>Repositories + dispatch(openAdminVirtualMachines())}>Virtual Machines - dispatch(navigateToSshKeysAdmin)}>Ssh Keys - dispatch(navigateToApiClientAuthorizations)}>Api Tokens ++ dispatch(NavigationAction.navigateToSshKeysAdmin)}>Ssh Keys ++ dispatch(NavigationAction.navigateToApiClientAuthorizations)}>Api Tokens + dispatch(openUserPanel())}>Users - dispatch(navigateToComputeNodes)}>Compute Nodes - dispatch(navigateToKeepServices)}>Keep Services ++ dispatch(NavigationAction.navigateToComputeNodes)}>Compute Nodes ++ dispatch(NavigationAction.navigateToKeepServices)}>Keep Services ++ dispatch(NavigationAction.navigateToLinks)}>Links + dispatch(logout())}>Logout + + : null); diff --cc src/views-components/main-content-bar/main-content-bar.tsx index 03362178,92592193..3806b524 --- a/src/views-components/main-content-bar/main-content-bar.tsx +++ b/src/views-components/main-content-bar/main-content-bar.tsx @@@ -18,11 -18,12 +18,12 @@@ interface MainContentBarProps const isButtonVisible = ({ router }: RootState) => { const pathname = router.location ? router.location.pathname : ''; - return !Routes.matchWorkflowRoute(pathname) && !Routes.matchVirtualMachineRoute(pathname) && - !Routes.matchRepositoriesRoute(pathname) && !Routes.matchSshKeysRoute(pathname) && + return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) && + !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) && + !Routes.matchSshKeysAdminRoute(pathname) && !Routes.matchSshKeysUserRoute(pathname) && !Routes.matchKeepServicesRoute(pathname) && !Routes.matchComputeNodesRoute(pathname) && - !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) && - !Routes.matchLinksRoute(pathname); + !Routes.matchApiClientAuthorizationsRoute(pathname) && !Routes.matchUsersRoute(pathname) && - !Routes.matchMyAccountRoute(pathname); ++ !Routes.matchMyAccountRoute(pathname) && !Routes.matchLinksRoute(pathname); }; export const MainContentBar = connect((state: RootState) => ({