@@ -35,15 +35,26 @@ import {setSearchValue, tenantsApi} from '../../store/reducers/tenants/tenants';
35
35
import type { PreparedTenant } from '../../store/reducers/tenants/types' ;
36
36
import type { AdditionalTenantsProps } from '../../types/additionalProps' ;
37
37
import { uiFactory } from '../../uiFactory/uiFactory' ;
38
+ import { formatBytes } from '../../utils/bytesParsers' ;
38
39
import { cn } from '../../utils/cn' ;
39
- import { DEFAULT_TABLE_SETTINGS } from '../../utils/constants' ;
40
+ import {
41
+ DEFAULT_TABLE_SETTINGS ,
42
+ EMPTY_DATA_PLACEHOLDER ,
43
+ SHOW_NETWORK_UTILIZATION ,
44
+ } from '../../utils/constants' ;
40
45
import {
41
46
formatCPU ,
42
47
formatNumber ,
43
48
formatStorageValuesToGb ,
44
49
} from '../../utils/dataFormatters/dataFormatters' ;
45
- import { useAutoRefreshInterval , useTypedDispatch , useTypedSelector } from '../../utils/hooks' ;
50
+ import {
51
+ useAutoRefreshInterval ,
52
+ useSetting ,
53
+ useTypedDispatch ,
54
+ useTypedSelector ,
55
+ } from '../../utils/hooks' ;
46
56
import { useClusterNameFromQuery } from '../../utils/hooks/useDatabaseFromQuery' ;
57
+ import { isNumeric } from '../../utils/utils' ;
47
58
48
59
import i18n from './i18n' ;
49
60
@@ -84,6 +95,8 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
84
95
const filteredTenants = useTypedSelector ( ( state ) => selectFilteredTenants ( state , clusterName ) ) ;
85
96
const problemFilter = useTypedSelector ( selectProblemFilter ) ;
86
97
98
+ const [ showNetworkUtilization ] = useSetting < boolean > ( SHOW_NETWORK_UTILIZATION ) ;
99
+
87
100
const handleProblemFilterChange = ( value : ProblemFilterValue ) => {
88
101
dispatch ( changeFilter ( value ) ) ;
89
102
} ;
@@ -214,6 +227,34 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
214
227
align : DataTable . RIGHT ,
215
228
defaultOrder : DataTable . DESCENDING ,
216
229
} ,
230
+ ] ;
231
+
232
+ if ( showNetworkUtilization ) {
233
+ columns . push ( {
234
+ name : 'Network' ,
235
+ header : 'Network' ,
236
+ width : 120 ,
237
+ align : DataTable . RIGHT ,
238
+ defaultOrder : DataTable . DESCENDING ,
239
+ sortAccessor : ( { NetworkWriteThroughput = 0 } ) => Number ( NetworkWriteThroughput ) ,
240
+ render : ( { row} ) => {
241
+ const { NetworkWriteThroughput} = row ;
242
+
243
+ if ( ! isNumeric ( NetworkWriteThroughput ) ) {
244
+ return EMPTY_DATA_PLACEHOLDER ;
245
+ }
246
+
247
+ return formatBytes ( {
248
+ value : NetworkWriteThroughput ,
249
+ size : 'mb' ,
250
+ withSpeedLabel : true ,
251
+ precision : 2 ,
252
+ } ) ;
253
+ } ,
254
+ } ) ;
255
+ }
256
+
257
+ columns . push (
217
258
{
218
259
name : 'nodesCount' ,
219
260
header : 'Nodes' ,
@@ -241,7 +282,7 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
241
282
align : DataTable . LEFT ,
242
283
render : ( { row} ) => < PoolsGraph pools = { row . PoolStats } /> ,
243
284
} ,
244
- ] ;
285
+ ) ;
245
286
246
287
if ( clusterName && ( isDeleteDBAvailable || isEditDBAvailable ) ) {
247
288
const actionsColumn = getDBActionsColumn ( {
0 commit comments