1
1
import { ClipboardButton } from '@gravity-ui/uikit' ;
2
+ import { isNil } from 'lodash' ;
2
3
3
4
import { 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' ;
9
6
import type { ETenantType } from '../../../types/api/tenant' ;
10
7
import { cn } from '../../../utils/cn' ;
11
8
import { USE_CLUSTER_BALANCER_AS_BACKEND_KEY } from '../../../utils/constants' ;
@@ -16,8 +13,8 @@ import type {
16
13
GetMonitoringClusterLink ,
17
14
GetMonitoringLink ,
18
15
} 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' ;
21
18
import type { Cluster } from '../../Cluster/Cluster' ;
22
19
23
20
import './ExtendedCluster.scss' ;
@@ -89,27 +86,21 @@ const getAdditionalTenantsProps = ({
89
86
} : GetAdditionalTenantsProps ) => {
90
87
const additionalTenantsProps : AdditionalTenantsProps = { } ;
91
88
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
96
91
if ( ! balancer ) {
97
92
return undefined ;
98
93
}
99
94
100
95
if ( useClusterBalancerAsBackend ) {
101
- return removeViewerPathname ( balancer ) ;
96
+ return prepareBackendFromBalancer ( balancer ) ;
102
97
}
103
98
104
- if ( ! nodeHostOrAddress ) {
99
+ if ( isNil ( nodeId ) ) {
105
100
return undefined ;
106
101
}
107
102
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 ;
113
104
} ;
114
105
115
106
if ( monitoring && getMonitoringLink ) {
0 commit comments