+
+
+ {__(
+ 'This will disassociate the host in Foreman from its compute resource.'
+ )}
+
+ {__(
+ 'After disassociating, a host can be deleted from Foreman without affecting its virtual machine.'
+ )}
+
+
+
+
+ {selectedResultsEmpty && (
+
+ )}
+ {!selectedResultsEmpty && (
+ <>
+
+
+ >
+ )}
+
+
+ );
+};
+
+BulkDisassociateModal.propTypes = {
+ isOpen: PropTypes.bool,
+ closeModal: PropTypes.func,
+ selectedResults: PropTypes.array,
+ fetchBulkParams: PropTypes.func.isRequired,
+ selectedCount: PropTypes.number.isRequired,
+ selectAllHostsMode: PropTypes.bool.isRequired,
+};
+
+BulkDisassociateModal.defaultProps = {
+ isOpen: false,
+ closeModal: () => {},
+ selectedResults: [],
+};
+
+export default BulkDisassociateModal;
diff --git a/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/actions.js b/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/actions.js
new file mode 100644
index 0000000000..ee3a84b243
--- /dev/null
+++ b/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/actions.js
@@ -0,0 +1,16 @@
+import { APIActions } from '../../../../redux/API';
+import { foremanUrl } from '../../../../common/helpers';
+
+export const BULK_DISASSOCIATE_KEY = 'BULK_DISASSOCIATE';
+export const bulkDisassociate = (params, handleSuccess, handleError) => {
+ const url = foremanUrl(`/api/v2/hosts/bulk/disassociate`);
+ return APIActions.put({
+ key: BULK_DISASSOCIATE_KEY,
+ url,
+ handleSuccess,
+ handleError,
+ params,
+ });
+};
+
+export default bulkDisassociate;
diff --git a/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/index.js b/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/index.js
new file mode 100644
index 0000000000..bcc8343b47
--- /dev/null
+++ b/webpack/assets/javascripts/react_app/components/HostsIndex/BulkActions/disassociate/index.js
@@ -0,0 +1,29 @@
+import React, { useContext } from 'react';
+import { ForemanActionsBarContext } from '../../../../components/HostDetails/ActionsBar';
+import { useForemanModal } from '../../../../components/ForemanModal/ForemanModalHooks';
+import BulkDisassociateModal from './BulkDisassociateModal';
+
+const BulkDisassociateModalScene = () => {
+ const {
+ selectAllHostsMode,
+ selectedCount,
+ selectedResults,
+ fetchBulkParams,
+ } = useContext(ForemanActionsBarContext);
+ const { modalOpen, setModalClosed } = useForemanModal({
+ id: 'bulk-disassociate-modal',
+ });
+ return (
+