11import _ from 'lodash' ;
22import cn from 'bem-cn-lite' ;
33import DataTable , { Column , Settings , SortOrder } from '@yandex-cloud/react-data-table' ;
4- import { Popover , PopoverBehavior } from '@yandex-cloud/uikit' ;
4+ import { Label , Popover , PopoverBehavior } from '@yandex-cloud/uikit' ;
55
66import { Stack } from '../../../components/Stack/Stack' ;
77//@ts -ignore
@@ -16,7 +16,7 @@ import {bytesToGB, bytesToSpeed} from '../../../utils/utils';
1616import { stringifyVdiskId } from '../../../utils' ;
1717
1818import Vdisk from '../Vdisk/Vdisk' ;
19- import { isFullDonorData } from '../utils' ;
19+ import { isFullDonorData , getDegradedSeverity } from '../utils' ;
2020
2121import './StorageGroups.scss' ;
2222
@@ -53,7 +53,7 @@ const tableColumnsNames: Record<TableColumnsIdsValues, string> = {
5353 Read : 'Read' ,
5454 Write : 'Write' ,
5555 VDisks : 'VDisks' ,
56- Missing : 'Missing ' ,
56+ Missing : 'Degraded ' ,
5757} ;
5858
5959const b = cn ( 'global-storage-groups' ) ;
@@ -62,8 +62,8 @@ function setSortOrder(visibleEntities: keyof typeof VisibleEntities): SortOrder
6262 switch ( visibleEntities ) {
6363 case VisibleEntities . All : {
6464 return {
65- columnId : TableColumnsIds . GroupID ,
66- order : DataTable . ASCENDING ,
65+ columnId : TableColumnsIds . Missing ,
66+ order : DataTable . DESCENDING ,
6767 } ;
6868 }
6969 case VisibleEntities . Missing : {
@@ -110,6 +110,16 @@ function StorageGroups({data, tableSettings, visibleEntities, nodes}: StorageGro
110110 } ,
111111 align : DataTable . LEFT ,
112112 } ,
113+ {
114+ name : TableColumnsIds . Missing ,
115+ header : tableColumnsNames [ TableColumnsIds . Missing ] ,
116+ width : 100 ,
117+ render : ( { value, row} ) => value ? (
118+ < Label theme = { getDegradedSeverity ( row ) } > Degraded: { value } </ Label >
119+ ) : '-' ,
120+ align : DataTable . LEFT ,
121+ defaultOrder : DataTable . DESCENDING ,
122+ } ,
113123 {
114124 name : TableColumnsIds . GroupID ,
115125 header : tableColumnsNames [ TableColumnsIds . GroupID ] ,
@@ -186,13 +196,6 @@ function StorageGroups({data, tableSettings, visibleEntities, nodes}: StorageGro
186196 } ,
187197 align : DataTable . RIGHT ,
188198 } ,
189- {
190- name : TableColumnsIds . Missing ,
191- header : tableColumnsNames [ TableColumnsIds . Missing ] ,
192- width : 100 ,
193- align : DataTable . CENTER ,
194- defaultOrder : DataTable . DESCENDING ,
195- } ,
196199 {
197200 name : TableColumnsIds . VDisks ,
198201 className : b ( 'vdisks-column' ) ,
0 commit comments