From 74f3b76592e843f76e4877e4263d3b5ae8be6b1c Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Fri, 27 Aug 2021 08:08:53 -0400 Subject: [PATCH] [Fleet] Fix upgrade link in Fleet policy table (#110228) * Fix upgrade link in Fleet policy table * Ensure upgrade page displays as upgrade even without from prop --- .../components/package_policies/package_policies_table.tsx | 2 +- .../agent_policy/edit_package_policy_page/index.tsx | 6 ++---- .../agent_policy/upgrade_package_policy_page/index.tsx | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx index c84df5790ecb5..eb5f8e6c6a9b8 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/details_page/components/package_policies/package_policies_table.tsx @@ -237,7 +237,7 @@ export const PackagePoliciesTable: React.FunctionComponent = ({ upgradePackagePolicyHref={`${getHref('upgrade_package_policy', { policyId: agentPolicy.id, packagePolicyId: packagePolicy.id, - })}`} + })}?from=fleet-policy-list`} /> ); }, diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx index 8a1ffe21a90e0..67cff3e2d0304 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/edit_package_policy_page/index.tsx @@ -71,8 +71,9 @@ export const EditPackagePolicyPage = memo(() => { export const EditPackagePolicyForm = memo<{ packagePolicyId: string; + isUpgrade?: boolean; from?: EditPackagePolicyFrom; -}>(({ packagePolicyId, from = 'edit' }) => { +}>(({ packagePolicyId, isUpgrade = false, from = 'edit' }) => { const { application, notifications } = useStartServices(); const { agents: { enabled: isFleetEnabled }, @@ -99,9 +100,6 @@ export const EditPackagePolicyForm = memo<{ >(); const [dryRunData, setDryRunData] = useState(); - const isUpgrade = - from === 'upgrade-from-fleet-policy-list' || from === 'upgrade-from-integrations-policy-list'; - const policyId = agentPolicy?.id ?? ''; // Retrieve agent policy, package, and package policy info diff --git a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx index e9442f84d228e..18cf7847cd29b 100644 --- a/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx +++ b/x-pack/plugins/fleet/public/applications/fleet/sections/agent_policy/upgrade_package_policy_page/index.tsx @@ -30,5 +30,5 @@ export const UpgradePackagePolicyPage = memo(() => { from = 'upgrade-from-integrations-policy-list'; } - return ; + return ; });