export const openRemoveManyProcessesDialog = (list: Array<string>) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(
dialogActions.OPEN_DIALOG({
- id: REMOVE_PROCESS_DIALOG,
+ id: REMOVE_MANY_PROCESSES_DIALOG,
data: {
title: 'Remove processes permanently',
text: `Are you sure you want to remove all ${list.length} processes?`,
};
export const REMOVE_PROCESS_DIALOG = 'removeProcessDialog';
+export const REMOVE_MANY_PROCESSES_DIALOG = 'removeManyProcessesDialog';
export const removeProcessPermanently = (uuid: string) => async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
dispatch(snackbarActions.OPEN_SNACKBAR({ message: 'Removing ...', kind: SnackbarKind.INFO }));
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';
+import { removeProcessPermanently, REMOVE_MANY_PROCESSES_DIALOG } from 'store/processes/processes-actions';
const mapDispatchToProps = (dispatch: Dispatch, props: WithDialogProps<any>) => ({
onConfirm: () => {
+ console.log(props.data.list);
props.closeDialog();
- dispatch<any>(removeProcessPermanently(props.data.uuid));
+ props.data.list.forEach((uuid: string) => dispatch<any>(removeProcessPermanently(uuid)));
},
});
-export const RemoveManyProcessesDialog = compose(withDialog(REMOVE_PROCESS_DIALOG), connect(null, mapDispatchToProps))(ConfirmationDialog);
+export const RemoveManyProcessesDialog = compose(withDialog(REMOVE_MANY_PROCESSES_DIALOG), connect(null, mapDispatchToProps))(ConfirmationDialog);