// Copyright (C) The Arvados Authors. All rights reserved.
//
// SPDX-License-Identifier: AGPL-3.0

import { Dispatch } from "redux";
import { connect } from "react-redux";
import { ConfirmationDialog } from "~/components/confirmation-dialog/confirmation-dialog";
import { withDialog, WithDialogProps } from "~/store/dialog/with-dialog";
import { removeProcessPermanently, REMOVE_PROCESS_DIALOG } from "~/store/processes/processes-actions";

 const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
    onConfirm: () => {
        props.closeDialog();
        dispatch<any>(removeProcessPermanently(props.data.uuid));
    }
});

 export const [RemoveProcessDialog] = [ConfirmationDialog]
    .map(connect(null, mapDispatchToProps) as any)
    .map(withDialog(REMOVE_PROCESS_DIALOG)); 