Skip to content

Commit

Permalink
fix(api): correctly get cluster info from data (/meta/db_clusters) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Sep 18, 2024
1 parent 8531b95 commit 762f8ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/services/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -843,13 +849,13 @@ export class YdbWebVersionAPI extends YdbEmbeddedAPI {
clusterName: string,
{concurrentId, signal}: AxiosOptions = {},
): Promise<MetaBaseClusterInfo> {
return this.get<MetaBaseClusterInfo[]>(
return this.get<MetaBaseClusters>(
`${META_BACKEND || ''}/meta/db_clusters`,
{
name: clusterName,
},
{concurrentId, requestConfig: {signal}},
).then((data) => data[0]);
).then((data) => data.clusters[0]);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/types/api/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface MetaExtendedClusterInfo extends MetaGeneralClusterInfo {
versions?: MetaClusterVersion[];
}

export interface MetaBaseClusters {
clusters: MetaBaseClusterInfo[];
}

export interface MetaBaseClusterInfo {
owner?: string;
location?: string;
Expand Down

0 comments on commit 762f8ed

Please sign in to comment.