Skip to content

Commit

Permalink
chore: update ocm table version sorting to use semver package
Browse files Browse the repository at this point in the history
  • Loading branch information
Zaperex committed Jan 11, 2024
1 parent f82f8d9 commit a9edbdd
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions app-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ backend:
# This is for local development only, it is not recommended to use this in production
# The production database configuration is stored in app-config.production.yaml
database:
client: better-sqlite3
connection: ':memory:'
cache:
store: memory
Expand Down
3 changes: 2 additions & 1 deletion plugins/ocm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"@material-ui/lab": "^4.0.0-alpha.45",
"@patternfly/patternfly": "^5.1.0",
"@patternfly/react-icons": "^5.1.1",
"react-use": "^17.4.0"
"react-use": "^17.4.0",
"semver": "^7.5.4"
},
"peerDependencies": {
"react": "^16.13.1 || ^17.0.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import { HomePageCompanyLogo } from '@backstage/plugin-home';
import { SearchContextProvider } from '@backstage/plugin-search-react';

import { Chip, CircularProgress, Grid, makeStyles } from '@material-ui/core';
import semver from 'semver';

import {
ClusterNodesStatus,
Expand Down Expand Up @@ -196,10 +197,9 @@ const CatalogClusters = () => {
title: 'Version',
field: 'version',
customSort: (a, b) => {
return a.version.props.data.version.localeCompare(
b.version.props.data.version,
'en',
);
const versionA = a.version.props.data.version as string;
const versionB = b.version.props.data.version as string;
return semver.gt(versionA, versionB) ? 1 : -1;
},
},
{
Expand Down
6 changes: 3 additions & 3 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -13151,9 +13151,9 @@
"@types/react" "*"

"@types/react@*", "@types/[email protected]", "@types/react@>=16", "@types/react@^16.13.1 || ^17.0.0", "@types/react@^17", "@types/react@^17.0.68":
version "17.0.73"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.73.tgz#23a663c803b18d8b7f4f2bb9b467f2f3fd70787a"
integrity sha512-6AcjgPIVsXTIsFDgsGW0iQhvg0xb2vt2qAWgXyncnVNRaW9ZXTTwAh7RQoh7PzK1AhjPoGDvUBkdAREih9n5oQ==
version "17.0.74"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.74.tgz#ea93059a55e5cfc7a76e7712fe8db5317dd29ee3"
integrity sha512-nBtFGaeTMzpiL/p73xbmCi00SiCQZDTJUk9ZuHOLtil3nI+y7l269LHkHIAYpav99ZwGnPJzuJsJpfLXjiQ52g==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
Expand Down

0 comments on commit a9edbdd

Please sign in to comment.