Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a warning if preserve static IPs are enabled with pod network mapping #1387

Merged

Conversation

sgratch
Copy link
Collaborator

@sgratch sgratch commented Nov 13, 2024

Reference:https://issues.redhat.com/browse/MTV-1503

In case there is no critical error for a plan and in addition, the plan is set to enable the preserve static IPs for the VMs while at least one of the destination network mappings is set to 'Pod Networking' type => then display a warning alert at the head of plan page.

Screenshots

Screenshot from 2024-11-13 21-29-43

Screencast.from.2024-11-13.21-35-45.webm

@sgratch sgratch requested a review from yaacov November 13, 2024 19:39
@sgratch sgratch added this to the 2.8.0 milestone Nov 13, 2024
@sgratch sgratch added the enhancement Categorizes issue or PR as related to a new feature. label Nov 13, 2024
@sgratch sgratch force-pushed the Warn-preserve-staticIP-mapped-to-pod-network branch from 6284b5d to 545b4b8 Compare November 13, 2024 19:47
@codecov-commenter
Copy link

codecov-commenter commented Nov 13, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 36.21%. Comparing base (13484d0) to head (e8f26a2).
Report is 132 commits behind head on main.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1387      +/-   ##
==========================================
- Coverage   36.81%   36.21%   -0.60%     
==========================================
  Files         158      159       +1     
  Lines        2548     2579      +31     
  Branches      599      603       +4     
==========================================
- Hits          938      934       -4     
- Misses       1428     1643     +215     
+ Partials      182        2     -180     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@sgratch sgratch changed the title Display a Warnning if preserve static IPs are enabled with pod network mapping Display a warning if preserve static IPs are enabled with pod network mapping Nov 13, 2024
@sgratch sgratch requested a review from jonner November 13, 2024 19:58
@sgratch
Copy link
Collaborator Author

sgratch commented Nov 13, 2024

cc: @RichardHoch
Please review the warning message displayed in the screenshot within main comment:
#1387 (comment)

@sgratch sgratch removed the request for review from jonner November 13, 2024 20:07

import { Alert, Text, TextContent, TextVariants } from '@patternfly/react-core';

export const PlanWarningCondition: React.FC<{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no need for React.FC , u can directly import FC

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More than half of our current code declare components like above, so if we want to use one format for all, I'll suggest to fix that in a follow up PR.

}> = ({ type, message, suggestion }) => {
const { t } = useTranslation();
return (
<Alert title={t('The plan migration might not work as expected - ') + type} variant="warning">
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is AlertVaraitn.warnning from patternfly, better use it then manually declaring

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by the way, better to include '-' in a trans string,

  1. polluting the trans JSON file, making it probably unsharable translation,
  2. a '-' char that has no meaning in translation.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is AlertVaraitn.warnning from patternfly, better use it then manually declaring

Please explain, not sure I understand this comment

by the way, better to include '-' in a trans string,

Just to make sure, you mean to exclude right? If so then sure. Fixed for all occurrences in the code.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like there is a ButtonVariant u can import from patternfly, and use this enum for the variant prop value , there is also AlertVariant

yes I mean exclude. thanks.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

like there is a ButtonVariant u can import from patternfly, and use this enum for the variant prop value , there is also AlertVariant

The current code is already using the warning variant:
Screenshot from 2024-11-26 20-42-21

That's why I don't understand your suggestion. Can you please give an example?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what i mean

import {ButtonVariant } pattern..

<Button variant={ButtonVariant.warning} >something</Button>

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth fixing it for all other code occurrences in a follow up PR.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure please open tasks for the follow ups

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@sgratch sgratch force-pushed the Warn-preserve-staticIP-mapped-to-pod-network branch from 545b4b8 to ec5b7a1 Compare November 22, 2024 07:25
@sgratch sgratch requested a review from metalice November 22, 2024 07:33
@sgratch sgratch force-pushed the Warn-preserve-staticIP-mapped-to-pod-network branch from ec5b7a1 to 3687da0 Compare November 26, 2024 19:40
@sgratch
Copy link
Collaborator Author

sgratch commented Nov 27, 2024

@metalice please review

Reference:https://issues.redhat.com/browse/MTV-1503

In case there is no critical error for a plan and in addition,
the plan is set to enable the preserve static IPs for the VMs while at
least one of the destination network mappings is set to 'Pod Networking'
type => then display a warning alert at the head of plan page.

Signed-off-by: Sharon Gratch <[email protected]>
@sgratch sgratch force-pushed the Warn-preserve-staticIP-mapped-to-pod-network branch from 3687da0 to e8f26a2 Compare November 28, 2024 20:48
@sgratch sgratch merged commit 66ac1fa into kubev2v:main Dec 1, 2024
10 checks passed
@sgratch sgratch deleted the Warn-preserve-staticIP-mapped-to-pod-network branch December 1, 2024 17:14
@sgratch sgratch modified the milestones: 2.8.0, 2.7.6 Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants