11import { Flex } from '@gravity-ui/uikit' ;
2+ import { isNil } from 'lodash' ;
23
34import type { PreparedStorageGroup } from '../../store/reducers/storage/types' ;
4- import { valueIsDefined } from '../../utils' ;
55import { formatStorageValuesToGb } from '../../utils/dataFormatters/dataFormatters' ;
66import { formatToMs } from '../../utils/timeParsers' ;
77import { bytesToSpeed } from '../../utils/utils' ;
@@ -43,40 +43,40 @@ export function StorageGroupInfo({data, className, ...infoViewerProps}: StorageG
4343
4444 const storageGroupInfoFirstColumn = [ ] ;
4545
46- if ( valueIsDefined ( GroupGeneration ) ) {
46+ if ( ! isNil ( GroupGeneration ) ) {
4747 storageGroupInfoFirstColumn . push ( {
4848 label : storageGroupInfoKeyset ( 'group-generation' ) ,
4949 value : GroupGeneration ,
5050 } ) ;
5151 }
52- if ( valueIsDefined ( ErasureSpecies ) ) {
52+ if ( ! isNil ( ErasureSpecies ) ) {
5353 storageGroupInfoFirstColumn . push ( {
5454 label : storageGroupInfoKeyset ( 'erasure-species' ) ,
5555 value : ErasureSpecies ,
5656 } ) ;
5757 }
58- if ( valueIsDefined ( MediaType ) ) {
58+ if ( ! isNil ( MediaType ) ) {
5959 storageGroupInfoFirstColumn . push ( {
6060 label : storageGroupInfoKeyset ( 'media-type' ) ,
6161 value : MediaType ,
6262 } ) ;
6363 }
64- if ( valueIsDefined ( Encryption ) ) {
64+ if ( ! isNil ( Encryption ) ) {
6565 storageGroupInfoFirstColumn . push ( {
6666 label : storageGroupInfoKeyset ( 'encryption' ) ,
6767 value : Encryption ? storageGroupInfoKeyset ( 'yes' ) : storageGroupInfoKeyset ( 'no' ) ,
6868 } ) ;
6969 }
70- if ( valueIsDefined ( Overall ) ) {
70+ if ( ! isNil ( Overall ) ) {
7171 storageGroupInfoFirstColumn . push ( {
7272 label : storageGroupInfoKeyset ( 'overall' ) ,
7373 value : < StatusIcon status = { Overall } /> ,
7474 } ) ;
7575 }
76- if ( valueIsDefined ( State ) ) {
76+ if ( ! isNil ( State ) ) {
7777 storageGroupInfoFirstColumn . push ( { label : storageGroupInfoKeyset ( 'state' ) , value : State } ) ;
7878 }
79- if ( valueIsDefined ( MissingDisks ) ) {
79+ if ( ! isNil ( MissingDisks ) ) {
8080 storageGroupInfoFirstColumn . push ( {
8181 label : storageGroupInfoKeyset ( 'missing-disks' ) ,
8282 value : MissingDisks ,
@@ -85,7 +85,7 @@ export function StorageGroupInfo({data, className, ...infoViewerProps}: StorageG
8585
8686 const storageGroupInfoSecondColumn = [ ] ;
8787
88- if ( valueIsDefined ( Used ) && valueIsDefined ( Limit ) ) {
88+ if ( ! isNil ( Used ) && ! isNil ( Limit ) ) {
8989 storageGroupInfoSecondColumn . push ( {
9090 label : storageGroupInfoKeyset ( 'used-space' ) ,
9191 value : (
@@ -98,61 +98,61 @@ export function StorageGroupInfo({data, className, ...infoViewerProps}: StorageG
9898 ) ,
9999 } ) ;
100100 }
101- if ( valueIsDefined ( Available ) ) {
101+ if ( ! isNil ( Available ) ) {
102102 storageGroupInfoSecondColumn . push ( {
103103 label : storageGroupInfoKeyset ( 'available' ) ,
104104 value : formatStorageValuesToGb ( Number ( Available ) ) ,
105105 } ) ;
106106 }
107- if ( valueIsDefined ( Usage ) ) {
107+ if ( ! isNil ( Usage ) ) {
108108 storageGroupInfoSecondColumn . push ( {
109109 label : storageGroupInfoKeyset ( 'usage' ) ,
110110 value : `${ Usage . toFixed ( 2 ) } %` ,
111111 } ) ;
112112 }
113- if ( valueIsDefined ( DiskSpace ) ) {
113+ if ( ! isNil ( DiskSpace ) ) {
114114 storageGroupInfoSecondColumn . push ( {
115115 label : storageGroupInfoKeyset ( 'disk-space' ) ,
116116 value : < StatusIcon status = { DiskSpace } /> ,
117117 } ) ;
118118 }
119- if ( valueIsDefined ( Latency ) ) {
119+ if ( ! isNil ( Latency ) ) {
120120 storageGroupInfoSecondColumn . push ( {
121121 label : storageGroupInfoKeyset ( 'latency' ) ,
122122 value : < StatusIcon status = { Latency } /> ,
123123 } ) ;
124124 }
125- if ( valueIsDefined ( LatencyPutTabletLogMs ) ) {
125+ if ( ! isNil ( LatencyPutTabletLogMs ) ) {
126126 storageGroupInfoSecondColumn . push ( {
127127 label : storageGroupInfoKeyset ( 'latency-put-tablet-log' ) ,
128128 value : formatToMs ( LatencyPutTabletLogMs ) ,
129129 } ) ;
130130 }
131- if ( valueIsDefined ( LatencyPutUserDataMs ) ) {
131+ if ( ! isNil ( LatencyPutUserDataMs ) ) {
132132 storageGroupInfoSecondColumn . push ( {
133133 label : storageGroupInfoKeyset ( 'latency-put-user-data' ) ,
134134 value : formatToMs ( LatencyPutUserDataMs ) ,
135135 } ) ;
136136 }
137- if ( valueIsDefined ( LatencyGetFastMs ) ) {
137+ if ( ! isNil ( LatencyGetFastMs ) ) {
138138 storageGroupInfoSecondColumn . push ( {
139139 label : storageGroupInfoKeyset ( 'latency-get-fast' ) ,
140140 value : formatToMs ( LatencyGetFastMs ) ,
141141 } ) ;
142142 }
143- if ( valueIsDefined ( AllocationUnits ) ) {
143+ if ( ! isNil ( AllocationUnits ) ) {
144144 storageGroupInfoSecondColumn . push ( {
145145 label : storageGroupInfoKeyset ( 'allocation-units' ) ,
146146 value : AllocationUnits ,
147147 } ) ;
148148 }
149- if ( valueIsDefined ( Read ) ) {
149+ if ( ! isNil ( Read ) ) {
150150 storageGroupInfoSecondColumn . push ( {
151151 label : storageGroupInfoKeyset ( 'read-throughput' ) ,
152152 value : bytesToSpeed ( Number ( Read ) ) ,
153153 } ) ;
154154 }
155- if ( valueIsDefined ( Write ) ) {
155+ if ( ! isNil ( Write ) ) {
156156 storageGroupInfoSecondColumn . push ( {
157157 label : storageGroupInfoKeyset ( 'write-throughput' ) ,
158158 value : bytesToSpeed ( Number ( Write ) ) ,
0 commit comments