From ab7a45ae6b042ac445f2a8cd403fa6e3b976c818 Mon Sep 17 00:00:00 2001 From: Sharon Gratch Date: Wed, 4 Dec 2024 00:57:02 +0200 Subject: [PATCH] Avoid displaying alert messages for successfully completed plans Reference: https://issues.redhat.com/browse/MTV-1730 If plan was completed succesfully, it's irrelevant to display critical errors or warnings alerts in page header. Signed-off-by: Sharon Gratch --- .../details/components/PlanPageHeadings.tsx | 52 +++++++++++-------- 1 file changed, 31 insertions(+), 21 deletions(-) diff --git a/packages/forklift-console-plugin/src/modules/Plans/views/details/components/PlanPageHeadings.tsx b/packages/forklift-console-plugin/src/modules/Plans/views/details/components/PlanPageHeadings.tsx index 9f1f399d4..07a966258 100644 --- a/packages/forklift-console-plugin/src/modules/Plans/views/details/components/PlanPageHeadings.tsx +++ b/packages/forklift-console-plugin/src/modules/Plans/views/details/components/PlanPageHeadings.tsx @@ -79,27 +79,35 @@ export const PlanPageHeadings: React.FC<{ name: string; namespace: string }> = ( return isPreserveStaticIPs && isMapToPod; }; - if (criticalCondition) { - alerts.push( - , - ); - } else if (preserveIpsWithPodMapCondition()) { - alerts.push( - , - ); - } + const handleAlerts = () => { + // alerts are not relevant to display if plan was completed successfully + if (planStatus === 'Succeeded') return; + + if (criticalCondition) { + alerts.push( + , + ); + return; + } + + if (preserveIpsWithPodMapCondition()) { + alerts.push( + , + ); + } + }; const onClick = () => { showModal( @@ -123,6 +131,8 @@ export const PlanPageHeadings: React.FC<{ name: string; namespace: string }> = ( ); + handleAlerts(); + return ( <>