From: Pawel Kromplewski Date: Wed, 5 Dec 2018 15:13:43 +0000 (+0100) Subject: Merge branch 'master' into 14452-my-account X-Git-Tag: 1.4.0~92^2~3 X-Git-Url: https://git.arvados.org/arvados-workbench2.git/commitdiff_plain/a1e2b8ba77e4a7273940a3fc542bc42e282618a7 Merge branch 'master' into 14452-my-account refs #14452 Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski --- a1e2b8ba77e4a7273940a3fc542bc42e282618a7 diff --cc src/routes/route-change-handlers.ts index 400866e3,f2304aca..68de3107 --- a/src/routes/route-change-handlers.ts +++ b/src/routes/route-change-handlers.ts @@@ -16,51 -15,54 +15,57 @@@ export const addRouteChangeHandlers = ( }; const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => { - const rootMatch = matchRootRoute(pathname); - const projectMatch = matchProjectRoute(pathname); - const collectionMatch = matchCollectionRoute(pathname); - const favoriteMatch = matchFavoritesRoute(pathname); - const trashMatch = matchTrashRoute(pathname); - const processMatch = matchProcessRoute(pathname); - const processLogMatch = matchProcessLogRoute(pathname); - const repositoryMatch = matchRepositoriesRoute(pathname); - const searchResultsMatch = matchSearchResultsRoute(pathname); - const sharedWithMeMatch = matchSharedWithMeRoute(pathname); - const runProcessMatch = matchRunProcessRoute(pathname); - const virtualMachineMatch = matchVirtualMachineRoute(pathname); - const workflowMatch = matchWorkflowRoute(pathname); - const sshKeysMatch = matchSshKeysRoute(pathname); - const myAccountMatch = matchMyAccountRoute(pathname); + const rootMatch = Routes.matchRootRoute(pathname); + const projectMatch = Routes.matchProjectRoute(pathname); + const collectionMatch = Routes.matchCollectionRoute(pathname); + const favoriteMatch = Routes.matchFavoritesRoute(pathname); + const trashMatch = Routes.matchTrashRoute(pathname); + const processMatch = Routes.matchProcessRoute(pathname); + const processLogMatch = Routes.matchProcessLogRoute(pathname); + const repositoryMatch = Routes.matchRepositoriesRoute(pathname); + const searchResultsMatch = Routes.matchSearchResultsRoute(pathname); + const sharedWithMeMatch = Routes.matchSharedWithMeRoute(pathname); + const runProcessMatch = Routes.matchRunProcessRoute(pathname); + const virtualMachineMatch = Routes.matchVirtualMachineRoute(pathname); + const workflowMatch = Routes.matchWorkflowRoute(pathname); + const sshKeysMatch = Routes.matchSshKeysRoute(pathname); + const keepServicesMatch = Routes.matchKeepServicesRoute(pathname); + const computeNodesMatch = Routes.matchComputeNodesRoute(pathname); ++ const myAccountMatch = Routes.matchMyAccountRoute(pathname); if (projectMatch) { - store.dispatch(loadProject(projectMatch.params.id)); + store.dispatch(WorkbenchActions.loadProject(projectMatch.params.id)); } else if (collectionMatch) { - store.dispatch(loadCollection(collectionMatch.params.id)); + store.dispatch(WorkbenchActions.loadCollection(collectionMatch.params.id)); } else if (favoriteMatch) { - store.dispatch(loadFavorites()); + store.dispatch(WorkbenchActions.loadFavorites()); } else if (trashMatch) { - store.dispatch(loadTrash()); + store.dispatch(WorkbenchActions.loadTrash()); } else if (processMatch) { - store.dispatch(loadProcess(processMatch.params.id)); + store.dispatch(WorkbenchActions.loadProcess(processMatch.params.id)); } else if (processLogMatch) { - store.dispatch(loadProcessLog(processLogMatch.params.id)); + store.dispatch(WorkbenchActions.loadProcessLog(processLogMatch.params.id)); } else if (rootMatch) { store.dispatch(navigateToRootProject); } else if (sharedWithMeMatch) { - store.dispatch(loadSharedWithMe); + store.dispatch(WorkbenchActions.loadSharedWithMe); } else if (runProcessMatch) { - store.dispatch(loadRunProcess); + store.dispatch(WorkbenchActions.loadRunProcess); } else if (workflowMatch) { - store.dispatch(loadWorkflow); + store.dispatch(WorkbenchActions.loadWorkflow); } else if (searchResultsMatch) { - store.dispatch(loadSearchResults); + store.dispatch(WorkbenchActions.loadSearchResults); } else if (virtualMachineMatch) { - store.dispatch(loadVirtualMachines); + store.dispatch(WorkbenchActions.loadVirtualMachines); } else if(repositoryMatch) { - store.dispatch(loadRepositories); + store.dispatch(WorkbenchActions.loadRepositories); } else if (sshKeysMatch) { - store.dispatch(loadSshKeys); + store.dispatch(WorkbenchActions.loadSshKeys); + } else if (keepServicesMatch) { + store.dispatch(WorkbenchActions.loadKeepServices); + } else if (computeNodesMatch) { + store.dispatch(WorkbenchActions.loadComputeNodes); + } else if (myAccountMatch) { - store.dispatch(loadMyAccount); ++ store.dispatch(WorkbenchActions.loadMyAccount); } }; diff --cc src/routes/routes.ts index a27b4274,8f8fa06b..71d920ab --- a/src/routes/routes.ts +++ b/src/routes/routes.ts @@@ -23,7 -23,8 +23,9 @@@ export const Routes = WORKFLOWS: '/workflows', SEARCH_RESULTS: '/search-results', SSH_KEYS: `/ssh-keys`, - MY_ACCOUNT: '/my-account' ++ MY_ACCOUNT: '/my-account', + KEEP_SERVICES: `/keep-services`, + COMPUTE_NODES: `/nodes` }; export const getResourceUrl = (uuid: string) => { @@@ -90,5 -91,8 +92,11 @@@ export const matchRepositoriesRoute = ( export const matchSshKeysRoute = (route: string) => matchPath(route, { path: Routes.SSH_KEYS }); +export const matchMyAccountRoute = (route: string) => + matchPath(route, { path: Routes.MY_ACCOUNT }); ++ + export const matchKeepServicesRoute = (route: string) => + matchPath(route, { path: Routes.KEEP_SERVICES }); + + export const matchComputeNodesRoute = (route: string) => + matchPath(route, { path: Routes.COMPUTE_NODES }); diff --cc src/services/auth-service/auth-service.ts index 6faaf99e,98c03215..8c2ad5ca --- a/src/services/auth-service/auth-service.ts +++ b/src/services/auth-service/auth-service.ts @@@ -2,9 -2,9 +2,9 @@@ // // SPDX-License-Identifier: AGPL-3.0 -import { User } from "~/models/user"; +import { User, userPrefs } from "~/models/user"; import { AxiosInstance } from "axios"; - import { ApiActions, ProgressFn } from "~/services/api/api-actions"; + import { ApiActions } from "~/services/api/api-actions"; import * as uuid from "uuid/v4"; export const API_TOKEN_KEY = 'apiToken'; diff --cc src/store/navigation/navigation-action.ts index 80a7f213,50cfd88d..a3652726 --- a/src/store/navigation/navigation-action.ts +++ b/src/store/navigation/navigation-action.ts @@@ -68,4 -68,6 +68,8 @@@ export const navigateToRepositories = p export const navigateToSshKeys= push(Routes.SSH_KEYS); +export const navigateToMyAccount = push(Routes.MY_ACCOUNT); ++ + export const navigateToKeepServices = push(Routes.KEEP_SERVICES); + + export const navigateToComputeNodes = push(Routes.COMPUTE_NODES); diff --cc src/store/workbench/workbench-actions.ts index 091a8ccc,e3f96a9c..9d0140f3 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@@ -411,11 -412,16 +413,21 @@@ export const loadSshKeys = handleFirstT await dispatch(loadSshKeysPanel()); }); +export const loadMyAccount = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadMyAccountPanel()); + }); + + export const loadKeepServices = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadKeepServicesPanel()); + }); + + export const loadComputeNodes = handleFirstTimeLoad( + async (dispatch: Dispatch) => { + await dispatch(loadComputeNodesPanel()); + }); + const finishLoadingProject = (project: GroupContentsResource | string) => async (dispatch: Dispatch) => { const uuid = typeof project === 'string' ? project : project.uuid; diff --cc src/views-components/main-app-bar/account-menu.tsx index 0aedee90,f4232a12..ee726f3d --- a/src/views-components/main-app-bar/account-menu.tsx +++ b/src/views-components/main-app-bar/account-menu.tsx @@@ -12,7 -12,7 +12,7 @@@ import { logout } from '~/store/auth/au import { RootState } from "~/store/store"; import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions'; import { openRepositoriesPanel } from "~/store/repositories/repositories-actions"; - import { navigateToSshKeys, navigateToMyAccount } from '~/store/navigation/navigation-action'; -import { navigateToSshKeys, navigateToKeepServices, navigateToComputeNodes } from '~/store/navigation/navigation-action'; ++import { navigateToSshKeys, navigateToKeepServices, navigateToComputeNodes, navigateToMyAccount } from '~/store/navigation/navigation-action'; import { openVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions"; interface AccountMenuProps { @@@ -37,7 -37,9 +37,9 @@@ export const AccountMenu = connect(mapS dispatch(openRepositoriesPanel())}>Repositories dispatch(openCurrentTokenDialog)}>Current token dispatch(navigateToSshKeys)}>Ssh Keys + { user.isAdmin && dispatch(navigateToKeepServices)}>Keep Services } + { user.isAdmin && dispatch(navigateToComputeNodes)}>Compute Nodes } - My account + dispatch(navigateToMyAccount)}>My account dispatch(logout())}>Logout : null); diff --cc src/views/workbench/workbench.tsx index 2cff4317,92c2438b..5efffa19 --- a/src/views/workbench/workbench.tsx +++ b/src/views/workbench/workbench.tsx @@@ -132,7 -139,8 +140,9 @@@ export const WorkbenchPanel + + +