[Logs UI] Prevent the "Alerts and rules" context menu from sticking (#106408)

This commit is contained in:
Alejandro Fernández Gómez 2021-07-22 14:46:41 +02:00 committed by GitHub
parent 63ffc9fc47
commit a397e0f60a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -54,13 +54,18 @@ export const AlertDropdown = () => {
setPopoverOpen(true);
}, [setPopoverOpen]);
const openFlyout = useCallback(() => {
setFlyoutVisible(true);
closePopover();
}, [setFlyoutVisible, closePopover]);
const menuItems = useMemo(() => {
return [
<EuiContextMenuItem
disabled={!canCreateAlerts}
icon="bell"
key="createLink"
onClick={() => setFlyoutVisible(true)}
onClick={openFlyout}
toolTipContent={!canCreateAlerts ? readOnlyUserTooltipContent : undefined}
toolTipTitle={!canCreateAlerts ? readOnlyUserTooltipTitle : undefined}
>
@ -76,7 +81,7 @@ export const AlertDropdown = () => {
/>
</EuiContextMenuItem>,
];
}, [manageAlertsLinkProps, canCreateAlerts]);
}, [manageAlertsLinkProps, canCreateAlerts, openFlyout]);
return (
<>