From 762f8ede6cda7b3f3e20eb7d69286d5ff76ea627 Mon Sep 17 00:00:00 2001 From: Valerii Sidorenko Date: Wed, 18 Sep 2024 15:18:03 +0200 Subject: [PATCH] fix(api): correctly get cluster info from data (/meta/db_clusters) (#1314) --- src/services/api.ts | 12 +++++++++--- src/types/api/meta.ts | 4 ++++ 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/src/services/api.ts b/src/services/api.ts index f5f538ef2..1ccf4d305 100644 --- a/src/services/api.ts +++ b/src/services/api.ts @@ -13,7 +13,13 @@ import type {DescribeConsumerResult} from '../types/api/consumer'; import type {FeatureFlagConfigs} from '../types/api/featureFlags'; import type {HealthCheckAPIResponse} from '../types/api/healthcheck'; import type {JsonHotKeysResponse} from '../types/api/hotkeys'; -import type {MetaBaseClusterInfo, MetaCluster, MetaClusters, MetaTenants} from '../types/api/meta'; +import type { + MetaBaseClusterInfo, + MetaBaseClusters, + MetaCluster, + MetaClusters, + MetaTenants, +} from '../types/api/meta'; import type {ModifyDiskResponse} from '../types/api/modifyDisk'; import type {TNetInfo} from '../types/api/netInfo'; import type {TNodesInfo} from '../types/api/nodes'; @@ -843,13 +849,13 @@ export class YdbWebVersionAPI extends YdbEmbeddedAPI { clusterName: string, {concurrentId, signal}: AxiosOptions = {}, ): Promise { - return this.get( + return this.get( `${META_BACKEND || ''}/meta/db_clusters`, { name: clusterName, }, {concurrentId, requestConfig: {signal}}, - ).then((data) => data[0]); + ).then((data) => data.clusters[0]); } } diff --git a/src/types/api/meta.ts b/src/types/api/meta.ts index ee7d946dc..c53044875 100644 --- a/src/types/api/meta.ts +++ b/src/types/api/meta.ts @@ -22,6 +22,10 @@ export interface MetaExtendedClusterInfo extends MetaGeneralClusterInfo { versions?: MetaClusterVersion[]; } +export interface MetaBaseClusters { + clusters: MetaBaseClusterInfo[]; +} + export interface MetaBaseClusterInfo { owner?: string; location?: string;