Skip to content

Commit 07415f0

Browse files
pr comments
1 parent a1687ee commit 07415f0

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/components/v2/appDetails/k8Resource/nodeDetail/NodeDetail.component.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,8 @@ function NodeDetailComponent({
7474
const selectedContainerValue = isResourceBrowserView ? selectedResource?.name : podMetaData?.name
7575
const _selectedContainer = selectedContainer.get(selectedContainerValue) || containers?.[0]?.name || ''
7676
const [selectedContainerName, setSelectedContainerName] = useState(_selectedContainer)
77+
const [hideDeleteButton, setHideDeleteButton] = useState(false)
78+
7779
useEffect(() => toggleManagedFields(isManagedFields), [selectedTabName])
7880
useEffect(() => {
7981
if (location.pathname.endsWith('/terminal') && params.nodeType === Nodes.Pod.toLowerCase()) {
@@ -111,7 +113,7 @@ function NodeDetailComponent({
111113
{
112114
...selectedResource,
113115
name: selectedResource.name ? selectedResource.name : nullCaseName,
114-
namespace: selectedResource.namespace ? selectedResource.namespace : 'devtron-ci',
116+
namespace: selectedResource.namespace ? selectedResource.namespace : params.namespace,
115117
},
116118
)
117119
const _resourceContainers = []
@@ -160,10 +162,10 @@ function NodeDetailComponent({
160162
// when resource is deleted
161163
if (Array.isArray(err['errors']) && err['errors'].some((_err) => _err.code === '404')) {
162164
setResourceDeleted(true)
165+
setHideDeleteButton(true)
163166
// when user is not authorized to view resource
164167
} else if (err['code'] === 403) {
165-
166-
setResourceDeleted(true)
168+
setHideDeleteButton(true)
167169
showError(err)
168170
} else {
169171
showError(err)
@@ -332,7 +334,7 @@ function NodeDetailComponent({
332334
)}
333335
</div>
334336
{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
336338
<span className="flex left fw-6 cr-5 ml-16 fs-12 cursor" onClick={toggleDeleteDialog}>
337339
<DeleteIcon className="icon-dim-16 mr-5 scr-5" />
338340
{CLUSTER_NODE_ACTIONS_LABELS.delete}

0 commit comments

Comments
 (0)