Skip to content

Commit a354eb8

Browse files
committed
fix: redirection urls & cluster upgrade table
1 parent 973dd6f commit a354eb8

File tree

11 files changed

+590
-96
lines changed

11 files changed

+590
-96
lines changed

src/components/ClusterNodes/ClusterList/ClusterListRow.tsx

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import { Link } from 'react-router-dom'
1+
import { generatePath, Link } from 'react-router-dom'
22

33
import {
4-
ALL_NAMESPACE_OPTION,
54
BulkSelectionIdentifiersType,
65
Button,
76
ButtonComponentType,
@@ -11,15 +10,18 @@ import {
1110
ClusterStatusType,
1211
ComponentSizeType,
1312
Icon,
13+
Nodes,
1414
Tooltip,
15-
URLS,
1615
useBulkSelection,
1716
} from '@devtron-labs/devtron-fe-common-lib'
1817

1918
import { ReactComponent as Error } from '@Icons/ic-error-exclamation.svg'
2019
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'
2325

2426
import { ClusterMapInitialStatus } from '../ClusterMapInitialStatus'
2527
import { CLUSTER_PROD_TYPE } from '../constants'
@@ -57,8 +59,6 @@ const ClusterListRow = ({
5759
}
5860
const isIdentifierSelected = !!bulkSelectionState[clusterData.name]
5961

60-
// TODO: @Elessar1802 will be replacing all terminal url with new utils
61-
6262
return (
6363
<div
6464
key={`cluster-${clusterData.id}`}
@@ -74,7 +74,12 @@ const ClusterListRow = ({
7474
<div data-testid={`cluster-row-${clusterData.name}`} className="flex left dc__overflow-hidden">
7575
<Link
7676
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+
})}
7883
>
7984
{clusterData.name}
8085
</Link>
@@ -91,7 +96,7 @@ const ClusterListRow = ({
9196
variant={ButtonVariantType.borderLess}
9297
component={ButtonComponentType.link}
9398
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 }),
95100
}}
96101
/>
97102
)}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import { useEffect } from 'react'
2+
import { useLocation } from 'react-router-dom'
3+
4+
import { noop } from '@devtron-labs/devtron-fe-common-lib/dist'
5+
6+
import { ResourceBrowserTabsId } from '../Constants'
7+
import { AdminTerminalDummyProps } from './types'
8+
9+
const AdminTerminalDummy = ({ markTabActiveById, updateTabUrl, clusterName, getTabById }: AdminTerminalDummyProps) => {
10+
const { pathname, search } = useLocation()
11+
12+
useEffect(() => {
13+
markTabActiveById(ResourceBrowserTabsId.terminal).catch(noop)
14+
}, [])
15+
16+
useEffect(() => {
17+
const tab = getTabById(ResourceBrowserTabsId.terminal)
18+
19+
if (!clusterName || !tab?.title.includes(clusterName)) {
20+
return
21+
}
22+
23+
updateTabUrl({
24+
id: ResourceBrowserTabsId.terminal,
25+
url: `${pathname}${search}`,
26+
dynamicTitle: `Terminal ${clusterName}`,
27+
})
28+
}, [clusterName])
29+
30+
return null
31+
}
32+
33+
export default AdminTerminalDummy

0 commit comments

Comments
 (0)