@@ -74,6 +74,8 @@ function NodeDetailComponent({
74
74
const selectedContainerValue = isResourceBrowserView ? selectedResource ?. name : podMetaData ?. name
75
75
const _selectedContainer = selectedContainer . get ( selectedContainerValue ) || containers ?. [ 0 ] ?. name || ''
76
76
const [ selectedContainerName , setSelectedContainerName ] = useState ( _selectedContainer )
77
+ const [ hideDeleteButton , setHideDeleteButton ] = useState ( false )
78
+
77
79
useEffect ( ( ) => toggleManagedFields ( isManagedFields ) , [ selectedTabName ] )
78
80
useEffect ( ( ) => {
79
81
if ( location . pathname . endsWith ( '/terminal' ) && params . nodeType === Nodes . Pod . toLowerCase ( ) ) {
@@ -111,7 +113,7 @@ function NodeDetailComponent({
111
113
{
112
114
...selectedResource ,
113
115
name : selectedResource . name ? selectedResource . name : nullCaseName ,
114
- namespace : selectedResource . namespace ? selectedResource . namespace : 'devtron-ci' ,
116
+ namespace : selectedResource . namespace ? selectedResource . namespace : params . namespace ,
115
117
} ,
116
118
)
117
119
const _resourceContainers = [ ]
@@ -160,10 +162,10 @@ function NodeDetailComponent({
160
162
// when resource is deleted
161
163
if ( Array . isArray ( err [ 'errors' ] ) && err [ 'errors' ] . some ( ( _err ) => _err . code === '404' ) ) {
162
164
setResourceDeleted ( true )
165
+ setHideDeleteButton ( true )
163
166
// when user is not authorized to view resource
164
167
} else if ( err [ 'code' ] === 403 ) {
165
-
166
- setResourceDeleted ( true )
168
+ setHideDeleteButton ( true )
167
169
showError ( err )
168
170
} else {
169
171
showError ( err )
@@ -332,7 +334,7 @@ function NodeDetailComponent({
332
334
) }
333
335
</ div >
334
336
{ isResourceBrowserView &&
335
- ! isResourceDeleted && ( // hide delete button if resource is deleted or user is not authorized
337
+ ! hideDeleteButton && ( // hide delete button if resource is deleted or user is not authorized
336
338
< span className = "flex left fw-6 cr-5 ml-16 fs-12 cursor" onClick = { toggleDeleteDialog } >
337
339
< DeleteIcon className = "icon-dim-16 mr-5 scr-5" />
338
340
{ CLUSTER_NODE_ACTIONS_LABELS . delete }
0 commit comments