@@ -19,9 +19,11 @@ import {calculateMetricAggregates} from '../../../../../utils/metrics';
1919// no direct legend formatters needed here – handled in subcomponents
2020import { TenantTabsGroups , getTenantPath } from '../../../TenantPages' ;
2121
22- import { CommonMetricsTabs } from './CommonMetricsTabs' ;
23- import { DedicatedMetricsTabs } from './DedicatedMetricsTabs' ;
24- import { ServerlessPlaceholderTabs } from './ServerlessPlaceholderTabs' ;
22+ import { CpuTab } from './components/CpuTab' ;
23+ import { MemoryTab } from './components/MemoryTab' ;
24+ import { NetworkTab } from './components/NetworkTab' ;
25+ import { PlaceholderTab } from './components/PlaceholderTab' ;
26+ import { StorageTab } from './components/StorageTab' ;
2527
2628import './MetricsTabs.scss' ;
2729
@@ -32,7 +34,8 @@ interface MetricsTabsProps {
3234 memoryStats ?: TenantMetricStats [ ] ;
3335 blobStorageStats ?: TenantStorageStats [ ] ;
3436 tabletStorageStats ?: TenantStorageStats [ ] ;
35- networkStats ?: TenantMetricStats [ ] ;
37+ networkUtilization ?: number ;
38+ networkThroughput ?: number ;
3639 storageGroupsCount ?: number ;
3740 databaseType ?: ETenantType ;
3841 activeTab : TenantMetricsTab ;
@@ -43,7 +46,8 @@ export function MetricsTabs({
4346 memoryStats,
4447 blobStorageStats,
4548 tabletStorageStats,
46- networkStats,
49+ networkUtilization,
50+ networkThroughput,
4751 storageGroupsCount,
4852 databaseType,
4953 activeTab,
@@ -88,44 +92,63 @@ export function MetricsTabs({
8892 // Calculate memory metrics using utility
8993 const memoryMetrics = useMemo ( ( ) => calculateMetricAggregates ( memoryStats ) , [ memoryStats ] ) ;
9094
91- // Calculate network metrics using utility
95+ // Pass raw network values; DedicatedMetricsTabs computes percent and legend
9296 const [ showNetworkUtilization ] = useSetting < boolean > ( SHOW_NETWORK_UTILIZATION ) ;
93- const networkMetrics = useMemo (
94- ( ) => ( networkStats ? calculateMetricAggregates ( networkStats ) : null ) ,
95- [ networkStats ] ,
96- ) ;
9797
9898 // card variant is handled within subcomponents
9999
100100 const isServerless = databaseType === 'Serverless' ;
101101
102+ const renderNetworkTab = ( ) => {
103+ if ( ! showNetworkUtilization ) {
104+ return null ;
105+ }
106+
107+ if ( isServerless ) {
108+ return < PlaceholderTab /> ;
109+ }
110+
111+ return (
112+ < NetworkTab
113+ to = { tabLinks [ TENANT_METRICS_TABS_IDS . network ] }
114+ active = { activeTab === TENANT_METRICS_TABS_IDS . network }
115+ networkUtilization = { networkUtilization }
116+ networkThroughput = { networkThroughput }
117+ />
118+ ) ;
119+ } ;
120+
102121 return (
103122 < Flex className = { b ( { serverless : Boolean ( isServerless ) } ) } alignItems = "center" >
104- < CommonMetricsTabs
105- activeTab = { activeTab }
106- tabLinks = { tabLinks }
123+ < CpuTab
124+ to = { tabLinks [ TENANT_METRICS_TABS_IDS . cpu ] }
125+ active = { activeTab === TENANT_METRICS_TABS_IDS . cpu }
126+ isServerless = { Boolean ( isServerless ) }
107127 cpu = { { totalUsed : cpuMetrics . totalUsed , totalLimit : cpuMetrics . totalLimit } }
128+ />
129+ < StorageTab
130+ to = { tabLinks [ TENANT_METRICS_TABS_IDS . storage ] }
131+ active = { activeTab === TENANT_METRICS_TABS_IDS . storage }
132+ isServerless = { Boolean ( isServerless ) }
108133 storage = { {
109134 totalUsed : storageMetrics . totalUsed ,
110135 totalLimit : storageMetrics . totalLimit ,
111136 } }
112137 storageGroupsCount = { storageGroupsCount }
113- databaseType = { databaseType }
114138 />
115139 { isServerless ? (
116- < ServerlessPlaceholderTabs />
140+ < PlaceholderTab />
117141 ) : (
118- < DedicatedMetricsTabs
119- activeTab = { activeTab }
120- tabLinks = { tabLinks }
142+ < MemoryTab
143+ to = { tabLinks [ TENANT_METRICS_TABS_IDS . memory ] }
144+ active = { activeTab === TENANT_METRICS_TABS_IDS . memory }
121145 memory = { {
122146 totalUsed : memoryMetrics . totalUsed ,
123147 totalLimit : memoryMetrics . totalLimit ,
124148 } }
125- network = { networkMetrics }
126- showNetwork = { Boolean ( showNetworkUtilization && networkStats && networkMetrics ) }
127149 />
128150 ) }
151+ { renderNetworkTab ( ) }
129152 </ Flex >
130153 ) ;
131154}
0 commit comments