Add ssh keys panel
authorJanicki Artur <artur.janicki@contractors.roche.com>
Wed, 21 Nov 2018 09:10:52 +0000 (10:10 +0100)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Wed, 21 Nov 2018 09:10:52 +0000 (10:10 +0100)
Feature #14479_ssh_keys

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

19 files changed:
src/models/ssh-key.ts [new file with mode: 0644]
src/routes/route-change-handlers.ts
src/routes/routes.ts
src/services/authorized-keys-service/authorized-keys-service.ts [new file with mode: 0644]
src/services/common-service/common-resource-service.ts
src/services/services.ts
src/store/auth/auth-action.ts
src/store/auth/auth-reducer.ts
src/store/navigation/navigation-action.ts
src/store/workbench/workbench-actions.ts
src/validators/is-rsa-key.tsx [new file with mode: 0644]
src/validators/validators.tsx
src/views-components/dialog-create/dialog-ssh-key-create.tsx [new file with mode: 0644]
src/views-components/dialog-forms/create-ssh-key-dialog.ts [new file with mode: 0644]
src/views-components/form-fields/ssh-key-form-fields.tsx [new file with mode: 0644]
src/views-components/main-app-bar/account-menu.tsx
src/views/ssh-key-panel/ssh-key-panel-root.tsx [new file with mode: 0644]
src/views/ssh-key-panel/ssh-key-panel.tsx [new file with mode: 0644]
src/views/workbench/workbench.tsx

diff --git a/src/models/ssh-key.ts b/src/models/ssh-key.ts
new file mode 100644 (file)
index 0000000..76d6ffd
--- /dev/null
@@ -0,0 +1,30 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { Resource } from '~/models/resource';
+
+export interface SshKey {
+    name: string;
+    keyType: KeyType;
+    authorizedUserUuid: string;
+    publicKey: string;
+    expiresAt: string;
+}
+
+export interface SshKeyCreateFormDialogData {
+    publicKey: string;
+    name: string;
+}
+
+export enum KeyType {
+    SSH = 'SSH'
+}
+
+export interface SshKeyResource extends Resource {
+    name: string;
+    keyType: KeyType;
+    authorizedUserUuid: string;
+    publicKey: string;
+    expiresAt: string;
+}
\ No newline at end of file
index ef9e9ebcef15a01c271e7e6461b348f4e4b8237c..fb6f5e2022d07d2febdf49e4b64d7c5f10a63ed2 100644 (file)
@@ -4,8 +4,8 @@
 
 import { History, Location } from 'history';
 import { RootStore } from '~/store/store';
-import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute } from './routes';
-import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog } from '~/store/workbench/workbench-actions';
+import { matchProcessRoute, matchProcessLogRoute, matchProjectRoute, matchCollectionRoute, matchFavoritesRoute, matchTrashRoute, matchRootRoute, matchSharedWithMeRoute, matchRunProcessRoute, matchWorkflowRoute, matchSearchResultsRoute, matchSshKeysRoute } from './routes';
+import { loadProject, loadCollection, loadFavorites, loadTrash, loadProcess, loadProcessLog, loadSshKeys } from '~/store/workbench/workbench-actions';
 import { navigateToRootProject } from '~/store/navigation/navigation-action';
 import { loadSharedWithMe, loadRunProcess, loadWorkflow, loadSearchResults } from '~//store/workbench/workbench-actions';
 
@@ -27,6 +27,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
     const sharedWithMeMatch = matchSharedWithMeRoute(pathname);
     const runProcessMatch = matchRunProcessRoute(pathname);
     const workflowMatch = matchWorkflowRoute(pathname);
+    const sshKeysMatch = matchSshKeysRoute(pathname);
 
     if (projectMatch) {
         store.dispatch(loadProject(projectMatch.params.id));
@@ -50,5 +51,7 @@ const handleLocationChange = (store: RootStore) => ({ pathname }: Location) => {
         store.dispatch(loadWorkflow);
     } else if (searchResultsMatch) {
         store.dispatch(loadSearchResults);
+    } else if (sshKeysMatch) {
+        store.dispatch(loadSshKeys);
     }
 };
