From 9c3a4a0a8c0e3e8ec0c516205372a67cf65e0bbe Mon Sep 17 00:00:00 2001 From: Jeremy Lenz Date: Fri, 29 Sep 2023 16:54:56 -0400 Subject: [PATCH] Fixes #36793 - Allow plugins to close ActionsBar kebab via React context --- .../HostDetails/ActionsBar/index.js | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/index.js b/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/index.js index 7af440f383e..44ff646d1c3 100644 --- a/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/index.js +++ b/webpack/assets/javascripts/react_app/components/HostDetails/ActionsBar/index.js @@ -1,5 +1,5 @@ import PropTypes from 'prop-types'; -import React, { useState } from 'react'; +import React, { useState, createContext } from 'react'; import { useSelector, shallowEqual, useDispatch } from 'react-redux'; import { Button, @@ -27,6 +27,8 @@ import { useForemanSettings } from '../../../Root/Context/ForemanContext'; import BuildModal from './BuildModal'; import Slot from '../../common/Slot'; +export const ForemanActionsBarContext = createContext(); + const ActionsBar = ({ hostId, hostFriendlyId, @@ -147,16 +149,18 @@ const ActionsBar = ({ > {__('Edit')} - - } - isOpen={kebabIsOpen} - isPlain - dropdownItems={dropdownItems.concat(registeredItems)} - /> + + + } + isOpen={kebabIsOpen} + isPlain + dropdownItems={dropdownItems.concat(registeredItems)} + /> + {isBuildModalOpen && (