Skip to content

Commit

Permalink
[Fleet] Do not display add agent from the integration table in agent …
Browse files Browse the repository at this point in the history
…policy (#106785)
  • Loading branch information
nchaulet authored Jul 26, 2021
1 parent 8115a76 commit a3688b1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,7 @@ export const PackagePoliciesPage = ({ name, version }: PackagePoliciesPanelProps
agentPolicy={agentPolicy}
packagePolicy={packagePolicy}
viewDataStep={viewDataStep}
showAddAgent={true}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
agentPolicy: AgentPolicy;
packagePolicy: PackagePolicy;
viewDataStep?: EuiStepProps;
}> = ({ agentPolicy, packagePolicy, viewDataStep }) => {
showAddAgent?: boolean;
}> = ({ agentPolicy, packagePolicy, viewDataStep, showAddAgent }) => {
const [isEnrollmentFlyoutOpen, setIsEnrollmentFlyoutOpen] = useState(false);
const { getHref } = useLink();
const hasWriteCapabilities = useCapabilities().write;
Expand All @@ -47,19 +48,23 @@ export const PackagePolicyActionsMenu: React.FunctionComponent<{
// defaultMessage="View integration"
// />
// </EuiContextMenuItem>,
<EuiContextMenuItem
icon="plusInCircle"
onClick={() => {
setIsActionsMenuOpen(false);
setIsEnrollmentFlyoutOpen(true);
}}
key="addAgent"
>
<FormattedMessage
id="xpack.fleet.epm.packageDetails.integrationList.addAgent"
defaultMessage="Add Agent"
/>
</EuiContextMenuItem>,
...(showAddAgent
? [
<EuiContextMenuItem
icon="plusInCircle"
onClick={() => {
setIsActionsMenuOpen(false);
setIsEnrollmentFlyoutOpen(true);
}}
key="addAgent"
>
<FormattedMessage
id="xpack.fleet.epm.packageDetails.integrationList.addAgent"
defaultMessage="Add Agent"
/>
</EuiContextMenuItem>,
]
: []),
<EuiContextMenuItem
disabled={!hasWriteCapabilities}
icon="pencil"
Expand Down

0 comments on commit a3688b1

Please sign in to comment.