-export const openRemoveProcessDialog = (uuid: string) =>
- (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
- dispatch(dialogActions.OPEN_DIALOG({
- id: REMOVE_PROCESS_DIALOG,
- data: {
- title: 'Remove process permanently',
- text: 'Are you sure you want to remove this process?',
- confirmButtonLabel: 'Remove',
- uuid
- }
- }));
+export const openRemoveProcessDialog =
+ (resource: ContextMenuResource, numOfProcesses: Number) => (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => {
+ const confirmationText =
+ numOfProcesses === 1
+ ? "Are you sure you want to remove this process?"
+ : `Are you sure you want to remove these ${numOfProcesses} processes?`;
+ const titleText = numOfProcesses === 1 ? "Remove process permanently" : "Remove processes permanently";
+
+ dispatch(
+ dialogActions.OPEN_DIALOG({
+ id: REMOVE_PROCESS_DIALOG,
+ data: {
+ title: titleText,
+ text: confirmationText,
+ confirmButtonLabel: "Remove",
+ uuid: resource.uuid,
+ resource,
+ },
+ })
+ );