Skip to content

Commit

Permalink
Merge pull request #1401 from sgratch/avoid-displaying-alerts-for-suc…
Browse files Browse the repository at this point in the history
…cessfull-plans

Avoid displaying alert messages for successfully completed plans
  • Loading branch information
sgratch authored Dec 4, 2024
2 parents ed4ca6a + ab7a45a commit faf4a53
Showing 1 changed file with 31 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,27 +79,35 @@ export const PlanPageHeadings: React.FC<{ name: string; namespace: string }> = (
return isPreserveStaticIPs && isMapToPod;
};

if (criticalCondition) {
alerts.push(
<PlanCriticalCondition
type={criticalCondition?.type}
message={criticalCondition?.message}
key={'providerCriticalCondition'}
/>,
);
} else if (preserveIpsWithPodMapCondition()) {
alerts.push(
<PlanWarningCondition
type={t('Preserving static IPs of VMs might fail')}
message={t(
'The plan is set to preserve the static IPs of VMs mapped to a Pod network type. This is not supported and therefore VM IPs can be changed during the migration process.',
)}
suggestion={t(
"For fixing, update the destination network mappings to avoid using the 'Pod Networking' type.",
)}
/>,
);
}
const handleAlerts = () => {
// alerts are not relevant to display if plan was completed successfully
if (planStatus === 'Succeeded') return;

if (criticalCondition) {
alerts.push(
<PlanCriticalCondition
type={criticalCondition?.type}
message={criticalCondition?.message}
key={'providerCriticalCondition'}
/>,
);
return;
}

if (preserveIpsWithPodMapCondition()) {
alerts.push(
<PlanWarningCondition
type={t('Preserving static IPs of VMs might fail')}
message={t(
'The plan is set to preserve the static IPs of VMs mapped to a Pod network type. This is not supported and therefore VM IPs can be changed during the migration process.',
)}
suggestion={t(
"For fixing, update the destination network mappings to avoid using the 'Pod Networking' type.",
)}
/>,
);
}
};

const onClick = () => {
showModal(
Expand All @@ -123,6 +131,8 @@ export const PlanPageHeadings: React.FC<{ name: string; namespace: string }> = (
</Level>
);

handleAlerts();

return (
<>
<PageHeadings
Expand Down

0 comments on commit faf4a53

Please sign in to comment.