Skip to content

Commit

Permalink
No 'delete integration' menu item for hosted policies
Browse files Browse the repository at this point in the history
  • Loading branch information
John Schulz committed Apr 6, 2021
1 parent 405888f commit 08d399a
Showing 1 changed file with 44 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,42 +167,45 @@ export const PackagePoliciesTable: React.FunctionComponent<Props> = ({
}),
actions: [
{
render: (packagePolicy: InMemoryPackagePolicy) => (
<ContextMenuActions
items={[
// FIXME: implement View package policy action
// <EuiContextMenuItem
// disabled
// icon="inspect"
// onClick={() => {}}
// key="packagePolicyView"
// >
// <FormattedMessage
// id="xpack.fleet.policyDetails.packagePoliciesTable.viewActionTitle"
// defaultMessage="View integration"
// />
// </EuiContextMenuItem>,
<EuiContextMenuItem
disabled={!hasWriteCapabilities}
icon="pencil"
href={getHref('edit_integration', {
policyId: agentPolicy.id,
packagePolicyId: packagePolicy.id,
})}
key="packagePolicyEdit"
>
<FormattedMessage
id="xpack.fleet.policyDetails.packagePoliciesTable.editActionTitle"
defaultMessage="Edit integration"
/>
</EuiContextMenuItem>,
// FIXME: implement Copy package policy action
// <EuiContextMenuItem disabled icon="copy" onClick={() => {}} key="packagePolicyCopy">
// <FormattedMessage
// id="xpack.fleet.policyDetails.packagePoliciesTable.copyActionTitle"
// defaultMessage="Copy integration"
// />
// </EuiContextMenuItem>,
render: (packagePolicy: InMemoryPackagePolicy) => {
const menuItems = [
// FIXME: implement View package policy action
// <EuiContextMenuItem
// disabled
// icon="inspect"
// onClick={() => {}}
// key="packagePolicyView"
// >
// <FormattedMessage
// id="xpack.fleet.policyDetails.packagePoliciesTable.viewActionTitle"
// defaultMessage="View integration"
// />
// </EuiContextMenuItem>,
<EuiContextMenuItem
disabled={!hasWriteCapabilities}
icon="pencil"
href={getHref('edit_integration', {
policyId: agentPolicy.id,
packagePolicyId: packagePolicy.id,
})}
key="packagePolicyEdit"
>
<FormattedMessage
id="xpack.fleet.policyDetails.packagePoliciesTable.editActionTitle"
defaultMessage="Edit integration"
/>
</EuiContextMenuItem>,
// FIXME: implement Copy package policy action
// <EuiContextMenuItem disabled icon="copy" onClick={() => {}} key="packagePolicyCopy">
// <FormattedMessage
// id="xpack.fleet.policyDetails.packagePoliciesTable.copyActionTitle"
// defaultMessage="Copy integration"
// />
// </EuiContextMenuItem>,
];

if (!agentPolicy.is_managed) {
menuItems.push(
<PackagePolicyDeleteProvider agentPolicy={agentPolicy} key="packagePolicyDelete">
{(deletePackagePoliciesPrompt) => {
return (
Expand All @@ -220,10 +223,11 @@ export const PackagePoliciesTable: React.FunctionComponent<Props> = ({
</DangerEuiContextMenuItem>
);
}}
</PackagePolicyDeleteProvider>,
]}
/>
),
</PackagePolicyDeleteProvider>
);
}
return <ContextMenuActions items={menuItems} />;
},
},
],
},
Expand Down

0 comments on commit 08d399a

Please sign in to comment.