Skip to content

Commit a4cb568

Browse files
astandrikartemmufazalov
authored andcommitted
fix: dont render network tab for clusters without network (#2905)
1 parent edee104 commit a4cb568

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/MetricsTabs.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,16 @@ export function MetricsTabs({
104104
return null;
105105
}
106106

107+
const canShow =
108+
networkUtilization !== undefined &&
109+
networkThroughput !== undefined &&
110+
isFinite(networkUtilization) &&
111+
isFinite(networkThroughput);
112+
113+
if (!canShow) {
114+
return null;
115+
}
116+
107117
if (isServerless) {
108118
return <PlaceholderTab />;
109119
}

src/containers/Tenant/Diagnostics/TenantOverview/MetricsTabs/components/NetworkTab.tsx

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,31 +5,18 @@ import {cn} from '../../../../../../utils/cn';
55
import {UtilizationTabCard} from '../../TabCard/UtilizationTabCard';
66
import i18n from '../../i18n';
77

8-
import {PlaceholderTab} from './PlaceholderTab';
9-
108
import '../MetricsTabs.scss';
119

1210
const b = cn('tenant-metrics-tabs');
1311

1412
interface NetworkTabProps {
1513
to: string;
1614
active: boolean;
17-
networkUtilization?: number;
18-
networkThroughput?: number;
15+
networkUtilization: number;
16+
networkThroughput: number;
1917
}
2018

2119
export function NetworkTab({to, active, networkUtilization, networkThroughput}: NetworkTabProps) {
22-
const canShow =
23-
networkUtilization !== undefined &&
24-
networkThroughput !== undefined &&
25-
isFinite(networkUtilization) &&
26-
isFinite(networkThroughput) &&
27-
networkThroughput > 0;
28-
29-
if (!canShow) {
30-
return <PlaceholderTab />;
31-
}
32-
3320
const fillPercent = networkUtilization * 100;
3421
const legendText = formatBytes({value: networkThroughput, withSpeedLabel: true});
3522

0 commit comments

Comments
 (0)