15814: Now handles secret inputs properly.
[arvados.git] / services / workbench2 / src / views / ssh-key-panel / ssh-key-admin-panel.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { RootState } from 'store/store';
6 import { Dispatch } from 'redux';
7 import { connect } from 'react-redux';
8 import { openSshKeyCreateDialog, openPublicKeyDialog } from 'store/auth/auth-action-ssh';
9 import { openSshKeyContextMenu } from 'store/context-menu/context-menu-actions';
10 import { SshKeyPanelRoot, SshKeyPanelRootDataProps, SshKeyPanelRootActionProps } from 'views/ssh-key-panel/ssh-key-panel-root';
11
12 const mapStateToProps = (state: RootState): SshKeyPanelRootDataProps => {
13     return {
14         sshKeys: state.auth.sshKeys,
15         hasKeys: state.auth.sshKeys!.length > 0
16     };
17 };
18
19 const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => ({
20     openSshKeyCreateDialog: () => {
21         dispatch<any>(openSshKeyCreateDialog());
22     },
23     openRowOptions: (event, sshKey) => {
24         dispatch<any>(openSshKeyContextMenu(event, sshKey));
25     },
26     openPublicKeyDialog: (name: string, publicKey: string) => {
27         dispatch<any>(openPublicKeyDialog(name, publicKey));
28     }
29 });
30
31 export const SshKeyAdminPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);