@@ -14,8 +14,9 @@ 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' ;
19+ import { sortResourceByValue } from '@console/internal/components/factory/Table/sort' ;
1920import {
2021 ResourceLink ,
2122 Kebab ,
@@ -45,10 +46,11 @@ import {
4546 getNamespace ,
4647 snapshotSource ,
4748 FLAGS ,
49+ snapshotStatus ,
4850} from '@console/shared' ;
4951import { Timestamp } from '@console/shared/src/components/datetime/Timestamp' ;
5052import { useFlag } from '@console/shared/src/hooks/flag' ;
51- import { snapshotStatusFilters , volumeSnapshotStatus } from '../../status' ;
53+ import { snapshotStatusFilters } from '../../status' ;
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