From 6c024ce6843e5ad5391fc384792480b751e0c663 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Mon, 10 Dec 2018 15:16:49 +0100 Subject: [PATCH] Setup navigation and create slot for groups panel Feature #14505 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- src/routes/route-change-handlers.ts | 3 +++ src/routes/routes.ts | 6 +++++- src/store/navigation/navigation-action.ts | 2 ++ src/store/workbench/workbench-actions.ts | 5 +++++ src/views-components/main-app-bar/account-menu.tsx | 3 ++- src/views/workbench/workbench.tsx | 1 + 6 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts index e2454d63..cbcc065b 100644 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@ -34,6 +34,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname); const myAccountMatch = Routes.matchMyAccountRoute(pathname); const userMatch = Routes.matchUsersRoute(pathname); + const groupsMatch = Routes.matchGroupsRoute(pathname); if (projectMatch) { store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); @@ -73,5 +74,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { store.dispatch(WorkbenchActions.loadMyAccount); }else if (userMatch) { store.dispatch(WorkbenchActions.loadUsers); + } else if (groupsMatch) { + store.dispatch(WorkbenchActions.loadGroupsPanel); } }; diff --git a/src/routes/routes.ts b/src/routes/routes.ts index 88dfd469..2c6dbea5 100644 --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@ -27,7 +27,8 @@ export const Routes = { KEEP_SERVICES: `/keep-services`, COMPUTE_NODES: `/nodes`, USERS: '/users', - API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations` + API_CLIENT_AUTHORIZATIONS: `/api_client_authorizations`, + GROUPS: '/groups', }; export const getResourceUrl = (uuid: string) => { @@ -108,3 +109,6 @@ export const matchComputeNodesRoute = (route: string) => export const matchApiClientAuthorizationsRoute = (route: string) => matchPath(route, { path: Routes.API_CLIENT_AUTHORIZATIONS }); + +export const matchGroupsRoute = (route: string) => + matchPath(route, { path: Routes.GROUPS }); diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts index 8d68a4b6..8fef0ea7 100644 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@ -77,3 +77,5 @@ export const navigateToComputeNodes = push(Routes.COMPUTE_NODES); export const navigateToUsers = push(Routes.USERS); export const navigateToApiClientAuthorizations = push(Routes.API_CLIENT_AUTHORIZATIONS); + +export const navigateToGroups = push(Routes.GROUPS); diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index bc5eac6c..e0195f94 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -445,6 +445,11 @@ export const loadApiClientAuthorizations = handleFirstTimeLoad( await dispatch(loadApiClientAuthorizationsPanel()); }); +export const loadGroupsPanel = handleFirstTimeLoad( + (dispatch: Dispatch) => { + dispatch(setBreadcrumbs([{ label: 'Groups' }])); + }); + const finishLoadingProject = (project: GroupContentsResource | string) => async (dispatch: Dispatch) => { const uuid = typeof project === 'string' ? project : project.uuid; diff --git a/src/views-components/main-app-bar/account-menu.tsx b/src/views-components/main-app-bar/account-menu.tsx index 44b113df..cb8fd566 100644 --- a/src/views-components/main-app-bar/account-menu.tsx +++ b/src/views-components/main-app-bar/account-menu.tsx @@ -14,7 +14,7 @@ import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-tok import { openRepositoriesPanel } from "~/store/repositories/repositories-actions"; import { navigateToSshKeys, navigateToKeepServices, navigateToComputeNodes, - navigateToApiClientAuthorizations, navigateToMyAccount + navigateToApiClientAuthorizations, navigateToMyAccount, navigateToGroups } from '~/store/navigation/navigation-action'; import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions"; import { navigateToUsers } from '~/store/navigation/navigation-action'; @@ -42,6 +42,7 @@ export const AccountMenu = connect(mapStateToProps)( dispatch(openCurrentTokenDialog)}>Current token dispatch(navigateToSshKeys)}>Ssh Keys dispatch(navigateToUsers)}>Users + { user.isAdmin && dispatch(navigateToGroups)}>Groups } { user.isAdmin && dispatch(navigateToApiClientAuthorizations)}>Api Tokens } { user.isAdmin && dispatch(navigateToKeepServices)}>Keep Services } { user.isAdmin && dispatch(navigateToComputeNodes)}>Compute Nodes } diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx index 70f2a2dd..f4124e26 100644 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@ -152,6 +152,7 @@ export const WorkbenchPanel = +

Groups panel

} /> -- 2.30.2