@@ -14,7 +14,7 @@ import {
1414 TableColumn ,
1515 RowProps ,
1616} from '@console/dynamic-plugin-sdk/src/lib-core' ;
17- import { TableData } from '@console/internal/components/factory' ;
17+ import { sorts , TableData } from '@console/internal/components/factory' ;
1818import { useActiveColumns } from '@console/internal/components/factory/Table/active-columns-hook' ;
1919import {
2020 ResourceLink ,
@@ -45,10 +45,12 @@ import {
4545 getNamespace ,
4646 snapshotSource ,
4747 FLAGS ,
48+ snapshotStatus ,
4849} from '@console/shared' ;
4950import { Timestamp } from '@console/shared/src/components/datetime/Timestamp' ;
5051import { useFlag } from '@console/shared/src/hooks/flag' ;
51- import { snapshotStatusFilters , volumeSnapshotStatus } from '../../status' ;
52+ import { snapshotStatusFilters } from '../../status' ;
53+ import { sortResourceByValue } from 'public/components/factory/Table/sort' ;
5254
5355const tableColumnInfo = [
5456 { id : 'name' } ,
@@ -78,21 +80,24 @@ const getTableColumns = (t: TFunction, disableItems = {}): TableColumn<VolumeSna
7880 } ,
7981 {
8082 title : t ( 'console-app~Status' ) ,
81- sort : 'snapshotStatus' ,
83+ sort : ( data , direction ) =>
84+ data . sort ( sortResourceByValue ( direction , sorts . volumeSnapshotStatus ) ) ,
8285 transforms : [ sortable ] ,
8386 props : { className : tableColumnInfo [ 2 ] . className } ,
8487 id : tableColumnInfo [ 2 ] . id ,
8588 } ,
8689 {
8790 title : t ( 'console-app~Size' ) ,
88- sort : 'volumeSnapshotSize' ,
91+ sort : ( data , direction ) =>
92+ data . sort ( sortResourceByValue ( direction , sorts . volumeSnapshotSize ) ) ,
8993 transforms : [ sortable ] ,
9094 props : { className : tableColumnInfo [ 3 ] . className } ,
9195 id : tableColumnInfo [ 3 ] . id ,
9296 } ,
9397 {
9498 title : t ( 'console-app~Source' ) ,
95- sort : 'volumeSnapshotSource' ,
99+ sort : ( data , direction ) =>
100+ data . sort ( sortResourceByValue ( direction , sorts . volumeSnapshotSource ) ) ,
96101 transforms : [ sortable ] ,
97102 props : { className : tableColumnInfo [ 4 ] . className } ,
98103 id : tableColumnInfo [ 4 ] . id ,
@@ -154,7 +159,7 @@ const Row: React.FC<RowProps<VolumeSnapshotKind, VolumeSnapshotRowProsCustomData
154159 < ResourceLink kind = { NamespaceModel . kind } name = { namespace } />
155160 </ TableData >
156161 < TableData { ...tableColumnInfo [ 2 ] } >
157- < Status status = { volumeSnapshotStatus ( obj ) } />
162+ < Status status = { snapshotStatus ( obj ) } />
158163 </ TableData >
159164 < TableData { ...tableColumnInfo [ 3 ] } > { sizeMetrics } </ TableData >
160165 { ! customData ?. disableItems ?. Source && (
0 commit comments