Skip to content

Commit a8bd379

Browse files
committed
feat: configurable balancer usage
1 parent 0f30f71 commit a8bd379

File tree

4 files changed

+8
-3
lines changed

4 files changed

+8
-3
lines changed

src/containers/AppWithClusters/utils/useAdditionalTenantsProps.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import {useClusterBaseInfo} from '../../../store/reducers/cluster/cluster';
44
import type {AdditionalTenantsProps} from '../../../types/additionalProps';
55
import type {ETenantType} from '../../../types/api/tenant';
66
import type {GetDatabaseLinks} from '../../../uiFactory/types';
7+
import {uiFactory} from '../../../uiFactory/uiFactory';
78
import {USE_CLUSTER_BALANCER_AS_BACKEND_KEY} from '../../../utils/constants';
89
import {useSetting} from '../../../utils/hooks';
910
import type {GetLogsLink} from '../../../utils/logs';
@@ -26,7 +27,7 @@ export function useAdditionalTenantsProps({
2627

2728
const {balancer, monitoring, logging, name: clusterName} = clusterInfo;
2829

29-
const useMetaProxy = clusterInfo.settings?.use_meta_proxy;
30+
const useMetaProxy = clusterInfo.settings?.use_meta_proxy || uiFactory.useMetaProxy;
3031

3132
const additionalTenantsProps: AdditionalTenantsProps = {};
3233
additionalTenantsProps.prepareTenantBackend = (nodeId) => {

src/store/reducers/clusters/utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import type {MetaClusters} from '../../../types/api/meta';
2+
import {uiFactory} from '../../../uiFactory/uiFactory';
23
import {prepareBackendFromBalancer} from '../../../utils/parseBalancer';
34
import {
45
getVersionMap,
@@ -24,7 +25,7 @@ export const prepareClustersData = (data: MetaClusters): PreparedCluster[] => {
2425
// Apply color map to every cluster in the list
2526
return clusters.map((cluster) => {
2627
// If no backend is provided, it will be automatically generated by API instance
27-
const useMetaProxy = cluster.settings?.use_meta_proxy;
28+
const useMetaProxy = cluster.settings?.use_meta_proxy || uiFactory.useMetaProxy;
2829
const preparedBackend =
2930
cluster.balancer && !useMetaProxy
3031
? prepareBackendFromBalancer(cluster.balancer)

src/uiFactory/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ export interface UIFactory<H extends string = CommonIssueType> {
4747
yaMetricaMap?: Record<string, number>;
4848

4949
useDatabaseId?: boolean;
50+
51+
useMetaProxy?: boolean;
5052
}
5153

5254
export type HandleCreateDB = (params: {clusterName: string}) => Promise<boolean>;

src/utils/hooks/useNodeDeveloperUIHref.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {backend} from '../../store';
22
import {useClusterBaseInfo} from '../../store/reducers/cluster/cluster';
33
import type {NodeAddress} from '../../types/additionalProps';
4+
import {uiFactory} from '../../uiFactory/uiFactory';
45
import {
56
createDeveloperUIInternalPageHref,
67
createDeveloperUILinkWithNodeId,
@@ -16,7 +17,7 @@ export function useNodeDeveloperUIHref(node?: NodeAddress) {
1617
const {balancer = backend, settings} = useClusterBaseInfo();
1718
const isUserAllowedToMakeChanges = useIsUserAllowedToMakeChanges();
1819

19-
const useMetaProxy = settings?.use_meta_proxy;
20+
const useMetaProxy = settings?.use_meta_proxy || !uiFactory.useMetaProxy;
2021

2122
if (!isUserAllowedToMakeChanges) {
2223
return undefined;

0 commit comments

Comments
 (0)