Merge branch 'master' into 14452-my-account
[arvados-workbench2.git] / src / views / ssh-key-panel / ssh-key-panel.tsx
index f600677d1bc152ffc1649723b017f658ee7beeae..4e800296d076fb3f368ac9d98959d3d00520a18b 100644 (file)
@@ -5,18 +5,26 @@
 import { RootState } from '~/store/store';
 import { Dispatch } from 'redux';
 import { connect } from 'react-redux';
+import { openSshKeyCreateDialog, openPublicKeyDialog } from '~/store/auth/auth-action';
+import { openSshKeyContextMenu } from '~/store/context-menu/context-menu-actions';
 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
+        sshKeys: state.auth.sshKeys,
+        hasKeys: state.auth.sshKeys!.length > 0
     };
 };
 
 const mapDispatchToProps = (dispatch: Dispatch): SshKeyPanelRootActionProps => ({
-    onClick: () => {
-        dispatch(openSshKeyCreateDialog());
+    openSshKeyCreateDialog: () => {
+        dispatch<any>(openSshKeyCreateDialog());
+    },
+    openRowOptions: (event, sshKey) => {
+        dispatch<any>(openSshKeyContextMenu(event, sshKey));
+    },
+    openPublicKeyDialog: (name: string, publicKey: string) => {
+        dispatch<any>(openPublicKeyDialog(name, publicKey));
     }
 });