Merge branch 'master' into 14452-my-account
authorPawel Kromplewski <pawel.kromplewski@contractors.roche.com>
Wed, 5 Dec 2018 15:13:43 +0000 (16:13 +0100)
committerPawel Kromplewski <pawel.kromplewski@contractors.roche.com>
Wed, 5 Dec 2018 15:13:43 +0000 (16:13 +0100)
refs #14452

Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski@contractors.roche.com>

1  2 
src/routes/route-change-handlers.ts
src/routes/routes.ts
src/services/auth-service/auth-service.ts
src/store/auth/auth-action.ts
src/store/navigation/navigation-action.ts
src/store/workbench/workbench-actions.ts
src/views-components/main-app-bar/account-menu.tsx
src/views/workbench/workbench.tsx

index 400866e3e0183945cbf9656d17f155050377a800,f2304acaa77d2b8d0b69789cafa93626446b47e2..68de3107f1a82bb219fb49e883c27682c486902f
@@@ -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);
      }
  };
index a27b4274c707002a57b5a358d5aecbb9e03c6385,8f8fa06bd0379232d6da87ea6a47dad5673b811d..71d920ab3e4d984dcf126a5aaf6b439431dde9d7
@@@ -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 });
index 6faaf99ee7a37109a93021cd9cafeb31c4fa57a3,98c0321598090b11002375823fba7ffa1a374aee..8c2ad5caf3065c7d1779c8eae13b01b934b95581
@@@ -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';
Simple merge
index 80a7f2136eee707a5c87e320d9b74722a4e1ff20,50cfd88d326e8fe97a4610b6b27b6ab842a8a092..a3652726f1d2dfda5b51d8c1f5200ebf1bbd6b71
@@@ -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);
index 091a8ccc7c9583c41d97bd4067816eadb491528e,e3f96a9c07de620385640dd43445ca566c276f8b..9d0140f33ca8eb736cea4d798d970b7b2c7181b8
@@@ -411,11 -412,16 +413,21 @@@ export const loadSshKeys = handleFirstT
          await dispatch(loadSshKeysPanel());
      });
  
 +export const loadMyAccount = handleFirstTimeLoad(
 +    async (dispatch: Dispatch<any>) => {
 +        await dispatch(loadMyAccountPanel());
 +    });
 +
+ export const loadKeepServices = handleFirstTimeLoad(
+     async (dispatch: Dispatch<any>) => {
+         await dispatch(loadKeepServicesPanel());
+     });
+ export const loadComputeNodes = handleFirstTimeLoad(
+     async (dispatch: Dispatch<any>) => {
+         await dispatch(loadComputeNodesPanel());
+     });
  const finishLoadingProject = (project: GroupContentsResource | string) =>
      async (dispatch: Dispatch<any>) => {
          const uuid = typeof project === 'string' ? project : project.uuid;
index 0aedee9001c4bde86a49950502e3622feae5b624,f4232a129dd3c07b11d64d88f661eab40b79ab9c..ee726f3d75ec5a603acbf80c0708be9085b59316
@@@ -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
                  <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
                  <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
                  <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
 -                <MenuItem>My account</MenuItem>
+                 { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToKeepServices)}>Keep Services</MenuItem> }
+                 { user.isAdmin && <MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem> }
 +                <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
                  <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
              </DropdownMenu>
              : null);
index 2cff4317e5576470c44e22ff910a043302a4aa3f,92c2438b49f92c3d16bcf741713d76e6972d8643..5efffa19ac26b705233cd24c3fb4e08578a6c32f
@@@ -132,7 -139,8 +140,9 @@@ export const WorkbenchPanel 
                                  <Route path={Routes.VIRTUAL_MACHINES} component={VirtualMachinePanel} />
                                  <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
                                  <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
+                                 <Route path={Routes.KEEP_SERVICES} component={KeepServicePanel} />
+                                 <Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />
 +                                <Route path={Routes.MY_ACCOUNT} component={MyAccountPanel} />
                              </Switch>
                          </Grid>
                      </Grid>