[ARVADOS-WORKBENCH2] updated: 1.3.0-75-g88c4b93

Git user git at public.curoverse.com
Mon Dec 10 05:04:36 EST 2018


Summary of changes:
 src/components/icon/icon.tsx                                 |  2 ++
 src/routes/route-change-handlers.ts                          |  7 +++++--
 src/routes/routes.ts                                         | 12 ++++++++----
 src/store/auth/auth-action.ts                                |  9 +++++++--
 src/store/navigation/navigation-action.ts                    |  4 +++-
 src/views-components/main-app-bar/account-menu.tsx           |  4 ++--
 src/views-components/main-app-bar/admin-menu.tsx             |  8 ++++----
 src/views-components/main-content-bar/main-content-bar.tsx   |  9 +++++----
 src/views/repositories-panel/repositories-panel.tsx          |  2 +-
 .../virtual-machine-panel/virtual-machine-user-panel.tsx     |  2 +-
 src/views/workbench/workbench.tsx                            |  3 ++-
 11 files changed, 40 insertions(+), 22 deletions(-)

       via  88c4b93c3e4f05afff419374277299d61ac61176 (commit)
      from  64c8c2628cbeadba5dce7e18e41028108142b766 (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 88c4b93c3e4f05afff419374277299d61ac61176
Author: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>
Date:   Mon Dec 10 11:04:15 2018 +0100

    ssh-keys-admin-user-panels
    
    Feature #14566
    
    Arvados-DCO-1.1-Signed-off-by: Pawel Kowalczyk <pawel.kowalczyk at contractors.roche.com>

diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx
index 8049686..c077f7a 100644
--- a/src/components/icon/icon.tsx
+++ b/src/components/icon/icon.tsx
@@ -7,6 +7,7 @@ import Add from '@material-ui/icons/Add';
 import ArrowBack from '@material-ui/icons/ArrowBack';
 import ArrowDropDown from '@material-ui/icons/ArrowDropDown';
 import BubbleChart from '@material-ui/icons/BubbleChart';
+import Build from '@material-ui/icons/Build';
 import Cached from '@material-ui/icons/Cached';
 import ChevronLeft from '@material-ui/icons/ChevronLeft';
 import CloudUpload from '@material-ui/icons/CloudUpload';
@@ -55,6 +56,7 @@ export type IconType = React.SFC<{ className?: string, style?: object }>;
 
 export const AddIcon: IconType = (props) => <Add {...props} />;
 export const AddFavoriteIcon: IconType = (props) => <StarBorder {...props} />;
+export const AdminMenuIcon: IconType = (props) => <Build {...props} />;
 export const AdvancedIcon: IconType = (props) => <SettingsApplications {...props} />;
 export const AttributesIcon: IconType = (props) => <ListAlt {...props} />;
 export const BackIcon: IconType = (props) => <ArrowBack {...props} />;
diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts
index e68c3c6..4ea0925 100644
--- a/src/routes/route-change-handlers.ts
+++ b/src/routes/route-change-handlers.ts
@@ -29,7 +29,8 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const virtualMachineUserMatch = Routes.matchUserVirtualMachineRoute(pathname);
     const virtualMachineAdminMatch = Routes.matchAdminVirtualMachineRoute(pathname);
     const workflowMatch = Routes.matchWorkflowRoute(pathname);
-    const sshKeysMatch = Routes.matchSshKeysRoute(pathname);
+    const sshKeysUserMatch = Routes.matchSshKeysUserRoute(pathname);
+    const sshKeysAdminMatch = Routes.matchSshKeysAdminRoute(pathname);
     const keepServicesMatch = Routes.matchKeepServicesRoute(pathname);
     const computeNodesMatch = Routes.matchComputeNodesRoute(pathname);
     const apiClientAuthorizationsMatch = Routes.matchApiClientAuthorizationsRoute(pathname);
@@ -64,7 +65,9 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(WorkbenchActions.loadVirtualMachines);
     } else if (repositoryMatch) {
         store.dispatch(WorkbenchActions.loadRepositories);
-    } else if (sshKeysMatch) {
+    } else if (sshKeysUserMatch) {
+        store.dispatch(WorkbenchActions.loadSshKeys);
+    } else if (sshKeysAdminMatch) {
         store.dispatch(WorkbenchActions.loadSshKeys);
     } else if (keepServicesMatch) {
         store.dispatch(WorkbenchActions.loadKeepServices);
diff --git a/src/routes/routes.ts b/src/routes/routes.ts
index a5a0af1..f447975 100644
--- a/src/routes/routes.ts
+++ b/src/routes/routes.ts
@@ -19,11 +19,12 @@ export const Routes = {
     REPOSITORIES: '/repositories',
     SHARED_WITH_ME: '/shared-with-me',
     RUN_PROCESS: '/run-process',
-    VIRTUAL_MACHINES_USER: '/virtual-machines-user',
     VIRTUAL_MACHINES_ADMIN: '/virtual-machines-admin',
+    VIRTUAL_MACHINES_USER: '/virtual-machines-user',
     WORKFLOWS: '/workflows',
     SEARCH_RESULTS: '/search-results',
-    SSH_KEYS: `/ssh-keys`,
+    SSH_KEYS_ADMIN: `/ssh-keys-admin`,
+    SSH_KEYS_USER: `/ssh-keys-user`,
     MY_ACCOUNT: '/my-account',
     KEEP_SERVICES: `/keep-services`,
     COMPUTE_NODES: `/nodes`,
@@ -95,8 +96,11 @@ export const matchAdminVirtualMachineRoute = (route: string) =>
 export const matchRepositoriesRoute = (route: string) =>
     matchPath<ResourceRouteParams>(route, { path: Routes.REPOSITORIES });
 
-export const matchSshKeysRoute = (route: string) =>
-    matchPath(route, { path: Routes.SSH_KEYS });
+export const matchSshKeysUserRoute = (route: string) =>
+    matchPath(route, { path: Routes.SSH_KEYS_USER });
+
+export const matchSshKeysAdminRoute = (route: string) =>
+    matchPath(route, { path: Routes.SSH_KEYS_ADMIN });
 
 export const matchMyAccountRoute = (route: string) =>
     matchPath(route, { path: Routes.MY_ACCOUNT });
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index 1e2620e..d72a3ec 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -14,6 +14,7 @@ import { ServiceRepository } from "~/services/services";
 import { getAuthorizedKeysServiceError, AuthorizedKeysServiceError } from '~/services/authorized-keys-service/authorized-keys-service';
 import { KeyType, SshKeyResource } from '~/models/ssh-key';
 import { User } from "~/models/user";
+import * as Routes from '~/routes/routes';
 
 export const authActions = unionize({
     SAVE_API_TOKEN: ofType<string>(),
@@ -153,9 +154,13 @@ export const createSshKey = (data: SshKeyCreateFormDialogData) =>
 export const loadSshKeysPanel = () =>
     async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
         try {
-            dispatch(setBreadcrumbs([{ label: 'SSH Keys'}]));
+            const userUuid = getState().auth.user!.uuid;
+            const { router } = getState();
+            const pathname = router.location ? router.location.pathname : '';
+            dispatch(setBreadcrumbs([{ label: 'SSH Keys' }]));
             const response = await services.authorizedKeysService.list();
-            dispatch(authActions.SET_SSH_KEYS(response.items));
+            const userSshKeys = response.items.find(it => it.ownerUuid === userUuid);
+            return Routes.matchSshKeysAdminRoute(pathname) ? dispatch(authActions.SET_SSH_KEYS(response.items)) : dispatch(authActions.SET_SSH_KEYS([userSshKeys!]));
         } catch (e) {
             return;
         }
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index d070fd0..66fba9c 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -68,7 +68,9 @@ export const navigateToAdminVirtualMachines = push(Routes.VIRTUAL_MACHINES_ADMIN
 
 export const navigateToRepositories = push(Routes.REPOSITORIES);
 
-export const navigateToSshKeys= push(Routes.SSH_KEYS);
+export const navigateToSshKeysAdmin= push(Routes.SSH_KEYS_ADMIN);
+
+export const navigateToSshKeysUser= push(Routes.SSH_KEYS_USER);
 
 export const navigateToMyAccount = push(Routes.MY_ACCOUNT);
 
diff --git a/src/views-components/main-app-bar/account-menu.tsx b/src/views-components/main-app-bar/account-menu.tsx
index 31a28ec..1609aaf 100644
--- a/src/views-components/main-app-bar/account-menu.tsx
+++ b/src/views-components/main-app-bar/account-menu.tsx
@@ -12,7 +12,7 @@ import { logout } from '~/store/auth/auth-action';
 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 { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action';
 import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
 
 interface AccountMenuProps {
@@ -36,7 +36,7 @@ export const AccountMenu = connect(mapStateToProps)(
                 <MenuItem onClick={() => dispatch(openUserVirtualMachines())}>Virtual Machines</MenuItem>
                 {!user.isAdmin && <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>}
                 <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
-                <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToSshKeysUser)}>Ssh Keys</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToMyAccount)}>My account</MenuItem>
                 <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
diff --git a/src/views-components/main-app-bar/admin-menu.tsx b/src/views-components/main-app-bar/admin-menu.tsx
index f754c85..8185f47 100644
--- a/src/views-components/main-app-bar/admin-menu.tsx
+++ b/src/views-components/main-app-bar/admin-menu.tsx
@@ -6,13 +6,13 @@ 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 { ShareMeIcon } from "~/components/icon/icon";
+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 { 
-    navigateToSshKeys, navigateToKeepServices, navigateToComputeNodes,
+    navigateToSshKeysAdmin, navigateToKeepServices, navigateToComputeNodes,
     navigateToApiClientAuthorizations
 } from '~/store/navigation/navigation-action';
 import { openAdminVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
@@ -30,12 +30,12 @@ export const AdminMenu = connect(mapStateToProps)(
     ({ user, dispatch }: AdminMenuProps & DispatchProp<any>) =>
         user
             ? <DropdownMenu
-                icon={<ShareMeIcon />}
+                icon={<AdminMenuIcon />}
                 id="admin-menu"
                 title="Admin Panel">
                 <MenuItem onClick={() => dispatch(openRepositoriesPanel())}>Repositories</MenuItem>
                 <MenuItem onClick={() => dispatch(openAdminVirtualMachines())}>Virtual Machines</MenuItem>
-                <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToSshKeysAdmin)}>Ssh Keys</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToApiClientAuthorizations)}>Api Tokens</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToUsers)}>Users</MenuItem>
                 <MenuItem onClick={() => dispatch(navigateToComputeNodes)}>Compute Nodes</MenuItem>
