Skip to content

Commit

Permalink
fix: sort k8s version (#152)
Browse files Browse the repository at this point in the history
Signed-off-by: liuying <liu.ying@99cloud.net>

Signed-off-by: liuying <liu.ying@99cloud.net>
  • Loading branch information
lysign authored Sep 7, 2022
1 parent ec69ceb commit 6d33664
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/stores/cluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import { get, uniqBy } from 'lodash';
import { APIVERSION } from 'utils/constants';
import ObjectMapper from 'utils/object.mapper';
import { versionCompare } from 'utils';

import BaseStore from './base';

Expand Down Expand Up @@ -94,6 +95,10 @@ export default class ClusterStore extends BaseStore {
);
let onlineData = get(onlineResult, 'rules') || [];

onlineData = onlineData
.sort((a, b) => versionCompare(a.version, b.version))
.reverse();

onlineData = onlineData.map((item) => {
const archs = onlineData
.filter((data) => data.version === item.version)
Expand All @@ -120,6 +125,10 @@ export default class ClusterStore extends BaseStore {
);
let offlineData = get(offlineResult, 'rules') || [];

offlineData = offlineData
.sort((a, b) => versionCompare(a.version, b.version))
.reverse();

offlineData = offlineData.map((item) => {
const archs = offlineData
.filter((data) => data.version === item.version)
Expand Down

0 comments on commit 6d33664

Please sign in to comment.