mirror of
https://github.com/portainer/portainer.git
synced 2025-07-24 07:49:41 +02:00
feat(edge/stacks): info for old agent status [EE-5792] (#10013)
This commit is contained in:
parent
7757bf7a84
commit
fd7e8a629e
9 changed files with 103 additions and 35 deletions
27
app/react/common/semver-utils.ts
Normal file
27
app/react/common/semver-utils.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* Compares two semver strings.
|
||||
*
|
||||
* returns:
|
||||
* - `-1` if `a < b`
|
||||
* - `0` if `a == b`
|
||||
* - `1` if `a > b`
|
||||
*/
|
||||
export function semverCompare(a: string, b: string) {
|
||||
if (a.startsWith(`${b}-`)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (b.startsWith(`${a}-`)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return a.localeCompare(b, undefined, {
|
||||
numeric: true,
|
||||
sensitivity: 'case',
|
||||
caseFirst: 'upper',
|
||||
});
|
||||
}
|
||||
|
||||
export function isVersionSmaller(a: string, b: string) {
|
||||
return semverCompare(a, b) < 0;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue