[ARVADOS-WORKBENCH2] created: 1.2.0-914-g62ff5a9
Git user
git at public.curoverse.com
Wed Nov 21 04:11:14 EST 2018
at 62ff5a943865229c1630c66366f824511048ce63 (commit)
commit 62ff5a943865229c1630c66366f824511048ce63
Author: Janicki Artur <artur.janicki at contractors.roche.com>
Date: Wed Nov 21 10:10:52 2018 +0100
Add ssh keys panel
Feature #14479_ssh_keys
Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki at contractors.roche.com>
diff --git a/src/models/ssh-key.ts b/src/models/ssh-key.ts
new file mode 100644
index 0000000..76d6ffd
--- /dev/null
+++ b/src/models/ssh-key.ts
@@ -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
diff --git a/src/routes/route-change-handlers.ts b/src/routes/route-change-handlers.ts
index ef9e9eb..fb6f5e2 100644
--- a/src/routes/route-change-handlers.ts
+++ b/src/routes/route-change-handlers.ts
@@ -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);
}
};
diff --git a/src/routes/routes.ts b/src/routes/routes.ts
index e5f3493..b00b9fe 100644
--- a/src/routes/routes.ts
+++ b/src/routes/routes.ts
@@ -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
index 0000000..b51704a
--- /dev/null
+++ b/src/services/authorized-keys-service/authorized-keys-service.ts
@@ -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
diff --git a/src/services/common-service/common-resource-service.ts b/src/services/common-service/common-resource-service.ts
index 70c1df0..02a3379 100644
--- a/src/services/common-service/common-resource-service.ts
+++ b/src/services/common-service/common-resource-service.ts
@@ -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;
}
diff --git a/src/services/services.ts b/src/services/services.ts
index 5adf10b..aeeb955 100644
--- a/src/services/services.ts
+++ b/src/services/services.ts
@@ -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,
diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts
index ac2e0b7..64ee719 100644
--- a/src/store/auth/auth-action.ts
+++ b/src/store/auth/auth-action.ts
@@ -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>;
diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts
index a419532..8a30a2a 100644
--- a/src/store/auth/auth-reducer.ts
+++ b/src/store/auth/auth-reducer.ts
@@ -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
});
};
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index b63fc2c..57967c7 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -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
diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts
index aaf8f26..5cc9ea3 100644
--- a/src/store/workbench/workbench-actions.ts
+++ b/src/store/workbench/workbench-actions.ts
@@ -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
index 0000000..7620a80
--- /dev/null
+++ b/src/validators/is-rsa-key.tsx
@@ -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;
+};
diff --git a/src/validators/validators.tsx b/src/validators/validators.tsx
index edc4726..1980ed8 100644
--- a/src/validators/validators.tsx
+++ b/src/validators/validators.tsx
@@ -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
index 0000000..28c3a36
--- /dev/null
+++ b/src/views-components/dialog-create/dialog-ssh-key-create.tsx
@@ -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
index 0000000..bc436d9
--- /dev/null
+++ b/src/views-components/dialog-forms/create-ssh-key-dialog.ts
@@ -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
index 0000000..8724e08
--- /dev/null
+++ b/src/views-components/form-fields/ssh-key-form-fields.tsx
@@ -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" />;
+
+
diff --git a/src/views-components/main-app-bar/account-menu.tsx b/src/views-components/main-app-bar/account-menu.tsx
index fdd8123..ee863a2 100644
--- a/src/views-components/main-app-bar/account-menu.tsx
+++ b/src/views-components/main-app-bar/account-menu.tsx
@@ -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
index 0000000..90602de
--- /dev/null
+++ b/src/views/ssh-key-panel/ssh-key-panel-root.tsx
@@ -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
index 0000000..f600677
--- /dev/null
+++ b/src/views/ssh-key-panel/ssh-key-panel.tsx
@@ -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
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 8d1fb67..3a63ea3 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -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 />
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list