@@ -35,15 +35,27 @@ import {setSearchValue, tenantsApi} from '../../store/reducers/tenants/tenants';
3535import type { PreparedTenant } from '../../store/reducers/tenants/types' ;
3636import type { AdditionalTenantsProps } from '../../types/additionalProps' ;
3737import { uiFactory } from '../../uiFactory/uiFactory' ;
38+ import { formatBytes } from '../../utils/bytesParsers' ;
3839import { 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' ;
4045import {
4146 formatCPU ,
4247 formatNumber ,
48+ formatPercent ,
4349 formatStorageValuesToGb ,
4450} from '../../utils/dataFormatters/dataFormatters' ;
45- import { useAutoRefreshInterval , useTypedDispatch , useTypedSelector } from '../../utils/hooks' ;
51+ import {
52+ useAutoRefreshInterval ,
53+ useSetting ,
54+ useTypedDispatch ,
55+ useTypedSelector ,
56+ } from '../../utils/hooks' ;
4657import { useClusterNameFromQuery } from '../../utils/hooks/useDatabaseFromQuery' ;
58+ import { isNumeric } from '../../utils/utils' ;
4759
4860import i18n from './i18n' ;
4961
@@ -84,6 +96,8 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
8496 const filteredTenants = useTypedSelector ( ( state ) => selectFilteredTenants ( state , clusterName ) ) ;
8597 const problemFilter = useTypedSelector ( selectProblemFilter ) ;
8698
99+ const [ showNetworkUtilization ] = useSetting < boolean > ( SHOW_NETWORK_UTILIZATION ) ;
100+
87101 const handleProblemFilterChange = ( value : ProblemFilterValue ) => {
88102 dispatch ( changeFilter ( value ) ) ;
89103 } ;
@@ -214,6 +228,53 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
214228 align : DataTable . RIGHT ,
215229 defaultOrder : DataTable . DESCENDING ,
216230 } ,
231+ ] ;
232+
233+ if ( showNetworkUtilization ) {
234+ columns . push (
235+ {
236+ name : 'NetworkUtilization' ,
237+ header : 'NetworkUtilization' ,
238+ width : 120 ,
239+ align : DataTable . RIGHT ,
240+ defaultOrder : DataTable . DESCENDING ,
241+ sortAccessor : ( { NetworkUtilization = 0 } ) => Number ( NetworkUtilization ) ,
242+ render : ( { row} ) => {
243+ const { NetworkUtilization} = row ;
244+
245+ if ( ! isNumeric ( NetworkUtilization ) ) {
246+ return EMPTY_DATA_PLACEHOLDER ;
247+ }
248+
249+ return formatPercent ( NetworkUtilization ) ;
250+ } ,
251+ } ,
252+ {
253+ name : 'NetworkWriteThroughput' ,
254+ header : 'NetworkWriteThroughput' ,
255+ width : 120 ,
256+ align : DataTable . RIGHT ,
257+ defaultOrder : DataTable . DESCENDING ,
258+ sortAccessor : ( { NetworkWriteThroughput = 0 } ) => Number ( NetworkWriteThroughput ) ,
259+ render : ( { row} ) => {
260+ const { NetworkWriteThroughput} = row ;
261+
262+ if ( ! isNumeric ( NetworkWriteThroughput ) ) {
263+ return EMPTY_DATA_PLACEHOLDER ;
264+ }
265+
266+ return formatBytes ( {
267+ value : NetworkWriteThroughput ,
268+ size : 'mb' ,
269+ withSpeedLabel : true ,
270+ precision : 2 ,
271+ } ) ;
272+ } ,
273+ } ,
274+ ) ;
275+ }
276+
277+ columns . push (
217278 {
218279 name : 'nodesCount' ,
219280 header : 'Nodes' ,
@@ -241,7 +302,7 @@ export const Tenants = ({additionalTenantsProps, scrollContainerRef}: TenantsPro
241302 align : DataTable . LEFT ,
242303 render : ( { row} ) => < PoolsGraph pools = { row . PoolStats } /> ,
243304 } ,
244- ] ;
305+ ) ;
245306
246307 if ( clusterName && ( isDeleteDBAvailable || isEditDBAvailable ) ) {
247308 const actionsColumn = getDBActionsColumn ( {
0 commit comments