diff --git a/src/containers/Clusters/columns.tsx b/src/containers/Clusters/columns.tsx
index 301c2ad926..3534ddece9 100644
--- a/src/containers/Clusters/columns.tsx
+++ b/src/containers/Clusters/columns.tsx
@@ -14,19 +14,18 @@ import {
import {EntityStatus} from '../../components/EntityStatusNew/EntityStatus';
import {VersionsBar} from '../../components/VersionsBar/VersionsBar';
-import {getClusterPath} from '../../routes';
import type {PreparedCluster} from '../../store/reducers/clusters/types';
import {EFlag} from '../../types/api/enums';
import {uiFactory} from '../../uiFactory/uiFactory';
import {EMPTY_DATA_PLACEHOLDER} from '../../utils/constants';
import {formatNumber, formatStorageValuesToTb} from '../../utils/dataFormatters/dataFormatters';
-import {createDeveloperUIMonitoringPageHref} from '../../utils/developerUI/developerUI';
import {getCleanBalancerValue} from '../../utils/parseBalancer';
import {clusterTabsIds} from '../Cluster/utils';
import {COLUMNS_NAMES, COLUMNS_TITLES} from './constants';
import i18n from './i18n';
import {b} from './shared';
+import {calculateClusterPath} from './utils';
export const CLUSTERS_COLUMNS_WIDTH_LS_KEY = 'clustersTableColumnsWidth';
const EMPTY_CELL = {EMPTY_DATA_PLACEHOLDER};
@@ -144,23 +143,13 @@ interface ClusterNameProps {
}
function ClusterName({row}: ClusterNameProps) {
- const {
- name: clusterName,
- use_embedded_ui: useEmbeddedUi,
- preparedBackend: backend,
- settings,
- } = row;
- const clusterPath =
- useEmbeddedUi && backend
- ? createDeveloperUIMonitoringPageHref(backend)
- : getClusterPath(
- {environment: settings?.auth_service},
- {backend, clusterName},
- {withBasename: true},
- );
+ const clusterPath = calculateClusterPath(row);
+
return (
- {row.title || row.name}
+
+ {row.title || row.name}
+
);
}
@@ -358,26 +347,17 @@ interface VersionsProps {
}
function Versions({row}: VersionsProps) {
- const {
- preparedVersions,
- name: clusterName,
- preparedBackend: backend,
- settings,
- use_embedded_ui: useEmbeddedUi,
- } = row;
+ const {preparedVersions} = row;
if (!preparedVersions.length) {
return null;
}
- const clusterPath =
- useEmbeddedUi && backend
- ? createDeveloperUIMonitoringPageHref(backend)
- : getClusterPath(
- {activeTab: clusterTabsIds.versions, environment: settings?.auth_service},
- {backend, clusterName},
- {withBasename: true},
- );
+ const clusterPath = calculateClusterPath(row, clusterTabsIds.versions);
return (
-
+
);
diff --git a/src/containers/Clusters/utils.ts b/src/containers/Clusters/utils.ts
new file mode 100644
index 0000000000..c5196b1a59
--- /dev/null
+++ b/src/containers/Clusters/utils.ts
@@ -0,0 +1,28 @@
+import {getClusterPath} from '../../routes';
+import type {PreparedCluster} from '../../store/reducers/clusters/types';
+import {createDeveloperUIMonitoringPageHref} from '../../utils/developerUI/developerUI';
+import type {ClusterTab} from '../Cluster/utils';
+
+export function calculateClusterPath(row: PreparedCluster, activeTab?: ClusterTab): string {
+ const {
+ use_embedded_ui: useEmbeddedUi,
+ preparedBackend: backend,
+ name: clusterName,
+ clusterDomain,
+ settings,
+ } = row;
+
+ if (useEmbeddedUi && backend) {
+ return createDeveloperUIMonitoringPageHref(backend);
+ }
+
+ return getClusterPath(
+ {
+ activeTab,
+ environment: settings?.auth_service,
+ },
+ {backend, clusterName},
+ {withBasename: true},
+ clusterDomain,
+ );
+}
diff --git a/src/routes.ts b/src/routes.ts
index 818944a8c2..c0955bb85a 100644
--- a/src/routes.ts
+++ b/src/routes.ts
@@ -71,6 +71,7 @@ export function createHref(
params?: Record,
query: Query = {},
options: CreateHrefOptions = {},
+ domain = '',
) {
let extendedQuery = query;
let extendedParams = params ?? {};
@@ -103,9 +104,10 @@ export function createHref(
if (options.withBasename && basename) {
// For SPA links react-router adds basename itself
// It is needed for external links - or uikit
- return normalizePathSlashes(`${basename}/${compiledRoute}`);
+ return normalizePathSlashes(`${domain}${basename}/${compiledRoute}`);
}
- return compiledRoute;
+
+ return `${domain}${compiledRoute}`;
}
// embedded version could be located in some folder (e.g. host/some_folder/app_router_path)
@@ -150,8 +152,9 @@ export const getClusterPath = (
params?: {activeTab?: ClusterTab; environment?: string},
query = {},
options?: CreateHrefOptions,
+ domain?: string,
) => {
- return createHref(routes.cluster, params, query, options);
+ return createHref(routes.cluster, params, query, options, domain);
};
export const getTenantPath = (query: TenantQuery, options?: CreateHrefOptions) => {
diff --git a/src/store/reducers/cluster/parseFields.ts b/src/store/reducers/cluster/parseFields.ts
index 615509746b..7cf97b2eac 100644
--- a/src/store/reducers/cluster/parseFields.ts
+++ b/src/store/reducers/cluster/parseFields.ts
@@ -69,6 +69,7 @@ export function parseLoggingUrls(
const settingsSchema = z.object({
use_meta_proxy: z.boolean().optional(),
+ cluster_domain: z.string().optional(),
});
export function parseSettingsField(
diff --git a/src/store/reducers/clusters/types.ts b/src/store/reducers/clusters/types.ts
index 8055210760..275c0adf07 100644
--- a/src/store/reducers/clusters/types.ts
+++ b/src/store/reducers/clusters/types.ts
@@ -5,6 +5,7 @@ export interface PreparedCluster extends Omit {
const parsedSettings = parseSettingsField(cluster.settings);
// If no backend is provided, it will be automatically generated by API instance
const useMetaProxy = uiFactory.useMetaProxy && parsedSettings?.use_meta_proxy !== false;
+ const clusterDomain = uiFactory.useClusterDomain
+ ? parsedSettings?.cluster_domain
+ : undefined;
const preparedBackend =
cluster.balancer && !useMetaProxy
? prepareBackendFromBalancer(cluster.balancer)
@@ -38,6 +41,7 @@ export const prepareClustersData = (data: MetaClusters): PreparedCluster[] => {
preparedVersions: prepareClusterVersions(cluster.versions, versionsData),
preparedBackend,
settings: parsedSettings,
+ clusterDomain,
};
});
};
diff --git a/src/types/api/meta.ts b/src/types/api/meta.ts
index 87974ee8c1..224e659df0 100644
--- a/src/types/api/meta.ts
+++ b/src/types/api/meta.ts
@@ -98,4 +98,5 @@ export interface MetaClusterTraceCheck {
export interface MetaClusterSettings {
use_meta_proxy?: boolean;
auth_service?: string;
+ cluster_domain?: string;
}
diff --git a/src/uiFactory/types.ts b/src/uiFactory/types.ts
index 0dcafa541b..a3aea7469f 100644
--- a/src/uiFactory/types.ts
+++ b/src/uiFactory/types.ts
@@ -50,6 +50,7 @@ export interface UIFactory