21720:
[arvados.git] / services / workbench2 / src / views-components / virtual-machines-dialog / remove-login-dialog.tsx
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { Dispatch, compose } from 'redux';
6 import { connect } from "react-redux";
7 import { ConfirmationDialog } from "components/confirmation-dialog/confirmation-dialog";
8 import { withDialog, WithDialogProps } from "store/dialog/with-dialog";
9 import { VIRTUAL_MACHINE_REMOVE_LOGIN_DIALOG, removeVirtualMachineLogin, loadVirtualMachinesAdminData } from 'store/virtual-machines/virtual-machines-actions';
10
11 const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
12     onConfirm: () => {
13         props.closeDialog();
14         dispatch<any>(removeVirtualMachineLogin(props.data.uuid));
15         dispatch<any>(loadVirtualMachinesAdminData());
16     }
17 });
18
19 export const RemoveVirtualMachineLoginDialog = compose(
20     withDialog(VIRTUAL_MACHINE_REMOVE_LOGIN_DIALOG),
21     connect(null, mapDispatchToProps)
22 )(ConfirmationDialog);