Skip to content

Commit

Permalink
[Fleet] Fix upgrade link in Fleet policy table (#110228) (#110400)
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

Co-authored-by: Kyle Pollich <[email protected]>
  • Loading branch information
kibanamachine and kpollich authored Aug 27, 2021
1 parent 880ebcd commit 0778599
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 0778599

Please sign in to comment.