From 2d815e13118a2facc8d49a5da3d1348c822d5ff2 Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Thu, 26 Aug 2021 09:15:53 -0400 Subject: [PATCH 1/2] Fix upgrade link in Fleet policy table --- .../components/package_policies/package_policies_table.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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`} /> ); }, From ceb5ad8fcc89942a19bc5feb719535a481ae02ad Mon Sep 17 00:00:00 2001 From: Kyle Pollich Date: Thu, 26 Aug 2021 09:21:40 -0400 Subject: [PATCH 2/2] Ensure upgrade page displays as upgrade even without from prop --- .../agent_policy/edit_package_policy_page/index.tsx | 6 ++---- .../agent_policy/upgrade_package_policy_page/index.tsx | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) 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 ; });