-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix upgrade notice displaying in error * Move upgrade detection to a util method (cherry picked from commit 07b64b1) Co-authored-by: Kyle Pollich <[email protected]>
- Loading branch information
1 parent
9e5b5ee
commit 1f04996
Showing
5 changed files
with
66 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
...tions/fleet/sections/agent_policy/edit_package_policy_page/utils/has_upgrade_available.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import semverGt from 'semver/functions/gt'; | ||
|
||
import type { UpgradePackagePolicyDryRunResponse } from '../../../../types'; | ||
|
||
/** | ||
* Given a dry run response, determines if a greater version exists in the "proposed" | ||
* version of the first package policy in the response. | ||
*/ | ||
export function hasUpgradeAvailable(dryRunData: UpgradePackagePolicyDryRunResponse) { | ||
return ( | ||
dryRunData && | ||
dryRunData[0].diff && | ||
semverGt( | ||
dryRunData[0].diff[1].package?.version ?? '', | ||
dryRunData[0].diff[0].package?.version ?? '' | ||
) | ||
); | ||
} |
8 changes: 8 additions & 0 deletions
8
...t/public/applications/fleet/sections/agent_policy/edit_package_policy_page/utils/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
export * from './has_upgrade_available'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters