Skip to content

Commit

Permalink
MOSIP-38346 resolved clone policy issue with draft status (#1038)
Browse files Browse the repository at this point in the history
Signed-off-by: MadhuMosip <[email protected]>
  • Loading branch information
MadhuMosip authored Dec 18, 2024
1 parent 55560c0 commit d489262
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions pmp-revamp-ui/src/pages/admin/policyManager/PoliciesList.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,25 @@ function PoliciesList({ policyType, createPolicyButtonName, createPolicy, subTit
document.body.style.overflow = 'auto';
};

useEffect(() => {
// Define the handler for the Escape key
const handleEscape = (e) => {
if (e.key === 'Escape') {
closeClonePolicyPopup();
}
};

// Add event listener when the popup is open
if (showClonePopup) {
window.addEventListener('keydown', handleEscape);
}

// Cleanup the event listener when the component unmounts or isOpen changes
return () => {
window.removeEventListener('keydown', handleEscape);
};
}, [showClonePopup]);

const onClickConfirmDeactivate = (deactivationResponse, selectedPolicy) => {
if (deactivationResponse && !deactivationResponse.isActive) {
setActionId(-1);
Expand Down

0 comments on commit d489262

Please sign in to comment.