diff --git a/src/views-components/main-content-bar/main-content-bar.tsx b/src/views-components/main-content-bar/main-content-bar.tsx
index 944f135..9259219 100644
--- a/src/views-components/main-content-bar/main-content-bar.tsx
+++ b/src/views-components/main-content-bar/main-content-bar.tsx
@@ -19,10 +19,11 @@ interface MainContentBarProps {
 const isButtonVisible = ({ router }: RootState) => {
     const pathname = router.location ? router.location.pathname : '';
     return !Routes.matchWorkflowRoute(pathname) && !Routes.matchUserVirtualMachineRoute(pathname) &&
-        !Routes.matchAdminVirtualMachineRoute(pathname) && !Routes.matchRepositoriesRoute(pathname) && 
-        !Routes.matchSshKeysRoute(pathname) && !Routes.matchKeepServicesRoute(pathname) && 
-        !Routes.matchComputeNodesRoute(pathname) && !Routes.matchApiClientAuthorizationsRoute(pathname) && 
-        !Routes.matchUsersRoute(pathname) && !Routes.matchMyAccountRoute(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.matchMyAccountRoute(pathname);
 };
 
 export const MainContentBar = connect((state: RootState) => ({
diff --git a/src/views/repositories-panel/repositories-panel.tsx b/src/views/repositories-panel/repositories-panel.tsx
index c7016f6..62e91b5 100644
--- a/src/views/repositories-panel/repositories-panel.tsx
+++ b/src/views/repositories-panel/repositories-panel.tsx
@@ -103,7 +103,7 @@ export const RepositoriesPanel = compose(
                                 <Grid item xs={8}>
                                     <Typography variant="body2">
                                         When you are using an Arvados virtual machine, you should clone the https:// URLs. This will authenticate automatically using your API token. <br />
-                                        In order to clone git repositories using SSH, <Link to={Routes.SSH_KEYS} className={classes.link}>add an SSH key to your account</Link> and clone the git@ URLs.
+                                        In order to clone git repositories using SSH, <Link to={Routes.SSH_KEYS_USER} className={classes.link}>add an SSH key to your account</Link> and clone the git@ URLs.
                                     </Typography>
                                 </Grid>
                                 <Grid item xs={4} className={classes.button}>
diff --git a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
index 1756305..fbb1f23 100644
--- a/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
+++ b/src/views/virtual-machine-panel/virtual-machine-user-panel.tsx
@@ -187,7 +187,7 @@ const CardSSHSection = (props: VirtualMachineProps) =>
         <Card>
             <CardContent>
                 <Typography variant="body2">
-                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS} className={props.classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
+                    In order to access virtual machines using SSH, <Link to={Routes.SSH_KEYS_USER} className={props.classes.link}>add an SSH key to your account</Link> and add a section like this to your SSH configuration file ( ~/.ssh/config):
                 </Typography>
                 <DefaultCodeSnippet
                     className={props.classes.codeSnippet}
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index d483236..0e9c5d0 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -148,7 +148,8 @@ export const WorkbenchPanel =
                                 <Route path={Routes.VIRTUAL_MACHINES_USER} component={VirtualMachineUserPanel} />
                                 <Route path={Routes.VIRTUAL_MACHINES_ADMIN} component={VirtualMachineAdminPanel} />
                                 <Route path={Routes.REPOSITORIES} component={RepositoriesPanel} />
-                                <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
+                                <Route path={Routes.SSH_KEYS_USER} component={SshKeyPanel} />
+                                <Route path={Routes.SSH_KEYS_ADMIN} component={SshKeyPanel} />
                                 <Route path={Routes.KEEP_SERVICES} component={KeepServicePanel} />
                                 <Route path={Routes.USERS} component={UserPanel} />
                                 <Route path={Routes.COMPUTE_NODES} component={ComputeNodePanel} />

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list