From 3f6547724ed730e319ebf3e2d181e530c5817e7a Mon Sep 17 00:00:00 2001 From: KROSY Date: Mon, 2 Oct 2023 18:45:58 +0300 Subject: [PATCH] fix: fix types in TTenant --- src/store/reducers/tenants/utils.ts | 11 +++++++---- src/types/api/tenant.ts | 17 ++++++++++++++++- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/store/reducers/tenants/utils.ts b/src/store/reducers/tenants/utils.ts index 2331ba5ce..36b53cbe8 100644 --- a/src/store/reducers/tenants/utils.ts +++ b/src/store/reducers/tenants/utils.ts @@ -28,8 +28,9 @@ export const calculateTenantMetrics = (tenant?: TTenant) => { StorageAllocatedSize, CoresLimit, MemoryLimit, - StorageLimit, + StorageAllocatedLimit, Metrics = {}, + DatabaseQuotas = {}, } = tenant || {}; const cpuFromCores = isNumeric(CoresUsed) ? Number(CoresUsed) * 1_000_000 : undefined; @@ -46,9 +47,11 @@ export const calculateTenantMetrics = (tenant?: TTenant) => { const tableStorage = isNumeric(Metrics.Storage) ? Number(Metrics.Storage) : undefined; const cpuLimit = isNumeric(CoresLimit) ? Number(CoresLimit) : undefined; const memoryLimit = isNumeric(MemoryLimit) ? Number(MemoryLimit) : undefined; - const blobStorageLimit = isNumeric(StorageLimit) ? Number(StorageLimit) : undefined; - const tableStorageLimit = isNumeric(Metrics.StorageLimit) - ? Number(Metrics.StorageLimit) + const blobStorageLimit = isNumeric(StorageAllocatedLimit) + ? Number(StorageAllocatedLimit) + : undefined; + const tableStorageLimit = isNumeric(DatabaseQuotas.data_size_hard_quota) + ? Number(DatabaseQuotas.data_size_hard_quota) : undefined; return { diff --git a/src/types/api/tenant.ts b/src/types/api/tenant.ts index 5a0576b51..ab744c4e5 100644 --- a/src/types/api/tenant.ts +++ b/src/types/api/tenant.ts @@ -59,7 +59,9 @@ export interface TTenant { ControlPlane?: ControlPlane; // additional CoresLimit?: string; // TODO: check correctness in backend protos when fully supported - StorageLimit?: string; // TODO: check correctness in backend protos when fully supported + /** uint64 */ + StorageAllocatedLimit?: string; + DatabaseQuotas?: DatabaseQuotas; } interface THiveDomainStatsStateCount { @@ -149,3 +151,16 @@ export enum ETabletVolatileState { 'TABLET_VOLATILE_STATE_STARTING' = 'TABLET_VOLATILE_STATE_STARTING', 'TABLET_VOLATILE_STATE_RUNNING' = 'TABLET_VOLATILE_STATE_RUNNING', } + +interface DatabaseQuotas { + /** uint64 */ + data_size_hard_quota?: string; + /** uint64 */ + data_size_soft_quota?: string; + /** uint64 */ + data_stream_shards_quota?: string; + /** uint64 */ + data_stream_reserved_storage_quota?: string; + /** uint32 */ + ttl_min_run_internal_seconds?: string; +}