@@ -12,9 +12,9 @@ import {
1212} from '../../../components/nodesColumns/columns' ;
1313import type { GetNodesColumnsParams } from '../../../components/nodesColumns/types' ;
1414import { EMPTY_DATA_PLACEHOLDER } from '../../../lib' ;
15+ import { formatBytes } from '../../../utils/bytesParsers' ;
1516import { formatDateTime } from '../../../utils/dataFormatters/dataFormatters' ;
1617import type { Column } from '../../../utils/tableUtils/types' ;
17- import { bytesToMB , isNumeric } from '../../../utils/utils' ;
1818
1919import {
2020 NODE_NETWORK_COLUMNS_IDS ,
@@ -35,15 +35,22 @@ function getPeerConnectTimeColumn<T extends {ConnectTime?: string}>(): Column<T>
3535 } ;
3636}
3737
38+ function renderBytes ( bytes ?: number | string ) {
39+ return formatBytes ( {
40+ value : bytes ,
41+ size : 'mb' ,
42+ withSizeLabel : true ,
43+ } ) ;
44+ }
45+
3846function getPeerSentBytesColumn < T extends { BytesSend ?: string | number } > ( ) : Column < T > {
3947 return {
4048 name : NODE_NETWORK_COLUMNS_IDS . BytesSend ,
4149 header : NODE_NETWORK_COLUMNS_TITLES . BytesSend ,
4250 align : DataTable . RIGHT ,
4351 width : 140 ,
4452 resizeMinWidth : 120 ,
45- render : ( { row} ) =>
46- isNumeric ( row . BytesSend ) ? bytesToMB ( row . BytesSend , 0 ) : EMPTY_DATA_PLACEHOLDER ,
53+ render : ( { row} ) => renderBytes ( row . BytesSend ) || EMPTY_DATA_PLACEHOLDER ,
4754 } ;
4855}
4956
@@ -54,8 +61,7 @@ function getPeerReceivedBytesColumn<T extends {BytesReceived?: string | number}>
5461 align : DataTable . RIGHT ,
5562 width : 160 ,
5663 resizeMinWidth : 130 ,
57- render : ( { row} ) =>
58- isNumeric ( row . BytesReceived ) ? bytesToMB ( row . BytesReceived , 0 ) : EMPTY_DATA_PLACEHOLDER ,
64+ render : ( { row} ) => renderBytes ( row . BytesReceived ) || EMPTY_DATA_PLACEHOLDER ,
5965 } ;
6066}
6167
0 commit comments