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

[MTV-2247] Initial new create plan wizard setup #1525

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpuzz0
Copy link
Contributor

@jpuzz0 jpuzz0 commented Mar 17, 2025

📝 Links

https://issues.redhat.com/browse/MTV-2247

📝 Description

Initial setup of the newer wizard which is mainly getting the framework of using react-hook-form and validation established between steps and demonstrating a single field's data is stored and submittable from the Review and create (last) step.

Accessible for testing via a new URL, http://localhost:9000/mtv/create/plan, which will have to be entered manually, as the actions to create migration plans throughout the plugin still point to the current wizard.

🎥 Demo

Screen.Recording.2025-03-17.at.3.21.49.PM.mov

📝 CC://

@mmenestr

@jpuzz0 jpuzz0 force-pushed the MTV-2247-init-wizard-setup branch 2 times, most recently from f0cd197 to a27e320 Compare March 17, 2025 19:18
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2025

⚠️ 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.14%. Comparing base (13484d0) to head (7c15c85).
Report is 381 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    #1525      +/-   ##
==========================================
- Coverage   36.81%   36.14%   -0.67%     
==========================================
  Files         158      157       -1     
  Lines        2548     2606      +58     
  Branches      599      633      +34     
==========================================
+ Hits          938      942       +4     
- Misses       1428     1662     +234     
+ Partials      182        2     -180     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@metalice
Copy link
Collaborator

Hey @jpuzz0 no need to nest the files under modules , we will omit the this folder.
src/Plans

Copy link
Collaborator

@avivtur avivtur left a comment

Choose a reason for hiding this comment

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

@jpuzz0 great work!
I left some comments/ nit suggestions

@jpuzz0 jpuzz0 force-pushed the MTV-2247-init-wizard-setup branch from 357f963 to c1c1c83 Compare March 18, 2025 19:51
</WizardStep>,
<WizardStep
key={PlanWizardStepId.VirtualMachines}
{...getStepProps(PlanWizardStepId.VirtualMachines)}
Copy link
Collaborator

Choose a reason for hiding this comment

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

u are already introducing getStepProps, why not add a key prop there, also?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That won't work;
image
The key identifier is required here and isn't read properly when nested.

Copy link
Collaborator

Choose a reason for hiding this comment

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

if you declare the type return from getStepProps that has key prop? still no go?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Correct:
image

<TextInput
{...field}
validated={
errors[GeneralFormFieldId.PlanName]
Copy link
Collaborator

Choose a reason for hiding this comment

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

do we need it? isnt this triggered automatically when next step is clicked?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, this validated prop is what determined the text input's red outline. On "next" click, or any trigger of validation, the errors will be updated to reflect any new entry, and the ID is what we're using to point to the correct error value here - to again - determine whether the input should have a red outline or not.

Copy link
Collaborator

Choose a reason for hiding this comment

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

i think if u add
error={Boolean(fieldState?.error)}
fieldState , is the second argument u can deconstruct, {field, fieldState}, we will get the same effect without the need for ternary check

Copy link
Collaborator

Choose a reason for hiding this comment

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

btw i think u can use helperText={fieldState?.error?.message}
and omit the formerrorhelpertext , please try

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Add error={Boolean(fieldState?.error)} where exactly? This is not a prop that PF's TextInput has, nor FormGroup. And when I print fieldState inside of that callback for the render function, I just see an empty object even when an error is triggered.

Also, helperText is not a prop that TextInput or FormGroup have.

Patternfly's example of using error helper text can be seen in their demos, which shows a similar implementation to what we have here:
https://www.patternfly.org/components/helper-text/react-demos#static-text-and-dynamic-status

@jpuzz0 jpuzz0 force-pushed the MTV-2247-init-wizard-setup branch 2 times, most recently from 1791333 to 7bd5db1 Compare March 19, 2025 17:49
@jpuzz0 jpuzz0 added the enhancement Categorizes issue or PR as related to a new feature. label Mar 19, 2025
@jpuzz0 jpuzz0 requested a review from metalice March 19, 2025 17:51
@jpuzz0 jpuzz0 force-pushed the MTV-2247-init-wizard-setup branch from 7bd5db1 to 7c15c85 Compare March 19, 2025 20:55
@jpuzz0 jpuzz0 requested a review from metalice March 19, 2025 20:56
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.

4 participants