1
1
import { Loader } from '@gravity-ui/uikit' ;
2
2
3
3
import { EntityStatus } from '../../../../components/EntityStatus/EntityStatus' ;
4
+ import { useGetSchemaQuery } from '../../../../store/reducers/schema/schema' ;
4
5
import { TENANT_METRICS_TABS_IDS } from '../../../../store/reducers/tenant/constants' ;
5
6
import { tenantApi } from '../../../../store/reducers/tenant/tenant' ;
6
7
import { calculateTenantMetrics } from '../../../../store/reducers/tenants/utils' ;
@@ -44,6 +45,35 @@ export function TenantOverview({
44
45
45
46
const tenantType = mapDatabaseTypeToDBName ( Type ) ;
46
47
48
+ // FIXME: remove after correct data is added to tenantInfo
49
+ const { data : tenantSchemaData } = useGetSchemaQuery ( { path : tenantName } ) ;
50
+ const { Tables, Topics} =
51
+ tenantSchemaData ?. PathDescription ?. DomainDescription ?. DiskSpaceUsage || { } ;
52
+
53
+ const usedTabletStorage = [
54
+ Tables ?. TotalSize ,
55
+ Topics ?. AccountSize ,
56
+ Topics ?. DataSize ,
57
+ Topics ?. ReserveSize ,
58
+ Topics ?. UsedReserveSize ,
59
+ ] . reduce ( ( sum , current ) => {
60
+ if ( current ) {
61
+ return sum + Number ( current ) ;
62
+ }
63
+
64
+ return sum ;
65
+ } , 0 ) ;
66
+
67
+ const tenantData = {
68
+ ...tenant ,
69
+ Metrics : {
70
+ ...tenant ?. Metrics ,
71
+ // Replace incorrect tenant metric with correct value
72
+ Storage : String ( usedTabletStorage ) ,
73
+ } ,
74
+ } ;
75
+ // === === ===
76
+
47
77
const {
48
78
blobStorage,
49
79
tabletStorage,
@@ -54,7 +84,7 @@ export function TenantOverview({
54
84
memoryStats,
55
85
blobStorageStats,
56
86
tabletStorageStats,
57
- } = calculateTenantMetrics ( tenant ?? undefined ) ;
87
+ } = calculateTenantMetrics ( tenantData ) ;
58
88
59
89
const storageMetrics = {
60
90
blobStorageUsed : blobStorage ,
0 commit comments