index e5f3493539e3cbaae317e95fc1b38d3f89cb032f..b00b9fe23f66d43e2d82f1acd2d94ee4049e8cda 100644 (file)
@@ -19,7 +19,8 @@ export const Routes = {
     SHARED_WITH_ME: '/shared-with-me',
     RUN_PROCESS: '/run-process',
     WORKFLOWS: '/workflows',
-    SEARCH_RESULTS: '/search-results'
+    SEARCH_RESULTS: '/search-results',
+    SSH_KEYS: `/ssh-keys`
 };
 
 export const getResourceUrl = (uuid: string) => {
@@ -76,3 +77,6 @@ export const matchWorkflowRoute = (route: string) =>
 
 export const matchSearchResultsRoute = (route: string) =>
     matchPath<ResourceRouteParams>(route, { path: Routes.SEARCH_RESULTS });
+
+export const matchSshKeysRoute = (route: string) =>
+    matchPath(route, { path: Routes.SSH_KEYS });
\ No newline at end of file
diff --git a/src/services/authorized-keys-service/authorized-keys-service.ts b/src/services/authorized-keys-service/authorized-keys-service.ts
new file mode 100644 (file)
index 0000000..b51704a
--- /dev/null
@@ -0,0 +1,14 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { AxiosInstance } from "axios";
+import { SshKeyResource } from '~/models/ssh-key';
+import { CommonResourceService } from "~/services/common-service/common-resource-service";
+import { ApiActions } from "~/services/api/api-actions";
+
+export class AuthorizedKeysService extends CommonResourceService<SshKeyResource> {
+    constructor(serverApi: AxiosInstance, actions: ApiActions) {
+        super(serverApi, "authorized_keys", actions);
+    }
+}
\ No newline at end of file
index 70c1df0e2bc5e665a3c62c05b39b7a50a6705c62..02a3379dc2dde5369d31998e275105a11e7b8196 100644 (file)
@@ -35,6 +35,8 @@ export enum CommonResourceServiceError {
     UNIQUE_VIOLATION = 'UniqueViolation',
     OWNERSHIP_CYCLE = 'OwnershipCycle',
     MODIFYING_CONTAINER_REQUEST_FINAL_STATE = 'ModifyingContainerRequestFinalState',
+    UNIQUE_PUBLIC_KEY = 'UniquePublicKey',
+    INVALID_PUBLIC_KEY = 'InvalidPublicKey',
     UNKNOWN = 'Unknown',
     NONE = 'None'
 }
@@ -150,6 +152,10 @@ export const getCommonResourceServiceError = (errorResponse: any) => {
                 return CommonResourceServiceError.OWNERSHIP_CYCLE;
             case /Mounts cannot be modified in state 'Final'/.test(error):
                 return CommonResourceServiceError.MODIFYING_CONTAINER_REQUEST_FINAL_STATE;
+            case /Public key does not appear to be a valid ssh-rsa or dsa public key/.test(error):
+                return CommonResourceServiceError.INVALID_PUBLIC_KEY;
+            case /Public key already exists in the database, use a different key./.test(error):
+                return CommonResourceServiceError.UNIQUE_PUBLIC_KEY;
             default:
                 return CommonResourceServiceError.UNKNOWN;
         }
index 5adf10b387891b0fecd1efddcfbdade21badb4e5..aeeb9556cb5de0786a37f3b916e406775cb76ff0 100644 (file)
@@ -24,6 +24,7 @@ import { ApiActions } from "~/services/api/api-actions";
 import { WorkflowService } from "~/services/workflow-service/workflow-service";
 import { SearchService } from '~/services/search-service/search-service';
 import { PermissionService } from "~/services/permission-service/permission-service";
+import { AuthorizedKeysService } from '~/services/authorized-keys-service/authorized-keys-service';
 
 export type ServiceRepository = ReturnType<typeof createServices>;
 
@@ -34,6 +35,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
     const webdavClient = new WebDAV();
     webdavClient.defaults.baseURL = config.keepWebServiceUrl;
 
+    const authorizedKeysService = new AuthorizedKeysService(apiClient, actions);
     const containerRequestService = new ContainerRequestService(apiClient, actions);
     const containerService = new ContainerService(apiClient, actions);
     const groupsService = new GroupsService(apiClient, actions);
@@ -57,6 +59,7 @@ export const createServices = (config: Config, actions: ApiActions) => {
         ancestorsService,
         apiClient,
         authService,
+        authorizedKeysService,
         collectionFilesService,
         collectionService,
         containerRequestService,
index ac2e0b7e2f68c6e699e294710d582582701b5fc2..64ee7196cba0597e8724ef80f1677ce35ad4350e 100644 (file)
@@ -4,10 +4,16 @@
 
 import { ofType, unionize, UnionOf } from '~/common/unionize';
 import { Dispatch } from "redux";
+import { reset, stopSubmit } from 'redux-form';
 import { User } from "~/models/user";
 import { RootState } from "../store";
 import { ServiceRepository } from "~/services/services";
+import { getCommonResourceServiceError, CommonResourceServiceError } from '~/services/common-service/common-resource-service';
 import { AxiosInstance } from "axios";
+import { snackbarActions } from '~/store/snackbar/snackbar-actions';
+import { dialogActions } from '~/store/dialog/dialog-actions';
+import { SshKeyCreateFormDialogData, SshKey, KeyType } from '~/models/ssh-key';
+import { setBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions';
 
 export const authActions = unionize({
     SAVE_API_TOKEN: ofType<string>(),
@@ -15,9 +21,13 @@ export const authActions = unionize({
     LOGOUT: {},
     INIT: ofType<{ user: User, token: string }>(),
     USER_DETAILS_REQUEST: {},
-    USER_DETAILS_SUCCESS: ofType<User>()
+    USER_DETAILS_SUCCESS: ofType<User>(),
+    SET_SSH_KEYS: ofType<SshKey[]>(),
+    ADD_SSH_KEY: ofType<SshKey>()
 });
 
+export const SSH_KEY_CREATE_FORM_NAME = 'sshKeyCreateFormName';
+
 function setAuthorizationHeader(services: ServiceRepository, token: string) {
     services.apiClient.defaults.headers.common = {
         Authorization: `OAuth2 ${token}`
@@ -70,4 +80,46 @@ export const getUserDetails = () => (dispatch: Dispatch, getState: () => RootSta
     });
 };
 
+export const openSshKeyCreateDialog = () => dialogActions.OPEN_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME, data: {} });
+
+export const createSshKey = (data: SshKeyCreateFormDialogData) =>
+    async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            const userUuid = getState().auth.user!.uuid;
+            const { name, publicKey } = data;
+            const newSshKey = await services.authorizedKeysService.create({
+                name, 
+                publicKey,
+                keyType: KeyType.SSH,
+                authorizedUserUuid: userUuid
+            });
+            dispatch(dialogActions.CLOSE_DIALOG({ id: SSH_KEY_CREATE_FORM_NAME }));
+            dispatch(reset(SSH_KEY_CREATE_FORM_NAME));
+            dispatch(authActions.ADD_SSH_KEY(newSshKey));
+            dispatch(snackbarActions.OPEN_SNACKBAR({
+                message: "Public key has been successfully created.",
+                hideDuration: 2000
+            }));
+        } catch (e) {
+            const error = getCommonResourceServiceError(e);
+            if (error === CommonResourceServiceError.UNIQUE_PUBLIC_KEY) {
+                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key already exists.' }));
+            } else if (error === CommonResourceServiceError.INVALID_PUBLIC_KEY) {
+                dispatch(stopSubmit(SSH_KEY_CREATE_FORM_NAME, { publicKey: 'Public key is invalid' }));
+            }
+        }
+    };
+
+export const loadSshKeysPanel = () =>
+    async (dispatch: Dispatch<any>, getState: () => RootState, services: ServiceRepository) => {
+        try {
+            dispatch(setBreadcrumbs([{ label: 'SSH Keys'}]));
+            const response = await services.authorizedKeysService.list();
+            dispatch(authActions.SET_SSH_KEYS(response.items));
+        } catch (e) {
+            return;
+        }
+    };
+
+
 export type AuthAction = UnionOf<typeof authActions>;
index a4195322c867316ce201f8d03ea4c28bffd25825..8a30a2a6805f1548cbac4c113ac2a3a4c60822b9 100644 (file)
@@ -5,13 +5,21 @@
 import { authActions, AuthAction } from "./auth-action";
 import { User } from "~/models/user";
 import { ServiceRepository } from "~/services/services";
+import { SshKey } from '~/models/ssh-key';
 
 export interface AuthState {
     user?: User;
     apiToken?: string;
+    sshKeys?: SshKey[];
 }
 
-export const authReducer = (services: ServiceRepository) => (state: AuthState = {}, action: AuthAction) => {
+const initialState: AuthState = {
+    user: undefined,
+    apiToken: undefined,
+    sshKeys: []
+};
+
+export const authReducer = (services: ServiceRepository) => (state: AuthState = initialState, action: AuthAction) => {
     return authActions.match(action, {
         SAVE_API_TOKEN: (token: string) => {
             return {...state, apiToken: token};
@@ -28,6 +36,12 @@ export const authReducer = (services: ServiceRepository) => (state: AuthState =
         USER_DETAILS_SUCCESS: (user: User) => {
             return {...state, user};
         },
+        SET_SSH_KEYS: (sshKeys: SshKey[]) => {
+            return {...state, sshKeys};
+        },
+        ADD_SSH_KEY: (sshKey: SshKey) => {
+            return { ...state, sshKeys: state.sshKeys!.concat(sshKey) };
+        },
         default: () => state
     });
 };
index b63fc2cb290af38edb74be1da9e9beb28c3a5a2c..57967c7dda977f0d3feec3bb8424b43917eed4c4 100644 (file)
@@ -61,3 +61,5 @@ export const navigateToSharedWithMe = push(Routes.SHARED_WITH_ME);
 export const navigateToRunProcess = push(Routes.RUN_PROCESS);
 
 export const navigateToSearchResults = push(Routes.SEARCH_RESULTS);
+
+export const navigateToSshKeys= push(Routes.SSH_KEYS);
\ No newline at end of file
index aaf8f2665f9a1b07318c6a9d3179a0fbd3727d5d..5cc9ea348f5efbde93db27701d8385e88599dd44 100644 (file)
@@ -39,6 +39,7 @@ import { sharedWithMePanelActions } from '~/store/shared-with-me-panel/shared-wi
 import { loadSharedWithMePanel } from '../shared-with-me-panel/shared-with-me-panel-actions';
 import { CopyFormDialogData } from '~/store/copy-dialog/copy-dialog';
 import { loadWorkflowPanel, workflowPanelActions } from '~/store/workflow-panel/workflow-panel-actions';
+import { loadSshKeysPanel } from '~/store/auth/auth-action';
 import { workflowPanelColumns } from '~/views/workflow-panel/workflow-panel-view';
 import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions';
 import { getProgressIndicator } from '../progress-indicator/progress-indicator-reducer';
@@ -390,6 +391,11 @@ export const loadSearchResults = handleFirstTimeLoad(
         await dispatch(loadSearchResultsPanel());
     });
 
+export const loadSshKeys = handleFirstTimeLoad(
+    async (dispatch: Dispatch<any>) => {
+        await dispatch(loadSshKeysPanel());
+    });
+
 const finishLoadingProject = (project: GroupContentsResource | string) =>
     async (dispatch: Dispatch<any>) => {
         const uuid = typeof project === 'string' ? project : project.uuid;
diff --git a/src/validators/is-rsa-key.tsx b/src/validators/is-rsa-key.tsx
new file mode 100644 (file)
index 0000000..7620a80
--- /dev/null
@@ -0,0 +1,10 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+
+const ERROR_MESSAGE = 'Public key is invalid';
+
+export const isRsaKey = (value: any) => {
+    return value.match(/ssh-rsa AAAA[0-9A-Za-z+/]+[=]{0,3} ([^@]+@[^@]+)/i) ? undefined : ERROR_MESSAGE;
+};
index edc472657eb3178036fb0d8b3917dd0600e39ce5..1980ed802eb15ef57a64d04667e1ae7ede3fe2fe 100644 (file)
@@ -4,6 +4,7 @@
 
 import { require } from './require';
 import { maxLength } from './max-length';
+import { isRsaKey } from './is-rsa-key';
 
 export const TAG_KEY_VALIDATION = [require, maxLength(255)];
 export const TAG_VALUE_VALIDATION = [require, maxLength(255)];
@@ -19,4 +20,7 @@ export const COPY_FILE_VALIDATION = [require];
 
 export const MOVE_TO_VALIDATION = [require];
 
-export const PROCESS_NAME_VALIDATION = [require, maxLength(255)];
\ No newline at end of file
+export const PROCESS_NAME_VALIDATION = [require, maxLength(255)];
+
+export const SSH_KEY_PUBLIC_VALIDATION = [require, isRsaKey, maxLength(1024)];
+export const SSH_KEY_NAME_VALIDATION = [require, maxLength(255)];
\ No newline at end of file
diff --git a/src/views-components/dialog-create/dialog-ssh-key-create.tsx b/src/views-components/dialog-create/dialog-ssh-key-create.tsx
new file mode 100644 (file)
index 0000000..28c3a36
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { InjectedFormProps } from 'redux-form';
+import { WithDialogProps } from '~/store/dialog/with-dialog';
+import { FormDialog } from '~/components/form-dialog/form-dialog';
+import { SshKeyPublicField, SshKeyNameField } from '~/views-components/form-fields/ssh-key-form-fields';
+import { SshKeyCreateFormDialogData } from '~/models/ssh-key';
+
+type DialogSshKeyProps = WithDialogProps<{}> & InjectedFormProps<SshKeyCreateFormDialogData>;
+
+export const DialogSshKeyCreate = (props: DialogSshKeyProps) =>
+    <FormDialog
+        dialogTitle='Add new SSH key'
+        formFields={SshKeyAddFields}
+        submitLabel='Add new ssh key'
+        {...props}
+    />;
+
+const SshKeyAddFields = () => <span>
+    <SshKeyPublicField />
+    <SshKeyNameField />
+</span>;
diff --git a/src/views-components/dialog-forms/create-ssh-key-dialog.ts b/src/views-components/dialog-forms/create-ssh-key-dialog.ts
new file mode 100644 (file)
index 0000000..bc436d9
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { compose } from "redux";
+import { reduxForm } from 'redux-form';
+import { withDialog } from "~/store/dialog/with-dialog";
+import { SSH_KEY_CREATE_FORM_NAME, createSshKey } from '~/store/auth/auth-action';
+import { DialogSshKeyCreate } from '~/views-components/dialog-create/dialog-ssh-key-create';
+import { SshKeyCreateFormDialogData } from '~/models/ssh-key';
+
+export const CreateSshKeyDialog = compose(
+    withDialog(SSH_KEY_CREATE_FORM_NAME),
+    reduxForm<SshKeyCreateFormDialogData>({
+        form: SSH_KEY_CREATE_FORM_NAME,
+        onSubmit: (data, dispatch) => {
+            dispatch(createSshKey(data));
+        }
+    })
+)(DialogSshKeyCreate);
\ No newline at end of file
diff --git a/src/views-components/form-fields/ssh-key-form-fields.tsx b/src/views-components/form-fields/ssh-key-form-fields.tsx
new file mode 100644 (file)
index 0000000..8724e08
--- /dev/null
@@ -0,0 +1,25 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from "react";
+import { Field } from "redux-form";
+import { TextField } from "~/components/text-field/text-field";
+import { SSH_KEY_PUBLIC_VALIDATION, SSH_KEY_NAME_VALIDATION } from "~/validators/validators";
+
+export const SshKeyPublicField = () =>
+    <Field
+        name='publicKey'
+        component={TextField}
+        validate={SSH_KEY_PUBLIC_VALIDATION}
+        autoFocus={true}
+        label="Public Key" />;
+
+export const SshKeyNameField = () =>
+    <Field
+        name='name'
+        component={TextField}
+        validate={SSH_KEY_NAME_VALIDATION}
+        label="Name" />;
+
+
index fdd8123f280273a5e88984a368436a464f0eefac..ee863a29c6e37c2323b7992591720e174935d832 100644 (file)
@@ -8,9 +8,10 @@ import { User, getUserFullname } from "~/models/user";
 import { DropdownMenu } from "~/components/dropdown-menu/dropdown-menu";
 import { UserPanelIcon } from "~/components/icon/icon";
 import { DispatchProp, connect } from 'react-redux';
-import { logout } from "~/store/auth/auth-action";
+import { logout } from '~/store/auth/auth-action';
 import { RootState } from "~/store/store";
 import { openCurrentTokenDialog } from '../../store/current-token-dialog/current-token-dialog-actions';
+import { navigateToSshKeys } from '~/store/navigation/navigation-action';
 
 interface AccountMenuProps {
     user?: User;
@@ -31,6 +32,7 @@ export const AccountMenu = connect(mapStateToProps)(
                     {getUserFullname(user)}
                 </MenuItem>
                 <MenuItem onClick={() => dispatch(openCurrentTokenDialog)}>Current token</MenuItem>
+                <MenuItem onClick={() => dispatch(navigateToSshKeys)}>Ssh Keys</MenuItem>
                 <MenuItem>My account</MenuItem>
                 <MenuItem onClick={() => dispatch(logout())}>Logout</MenuItem>
             </DropdownMenu>
diff --git a/src/views/ssh-key-panel/ssh-key-panel-root.tsx b/src/views/ssh-key-panel/ssh-key-panel-root.tsx
new file mode 100644 (file)
index 0000000..90602de
--- /dev/null
@@ -0,0 +1,55 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import * as React from 'react';
+import { StyleRulesCallback, WithStyles, withStyles, Card, CardContent, Button, Typography } from '@material-ui/core';
+import { ArvadosTheme } from '~/common/custom-theme';
+import { SshKey } from '~/models/ssh-key';
+
+
+type CssRules = 'root' | 'link';
+
+const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
+    root: {
+       width: '100%'
+    },
+    link: {
+        color: theme.palette.primary.main,
+        textDecoration: 'none',
+        margin: '0px 4px'
+    }
+});
+
+export interface SshKeyPanelRootActionProps {
+    onClick: () => void;
+}
+
+export interface SshKeyPanelRootDataProps {
+    sshKeys?: SshKey[];
+}
+
+type SshKeyPanelRootProps = SshKeyPanelRootDataProps & SshKeyPanelRootActionProps & WithStyles<CssRules>;
+
+export const SshKeyPanelRoot = withStyles(styles)(
+    ({ classes, sshKeys, onClick }: SshKeyPanelRootProps) =>
+        <Card className={classes.root}>
+            <CardContent>
+                <Typography variant='body1' paragraph={true}>
+                    You have not yet set up an SSH public key for use with Arvados.
+                    <a href='https://doc.arvados.org/user/getting_started/ssh-access-unix.html' target='blank' className={classes.link}>
+                        Learn more.
+                    </a>
+                </Typography>
+                <Typography variant='body1' paragraph={true}>
+                    When you have an SSH key you would like to use, add it using button below.
+                </Typography>
+                <Button
+                    onClick={onClick}
+                    color="primary"
+                    variant="contained">
+                    Add New Ssh Key
+                </Button>
+            </CardContent>
+        </Card>
+    );
\ No newline at end of file
diff --git a/src/views/ssh-key-panel/ssh-key-panel.tsx b/src/views/ssh-key-panel/ssh-key-panel.tsx
new file mode 100644 (file)
index 0000000..f600677
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { RootState } from '~/store/store';
+import { Dispatch } from 'redux';
+import { connect } from 'react-redux';
+import { SshKeyPanelRoot, SshKeyPanelRootDataProps, SshKeyPanelRootActionProps } from '~/views/ssh-key-panel/ssh-key-panel-root';
+import { openSshKeyCreateDialog } from '~/store/auth/auth-action';
+
+const mapStateToProps = (state: RootState): SshKeyPanelRootDataProps => {
+    return {
+        sshKeys: state.auth.sshKeys
+    };
+};
+
+const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => ({
+    onClick: () => {
+        dispatch(openSshKeyCreateDialog());
+    }
+});
+
+export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);
\ No newline at end of file
index 8d1fb6700dc308c6709d2374299706f51e75adda..3a63ea3730b1e36116dc6ca647afdc1e18d2228a 100644 (file)
@@ -44,10 +44,12 @@ import { RunProcessPanel } from '~/views/run-process-panel/run-process-panel';
 import SplitterLayout from 'react-splitter-layout';
 import { WorkflowPanel } from '~/views/workflow-panel/workflow-panel';
 import { SearchResultsPanel } from '~/views/search-results-panel/search-results-panel';
+import { SshKeyPanel } from '~/views/ssh-key-panel/ssh-key-panel';
 import { SharingDialog } from '~/views-components/sharing-dialog/sharing-dialog';
 import { AdvancedTabDialog } from '~/views-components/advanced-tab-dialog/advanced-tab-dialog';
 import { ProcessInputDialog } from '~/views-components/process-input-dialog/process-input-dialog';
 import { ProjectPropertiesDialog } from '~/views-components/project-properties-dialog/project-properties-dialog';
+import { CreateSshKeyDialog } from '~/views-components/dialog-forms/create-ssh-key-dialog';
 
 type CssRules = 'root' | 'container' | 'splitter' | 'asidePanel' | 'contentWrapper' | 'content';
 
@@ -117,6 +119,7 @@ export const WorkbenchPanel =
                                 <Route path={Routes.RUN_PROCESS} component={RunProcessPanel} />
                                 <Route path={Routes.WORKFLOWS} component={WorkflowPanel} />
                                 <Route path={Routes.SEARCH_RESULTS} component={SearchResultsPanel} />
+                                <Route path={Routes.SSH_KEYS} component={SshKeyPanel} />
                             </Switch>
                         </Grid>
                     </Grid>
@@ -132,6 +135,7 @@ export const WorkbenchPanel =
             <CopyProcessDialog />
             <CreateCollectionDialog />
             <CreateProjectDialog />
+            <CreateSshKeyDialog />
             <CurrentTokenDialog />
             <FileRemoveDialog />
             <FilesUploadCollectionDialog />