From 7b967ae22c61f18aecb46ac508a49046fce18d50 Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Fri, 27 Aug 2021 10:31:49 -0400 Subject: [PATCH] [Fleet] Fix upgrade link in Fleet policy table (#110228) (#110401) * Fix upgrade link in Fleet policy table * Ensure upgrade page displays as upgrade even without from prop Co-authored-by: Kyle Pollich --- .../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 ; });