From 2f58d73612696fe55b747d51f195f60efb8cc15a Mon Sep 17 00:00:00 2001 From: AS <11219262+ashutosh16@users.noreply.github.com> Date: Fri, 15 Mar 2024 09:06:25 -0700 Subject: [PATCH] fix(ui): add confirmation box in resource summary delete action (#17485) Signed-off-by: ashutosh16 <11219262+ashutosh16@users.noreply.github.com> --- ui/src/app/applications/components/utils.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/ui/src/app/applications/components/utils.tsx b/ui/src/app/applications/components/utils.tsx index cd39470bfb25b..a75b1a62adc80 100644 --- a/ui/src/app/applications/components/utils.tsx +++ b/ui/src/app/applications/components/utils.tsx @@ -325,7 +325,12 @@ export const deletePodAction = async (pod: appModels.Pod, appContext: AppContext }; export const deletePopup = async (ctx: ContextApis, resource: ResourceTreeNode, application: appModels.Application, appChanged?: BehaviorSubject) => { - const isManaged = !!resource.status; + function isTopLevelResource(res: ResourceTreeNode, app: appModels.Application): boolean { + const uniqRes = `/${res.namespace}/${res.group}/${res.kind}/${res.name}`; + return app.status.resources.some(resStatus => `/${resStatus.namespace}/${resStatus.group}/${resStatus.kind}/${resStatus.name}` === uniqRes); + } + + const isManaged = isTopLevelResource(resource, application); const deleteOptions = { option: 'foreground' };