11import { ClipboardButton } from '@gravity-ui/uikit' ;
2+ import { isNil } from 'lodash' ;
23
34import { useClusterBaseInfo } from '../../../store/reducers/cluster/cluster' ;
4- import type {
5- AdditionalClusterProps ,
6- AdditionalTenantsProps ,
7- NodeAddress ,
8- } from '../../../types/additionalProps' ;
5+ import type { AdditionalClusterProps , AdditionalTenantsProps } from '../../../types/additionalProps' ;
96import type { ETenantType } from '../../../types/api/tenant' ;
107import { cn } from '../../../utils/cn' ;
118import { USE_CLUSTER_BALANCER_AS_BACKEND_KEY } from '../../../utils/constants' ;
@@ -16,8 +13,8 @@ import type {
1613 GetMonitoringClusterLink ,
1714 GetMonitoringLink ,
1815} from '../../../utils/monitoring' ;
19- import { getCleanBalancerValue , removeViewerPathname } from '../../../utils/parseBalancer' ;
20- import { getBackendFromNodeHost , getBackendFromRawNodeData } from '../../../utils/prepareBackend' ;
16+ import { getCleanBalancerValue , prepareBackendFromBalancer } from '../../../utils/parseBalancer' ;
17+ import { getBackendFromBalancerAndNodeId } from '../../../utils/prepareBackend' ;
2118import type { Cluster } from '../../Cluster/Cluster' ;
2219
2320import './ExtendedCluster.scss' ;
@@ -89,27 +86,21 @@ const getAdditionalTenantsProps = ({
8986} : GetAdditionalTenantsProps ) => {
9087 const additionalTenantsProps : AdditionalTenantsProps = { } ;
9188
92- additionalTenantsProps . prepareTenantBackend = (
93- nodeHostOrAddress : string | NodeAddress | undefined ,
94- ) => {
95- // Proxy received from balancer value, so it's necessary
89+ additionalTenantsProps . prepareTenantBackend = ( nodeId ) => {
90+ // Balancer value is used to create path, so it's necessary
9691 if ( ! balancer ) {
9792 return undefined ;
9893 }
9994
10095 if ( useClusterBalancerAsBackend ) {
101- return removeViewerPathname ( balancer ) ;
96+ return prepareBackendFromBalancer ( balancer ) ;
10297 }
10398
104- if ( ! nodeHostOrAddress ) {
99+ if ( isNil ( nodeId ) ) {
105100 return undefined ;
106101 }
107102
108- if ( typeof nodeHostOrAddress === 'string' ) {
109- return getBackendFromNodeHost ( nodeHostOrAddress , balancer ) ;
110- }
111-
112- return getBackendFromRawNodeData ( nodeHostOrAddress , balancer , true ) ?? undefined ;
103+ return getBackendFromBalancerAndNodeId ( nodeId , balancer ) ?? undefined ;
113104 } ;
114105
115106 if ( monitoring && getMonitoringLink ) {
0 commit comments