1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { Dispatch } from "redux";
6 import { connect } from "react-redux";
7 import { ConfirmationDialog } from "../../components/confirmation-dialog/confirmation-dialog";
8 import { withDialog } from "../../store/dialog/with-dialog";
9 import { dialogActions } from "../../store/dialog/dialog-actions";
10 import { snackbarActions } from "../../store/snackbar/snackbar-actions";
12 const MULTIPLE_FILES_REMOVE_DIALOG = 'multipleFilesRemoveDialog';
14 const mapDispatchToProps = (dispatch: Dispatch) => ({
16 // TODO: dispatch action that removes multiple files
17 dispatch(dialogActions.CLOSE_DIALOG({ id: MULTIPLE_FILES_REMOVE_DIALOG }));
18 dispatch(snackbarActions.OPEN_SNACKBAR({message: 'Removing files...', hideDuration: 2000}));
20 dispatch(snackbarActions.OPEN_SNACKBAR({message: 'Files removed.', hideDuration: 2000}));
25 export const openMultipleFilesRemoveDialog = () =>
26 dialogActions.OPEN_DIALOG({
27 id: MULTIPLE_FILES_REMOVE_DIALOG,
29 title: 'Removing files',
30 text: 'Are you sure you want to remove selected files?',
31 confirmButtonLabel: 'Remove'
35 export const [MultipleFilesRemoveDialog] = [ConfirmationDialog]
36 .map(withDialog(MULTIPLE_FILES_REMOVE_DIALOG))
37 .map(connect(undefined, mapDispatchToProps));