X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/62ff5a943865229c1630c66366f824511048ce63..d87ff106a9f51defe5aafab2ad23dc1dee267b29:/src/views/ssh-key-panel/ssh-key-panel.tsx diff --git a/src/views/ssh-key-panel/ssh-key-panel.tsx b/src/views/ssh-key-panel/ssh-key-panel.tsx index f600677d..24ca3468 100644 --- a/src/views/ssh-key-panel/ssh-key-panel.tsx +++ b/src/views/ssh-key-panel/ssh-key-panel.tsx @@ -2,22 +2,34 @@ // // SPDX-License-Identifier: AGPL-3.0 -import { RootState } from '~/store/store'; +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'; +import { openSshKeyCreateDialog, openPublicKeyDialog } from 'store/auth/auth-action-ssh'; +import { openSshKeyContextMenu } from 'store/context-menu/context-menu-actions'; +import { SshKeyPanelRoot, SshKeyPanelRootDataProps, SshKeyPanelRootActionProps } from 'views/ssh-key-panel/ssh-key-panel-root'; const mapStateToProps = (state: RootState): SshKeyPanelRootDataProps => { + const sshKeys = state.auth.sshKeys.filter((key) => { + return key.authorizedUserUuid === (state.auth.user ? state.auth.user.uuid : null); + }); + return { - sshKeys: state.auth.sshKeys + sshKeys: sshKeys, + hasKeys: sshKeys!.length > 0 }; }; const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => ({ - onClick: () => { - dispatch(openSshKeyCreateDialog()); + openSshKeyCreateDialog: () => { + dispatch(openSshKeyCreateDialog()); + }, + openRowOptions: (event, sshKey) => { + dispatch(openSshKeyContextMenu(event, sshKey)); + }, + openPublicKeyDialog: (name: string, publicKey: string) => { + dispatch(openPublicKeyDialog(name, publicKey)); } }); -export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot); \ No newline at end of file +export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);