1
- import { Link } from 'react-router-dom'
1
+ import { generatePath , Link } from 'react-router-dom'
2
2
3
3
import {
4
- ALL_NAMESPACE_OPTION ,
5
4
BulkSelectionIdentifiersType ,
6
5
Button ,
7
6
ButtonComponentType ,
@@ -11,15 +10,18 @@ import {
11
10
ClusterStatusType ,
12
11
ComponentSizeType ,
13
12
Icon ,
13
+ Nodes ,
14
14
Tooltip ,
15
- URLS ,
16
15
useBulkSelection ,
17
16
} from '@devtron-labs/devtron-fe-common-lib'
18
17
19
18
import { ReactComponent as Error } from '@Icons/ic-error-exclamation.svg'
20
19
import { importComponentFromFELibrary } from '@Components/common'
21
- import { K8S_EMPTY_GROUP , SIDEBAR_KEYS } from '@Components/ResourceBrowser/Constants'
22
- import { AppDetailsTabs } from '@Components/v2/appDetails/appDetails.store'
20
+ import {
21
+ DUMMY_RESOURCE_GVK_VERSION ,
22
+ K8S_EMPTY_GROUP ,
23
+ RESOURCE_BROWSER_ROUTES ,
24
+ } from '@Components/ResourceBrowser/Constants'
23
25
24
26
import { ClusterMapInitialStatus } from '../ClusterMapInitialStatus'
25
27
import { CLUSTER_PROD_TYPE } from '../constants'
@@ -57,8 +59,6 @@ const ClusterListRow = ({
57
59
}
58
60
const isIdentifierSelected = ! ! bulkSelectionState [ clusterData . name ]
59
61
60
- // TODO: @Elessar 1802 will be replacing all terminal url with new utils
61
-
62
62
return (
63
63
< div
64
64
key = { `cluster-${ clusterData . id } ` }
@@ -74,7 +74,12 @@ const ClusterListRow = ({
74
74
< div data-testid = { `cluster-row-${ clusterData . name } ` } className = "flex left dc__overflow-hidden" >
75
75
< Link
76
76
className = "dc__ellipsis-right dc__no-decor lh-24"
77
- to = { `${ URLS . RESOURCE_BROWSER } /${ clusterData . id } /${ ALL_NAMESPACE_OPTION . value } /${ SIDEBAR_KEYS . nodeGVK . Kind . toLowerCase ( ) } /${ K8S_EMPTY_GROUP } ` }
77
+ to = { generatePath ( RESOURCE_BROWSER_ROUTES . K8S_RESOURCE_LIST , {
78
+ clusterId : clusterData . id ,
79
+ group : K8S_EMPTY_GROUP ,
80
+ kind : Nodes . Node . toLowerCase ( ) ,
81
+ version : DUMMY_RESOURCE_GVK_VERSION ,
82
+ } ) }
78
83
>
79
84
{ clusterData . name }
80
85
</ Link >
@@ -91,7 +96,7 @@ const ClusterListRow = ({
91
96
variant = { ButtonVariantType . borderLess }
92
97
component = { ButtonComponentType . link }
93
98
linkProps = { {
94
- to : ` ${ URLS . RESOURCE_BROWSER } / ${ clusterData . id } / ${ ALL_NAMESPACE_OPTION . value } / ${ AppDetailsTabs . terminal } / ${ K8S_EMPTY_GROUP } ` ,
99
+ to : generatePath ( RESOURCE_BROWSER_ROUTES . TERMINAL , { clusterId : clusterData . id } ) ,
95
100
} }
96
101
/>
97
102
) }
0 commit comments