From 42db83a0075f9704dcbfb2cd29821c97ff0fe34b Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Wed, 21 Nov 2018 10:27:11 +0100 Subject: [PATCH] remove SshKey interface and change object type Feature #14479_ssh_keys Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- src/models/ssh-key.ts | 8 -------- src/store/auth/auth-action.ts | 6 +++--- src/store/auth/auth-reducer.ts | 8 ++++---- src/views/ssh-key-panel/ssh-key-panel-root.tsx | 4 ++-- 4 files changed, 9 insertions(+), 17 deletions(-) diff --git a/src/models/ssh-key.ts b/src/models/ssh-key.ts index 76d6ffd9..8c2a3fda 100644 --- a/src/models/ssh-key.ts +++ b/src/models/ssh-key.ts @@ -4,14 +4,6 @@ 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; diff --git a/src/store/auth/auth-action.ts b/src/store/auth/auth-action.ts index 64ee7196..1a4ba0c4 100644 --- a/src/store/auth/auth-action.ts +++ b/src/store/auth/auth-action.ts @@ -12,7 +12,7 @@ import { getCommonResourceServiceError, CommonResourceServiceError } from '~/ser 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 { SshKeyCreateFormDialogData, KeyType, SshKeyResource } from '~/models/ssh-key'; import { setBreadcrumbs } from '../breadcrumbs/breadcrumbs-actions'; export const authActions = unionize({ @@ -22,8 +22,8 @@ export const authActions = unionize({ INIT: ofType<{ user: User, token: string }>(), USER_DETAILS_REQUEST: {}, USER_DETAILS_SUCCESS: ofType(), - SET_SSH_KEYS: ofType(), - ADD_SSH_KEY: ofType() + SET_SSH_KEYS: ofType(), + ADD_SSH_KEY: ofType() }); export const SSH_KEY_CREATE_FORM_NAME = 'sshKeyCreateFormName'; diff --git a/src/store/auth/auth-reducer.ts b/src/store/auth/auth-reducer.ts index 8a30a2a6..8f234dad 100644 --- a/src/store/auth/auth-reducer.ts +++ b/src/store/auth/auth-reducer.ts @@ -5,12 +5,12 @@ import { authActions, AuthAction } from "./auth-action"; import { User } from "~/models/user"; import { ServiceRepository } from "~/services/services"; -import { SshKey } from '~/models/ssh-key'; +import { SshKeyResource } from '~/models/ssh-key'; export interface AuthState { user?: User; apiToken?: string; - sshKeys?: SshKey[]; + sshKeys?: SshKeyResource[]; } const initialState: AuthState = { @@ -36,10 +36,10 @@ export const authReducer = (services: ServiceRepository) => (state: AuthState = USER_DETAILS_SUCCESS: (user: User) => { return {...state, user}; }, - SET_SSH_KEYS: (sshKeys: SshKey[]) => { + SET_SSH_KEYS: (sshKeys: SshKeyResource[]) => { return {...state, sshKeys}; }, - ADD_SSH_KEY: (sshKey: SshKey) => { + ADD_SSH_KEY: (sshKey: SshKeyResource) => { return { ...state, sshKeys: state.sshKeys!.concat(sshKey) }; }, default: () => state diff --git a/src/views/ssh-key-panel/ssh-key-panel-root.tsx b/src/views/ssh-key-panel/ssh-key-panel-root.tsx index 90602de0..f752228f 100644 --- a/src/views/ssh-key-panel/ssh-key-panel-root.tsx +++ b/src/views/ssh-key-panel/ssh-key-panel-root.tsx @@ -5,7 +5,7 @@ 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'; +import { SshKeyResource } from '~/models/ssh-key'; type CssRules = 'root' | 'link'; @@ -26,7 +26,7 @@ export interface SshKeyPanelRootActionProps { } export interface SshKeyPanelRootDataProps { - sshKeys?: SshKey[]; + sshKeys?: SshKeyResource[]; } type SshKeyPanelRootProps = SshKeyPanelRootDataProps & SshKeyPanelRootActionProps & WithStyles; -- 2.30.2