Skip to content

Commit 15a93fd

Browse files
authored
fix: incorrect storage group count (#2653)
1 parent c6b9fe5 commit 15a93fd

File tree

3 files changed

+18
-21
lines changed

3 files changed

+18
-21
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ interface MetricsTabsProps {
3232
blobStorageStats?: TenantStorageStats[];
3333
tabletStorageStats?: TenantStorageStats[];
3434
networkStats?: TenantMetricStats[];
35+
storageGroupsCount?: number;
3536
}
3637

3738
export function MetricsTabs({
@@ -40,6 +41,7 @@ export function MetricsTabs({
4041
blobStorageStats,
4142
tabletStorageStats,
4243
networkStats,
44+
storageGroupsCount,
4345
}: MetricsTabsProps) {
4446
const location = useLocation();
4547
const {metricsTab} = useTypedSelector((state) => state.tenant);
@@ -73,7 +75,6 @@ export function MetricsTabs({
7375
// Calculate storage metrics using utility
7476
const storageStats = tabletStorageStats || blobStorageStats || [];
7577
const storageMetrics = calculateMetricAggregates(storageStats);
76-
const storageGroupCount = storageStats.length;
7778

7879
// Calculate memory metrics using utility
7980
const memoryMetrics = calculateMetricAggregates(memoryStats);
@@ -91,8 +92,7 @@ export function MetricsTabs({
9192
>
9293
<Link to={tabLinks.cpu} className={b('link')}>
9394
<TabCard
94-
label={i18n('cards.cpu-label')}
95-
sublabel={i18n('context_cpu-load')}
95+
text={i18n('context_cpu-load')}
9696
value={cpuMetrics.totalUsed}
9797
limit={cpuMetrics.totalLimit}
9898
legendFormatter={formatCoresLegend}
@@ -108,8 +108,11 @@ export function MetricsTabs({
108108
>
109109
<Link to={tabLinks.storage} className={b('link')}>
110110
<TabCard
111-
label={i18n('cards.storage-label')}
112-
sublabel={i18n('context_storage-groups', {count: storageGroupCount})}
111+
text={
112+
storageGroupsCount === undefined
113+
? i18n('cards.storage-label')
114+
: i18n('context_storage-groups', {count: storageGroupsCount})
115+
}
113116
value={storageMetrics.totalUsed}
114117
limit={storageMetrics.totalLimit}
115118
legendFormatter={formatStorageLegend}
@@ -125,8 +128,7 @@ export function MetricsTabs({
125128
>
126129
<Link to={tabLinks.memory} className={b('link')}>
127130
<TabCard
128-
label={i18n('cards.memory-label')}
129-
sublabel={i18n('context_memory-used')}
131+
text={i18n('context_memory-used')}
130132
value={memoryMetrics.totalUsed}
131133
limit={memoryMetrics.totalLimit}
132134
legendFormatter={formatStorageLegend}
@@ -143,8 +145,7 @@ export function MetricsTabs({
143145
>
144146
<Link to={tabLinks.network} className={b('link')}>
145147
<TabCard
146-
label={i18n('cards.network-label')}
147-
sublabel={i18n('context_network-usage')}
148+
text={i18n('context_network-usage')}
148149
value={networkMetrics.totalUsed}
149150
limit={networkMetrics.totalLimit}
150151
legendFormatter={formatSpeedLegend}

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

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,24 +9,15 @@ import './TabCard.scss';
99
const b = cn('tenant-tab-card');
1010

1111
interface TabCardProps {
12-
label: string;
13-
sublabel?: string;
12+
text: string;
1413
value: number;
1514
limit: number;
1615
active?: boolean;
1716
helpText?: string;
1817
legendFormatter: (params: {value: number; capacity: number}) => string;
1918
}
2019

21-
export function TabCard({
22-
label,
23-
sublabel,
24-
value,
25-
limit,
26-
active,
27-
helpText,
28-
legendFormatter,
29-
}: TabCardProps) {
20+
export function TabCard({text, value, limit, active, helpText, legendFormatter}: TabCardProps) {
3021
const {status, percents, legend, fill} = getDiagramValues({
3122
value,
3223
capacity: limit,
@@ -61,7 +52,7 @@ export function TabCard({
6152
note={helpText}
6253
noteIconSize="s"
6354
>
64-
{sublabel || label}
55+
{text}
6556
</DoughnutMetrics.Legend>
6657
</div>
6758
</Flex>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ export function TenantOverview({
178178
blobStorageStats={blobStorageStats}
179179
tabletStorageStats={tabletStorageStats}
180180
networkStats={networkStats}
181+
storageGroupsCount={
182+
tenantData.StorageGroups
183+
? Number(tenantData.StorageGroups)
184+
: undefined
185+
}
181186
/>
182187
</Flex>
183188
</div>

0 commit comments

Comments
 (0)