1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
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';
12 const mapStateToProps = (state: RootState): SshKeyPanelRootDataProps => {
14 sshKeys: state.auth.sshKeys,
15 hasKeys: state.auth.sshKeys!.length > 0
19 const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => ({
20 openSshKeyCreateDialog: () => {
21 dispatch<any>(openSshKeyCreateDialog());
23 openRowOptions: (event, sshKey) => {
24 dispatch<any>(openSshKeyContextMenu(event, sshKey));
26 openPublicKeyDialog: (name: string, publicKey: string) => {
27 dispatch<any>(openPublicKeyDialog(name, publicKey));
31 export const SshKeyPanel = connect(mapStateToProps, mapDispatchToProps)(SshKeyPanelRoot);