Skip to content

Commit

Permalink
[Fleet] Fix add agent in the package policy table (#104749) (#105690)
Browse files Browse the repository at this point in the history
Co-authored-by: Nicolas Chaulet <nicolas.chaulet@elastic.co>
  • Loading branch information
kibanamachine and nchaulet authored Jul 14, 2021
1 parent 7f46afe commit 1696afe
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
const { getHref } = useLink();
const hasWriteCapabilities = useCapabilities().write;
const refreshAgentPolicy = useAgentPolicyRefresh();
const [isActionsMenuOpen, setIsActionsMenuOpen] = useState(false);

const onEnrollmentFlyoutClose = useMemo(() => {
return () => setIsEnrollmentFlyoutOpen(false);
Expand All @@ -48,7 +49,10 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
// </EuiContextMenuItem>,
<EuiContextMenuItem
icon="plusInCircle"
onClick={() => setIsEnrollmentFlyoutOpen(true)}
onClick={() => {
setIsActionsMenuOpen(false);
setIsEnrollmentFlyoutOpen(true);
}}
key="addAgent"
>
<FormattedMessage
Expand Down Expand Up @@ -112,7 +116,11 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
/>
</EuiPortal>
)}
<ContextMenuActions items={menuItems} />
<ContextMenuActions
isOpen={isActionsMenuOpen}
items={menuItems}
onChange={(isOpen) => setIsActionsMenuOpen(isOpen)}
/>
</>
);
};

0 comments on commit 1696afe

Please sign in to comment.