Skip to content

Commit d6f4c15

Browse files
authored
Merge pull request #2806 from devtron-labs/feat/rb-table
fix: node detail url in RB
2 parents 2f2389b + 12d85c9 commit d6f4c15

File tree

7 files changed

+34
-28
lines changed

7 files changed

+34
-28
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"private": true,
55
"homepage": "/dashboard",
66
"dependencies": {
7-
"@devtron-labs/devtron-fe-common-lib": "1.16.0-pre-9",
7+
"@devtron-labs/devtron-fe-common-lib": "1.16.0-pre-10",
88
"@esbuild-plugins/node-globals-polyfill": "0.2.3",
99
"@rjsf/core": "^5.13.3",
1010
"@rjsf/utils": "^5.13.3",

src/components/ClusterNodes/NodeDetails.tsx

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,11 @@ import {
4141
Button,
4242
ButtonVariantType,
4343
ButtonStyleType,
44+
RESOURCE_BROWSER_ROUTES,
45+
getUrlWithSearchParams,
46+
ResourceBrowserActionMenuEnum,
4447
} from '@devtron-labs/devtron-fe-common-lib'
45-
import { useParams, useLocation, useHistory } from 'react-router-dom'
48+
import { useParams, useLocation, useHistory, generatePath } from 'react-router-dom'
4649
import YAML from 'yaml'
4750
import * as jsonpatch from 'fast-json-patch'
4851
import { applyPatch } from 'fast-json-patch'
@@ -78,7 +81,7 @@ import { importComponentFromFELibrary } from '@Components/common'
7881

7982
const REDFISH_NODE_UI_TABS = importComponentFromFELibrary('REDFISH_NODE_UI_TABS', [], 'function')
8083

81-
const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }: ClusterListType) => {
84+
const NodeDetails = ({ lowercaseKindToResourceGroupMap, updateTabUrl }: ClusterListType) => {
8285
const { clusterId, name } = useParams<{ clusterId: string; nodeType: string; name: string }>()
8386
const [loader, setLoader] = useState(true)
8487
const [apiInProgress, setApiInProgress] = useState(false)
@@ -673,9 +676,13 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
673676
const openDebugTerminal = () => {
674677
const queryParams = new URLSearchParams(location.search)
675678
queryParams.set('node', nodeDetail.name)
676-
const url = location.pathname
677679
push(
678-
`${url.split('/').slice(0, -3).join('/')}/${AppDetailsTabs.terminal}/${K8S_EMPTY_GROUP}?${queryParams.toString()}`,
680+
getUrlWithSearchParams(
681+
generatePath(RESOURCE_BROWSER_ROUTES.TERMINAL, {
682+
clusterId,
683+
}),
684+
{ node: nodeDetail.name },
685+
),
679686
)
680687
}
681688

@@ -711,17 +718,19 @@ const NodeDetails = ({ addTab, lowercaseKindToResourceGroupMap, updateTabUrl }:
711718
}
712719

713720
const handleResourceClick = (e) => {
714-
const { name, tab, namespace } = e.currentTarget.dataset
715-
let _nodeSelectionData
716-
let _group
717-
_group = selectedResource?.gvk.Group.toLowerCase() || K8S_EMPTY_GROUP
718-
_nodeSelectionData = { name: `pod` + `_${name}`, namespace, isFromNodeDetails: true }
719-
const _url = `${URLS.RESOURCE_BROWSER}/${clusterId}/${namespace}/pod/${_group}/${name}${
720-
tab ? `/${tab.toLowerCase()}` : ''
721-
}`
722-
addTab({ idPrefix: `${_group}_${namespace}`, kind: 'pod', name, url: _url }).then(() => {
723-
push(_url)
724-
})
721+
const { name, tab = ResourceBrowserActionMenuEnum.manifest, namespace } = e.currentTarget.dataset
722+
push(
723+
getUrlWithSearchParams(
724+
generatePath(RESOURCE_BROWSER_ROUTES.K8S_RESOURCE_DETAIL, {
725+
clusterId,
726+
group: selectedResource?.gvk.Group.toLowerCase() || K8S_EMPTY_GROUP,
727+
kind: 'pod',
728+
name,
729+
namespace,
730+
}),
731+
{ tab },
732+
),
733+
)
725734
}
726735

727736
const getTriggerSortingHandler =

src/components/ClusterNodes/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ export interface ColumnMetadataType {
135135
}
136136

137137
export interface ClusterListType extends Pick<K8SResourceListType, 'lowercaseKindToResourceGroupMap'> {
138-
addTab?: UseTabsReturnType['addTab']
139138
updateTabUrl: (params: Omit<UpdateTabUrlParamsType, 'id'>) => void
140139
}
141140

src/components/ResourceBrowser/ResourceList/K8SResourceList.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,8 @@ export const K8SResourceList = ({
161161
[selectedResource, clusterId, selectedNamespace, JSON.stringify(resourceFilters)],
162162
)
163163

164-
const isResourceListLoading = resourceListLoader || getIsRequestAborted(resourceListError)
164+
const isResourceListLoadingWithoutNullState = resourceListLoader || getIsRequestAborted(resourceListError)
165+
const isResourceListLoading = !resourceList || isResourceListLoadingWithoutNullState
165166

166167
useEffect(
167168
() => () => {
@@ -237,7 +238,7 @@ export const K8SResourceList = ({
237238
return columns.some(({ field }) => field === 'namespace') ? 'namespace' : 'name'
238239
}
239240

240-
if (resourceListError && !isResourceListLoading) {
241+
if (resourceListError && !isResourceListLoadingWithoutNullState) {
241242
return (
242243
<div className="flexbox-col flex-grow-1 border__primary--left">
243244
<ErrorScreenManager

src/components/ResourceBrowser/ResourceList/NodeDetailWrapper.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ import { K8S_EMPTY_GROUP } from '../Constants'
88
import { NodeDetailURLParams } from './types'
99

1010
const NodeDetailWrapper = ({
11-
addTab,
1211
getTabId,
1312
updateTabUrl,
1413
lowercaseKindToResourceGroupMap,
15-
}: Omit<ClusterListType, 'updateTabUrl'> & Pick<UseTabsReturnType, 'addTab' | 'getTabId' | 'updateTabUrl'>) => {
14+
}: Omit<ClusterListType, 'updateTabUrl'> & Pick<UseTabsReturnType, 'getTabId' | 'updateTabUrl'>) => {
1615
const { name } = useParams<NodeDetailURLParams>()
1716

1817
const id = getTabId(K8S_EMPTY_GROUP, name, 'node')
@@ -23,7 +22,6 @@ const NodeDetailWrapper = ({
2322
<NodeDetails
2423
updateTabUrl={updateTabUrlHandler}
2524
lowercaseKindToResourceGroupMap={lowercaseKindToResourceGroupMap}
26-
addTab={addTab}
2725
/>
2826
)
2927
}

src/components/ResourceBrowser/ResourceList/ResourceList.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ const ResourceList = () => {
392392
<Route path={RESOURCE_BROWSER_ROUTES.NODE_DETAIL} exact>
393393
<DynamicTabComponentWrapper type="dynamic" {...DynamicTabComponentWrapperBaseProps} addTab={addTab}>
394394
<NodeDetailWrapper
395-
addTab={addTab}
396395
getTabId={getTabId}
397396
lowercaseKindToResourceGroupMap={lowercaseKindToResourceGroupMap}
398397
updateTabUrl={updateTabUrl}

yarn.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1722,9 +1722,9 @@ __metadata:
17221722
languageName: node
17231723
linkType: hard
17241724

1725-
"@devtron-labs/devtron-fe-common-lib@npm:1.16.0-pre-9":
1726-
version: 1.16.0-pre-9
1727-
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.16.0-pre-9"
1725+
"@devtron-labs/devtron-fe-common-lib@npm:1.16.0-pre-10":
1726+
version: 1.16.0-pre-10
1727+
resolution: "@devtron-labs/devtron-fe-common-lib@npm:1.16.0-pre-10"
17281728
dependencies:
17291729
"@codemirror/autocomplete": "npm:6.18.6"
17301730
"@codemirror/lang-json": "npm:6.0.1"
@@ -1773,7 +1773,7 @@ __metadata:
17731773
react-select: 5.8.0
17741774
rxjs: ^7.8.1
17751775
yaml: ^2.4.1
1776-
checksum: 10c0/73687a79a34ca378d323f4e9d5092420d93184249f198ca048b3c512013d4dd5150234b9a88dba0d93091b6e1cc564956b6aab18598f4513aa594d33e6f14706
1776+
checksum: 10c0/b02939d8adb7ec1cadf11076ef195a6a2a80c91ca215b3ae298e8a43105e8dc5419fbe3e064ff8b63b7df6f2e1c922a5e119ea23d575c522ec26c30edd2b40d0
17771777
languageName: node
17781778
linkType: hard
17791779

@@ -5685,7 +5685,7 @@ __metadata:
56855685
version: 0.0.0-use.local
56865686
resolution: "dashboard@workspace:."
56875687
dependencies:
5688-
"@devtron-labs/devtron-fe-common-lib": "npm:1.16.0-pre-9"
5688+
"@devtron-labs/devtron-fe-common-lib": "npm:1.16.0-pre-10"
56895689
"@esbuild-plugins/node-globals-polyfill": "npm:0.2.3"
56905690
"@playwright/test": "npm:^1.32.1"
56915691
"@rjsf/core": "npm:^5.13.3"

0 commit comments

Comments
 (0)