Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,16 @@ export function MetricsTabs({
return null;
}

const canShow =
networkUtilization !== undefined &&
networkThroughput !== undefined &&
isFinite(networkUtilization) &&
isFinite(networkThroughput);

if (!canShow) {
return null;
}

if (isServerless) {
return <PlaceholderTab />;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,18 @@ import {cn} from '../../../../../../utils/cn';
import {UtilizationTabCard} from '../../TabCard/UtilizationTabCard';
import i18n from '../../i18n';

import {PlaceholderTab} from './PlaceholderTab';

import '../MetricsTabs.scss';

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

interface NetworkTabProps {
to: string;
active: boolean;
networkUtilization?: number;
networkThroughput?: number;
networkUtilization: number;
networkThroughput: number;
}

export function NetworkTab({to, active, networkUtilization, networkThroughput}: NetworkTabProps) {
const canShow =
networkUtilization !== undefined &&
networkThroughput !== undefined &&
isFinite(networkUtilization) &&
isFinite(networkThroughput) &&
networkThroughput > 0;

if (!canShow) {
return <PlaceholderTab />;
}

const fillPercent = networkUtilization * 100;
const legendText = formatBytes({value: networkThroughput, withSpeedLabel: true});

Expand Down
Loading