Skip to content

Commit

Permalink
[Fleet] Fix upgrade link in Fleet policy table (elastic#110228)
Browse files Browse the repository at this point in the history
* Fix upgrade link in Fleet policy table

* Ensure upgrade page displays as upgrade even without from prop
  • Loading branch information
kpollich authored and kibanamachine committed Aug 27, 2021
1 parent 785ea50 commit a80110b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ export const PackagePoliciesTable: React.FunctionComponent<Props> = ({
upgradePackagePolicyHref={`${getHref('upgrade_package_policy', {
policyId: agentPolicy.id,
packagePolicyId: packagePolicy.id,
})}`}
})}?from=fleet-policy-list`}
/>
);
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 },
Expand All @@ -99,9 +100,6 @@ export const EditPackagePolicyForm = memo<{
>();
const [dryRunData, setDryRunData] = useState<UpgradePackagePolicyDryRunResponse>();

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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export const UpgradePackagePolicyPage = memo(() => {
from = 'upgrade-from-integrations-policy-list';
}

return <EditPackagePolicyForm packagePolicyId={packagePolicyId} from={from} />;
return <EditPackagePolicyForm packagePolicyId={packagePolicyId} from={from} isUpgrade />;
});

0 comments on commit a80110b

Please sign in to comment.