Fixes #38992 - Update host vmware form to PF5 - #10817
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the VMware host storage form components to use PatternFly 5 (PF5) components, migrating from the deprecated patternfly-react library. The changes modernize UI components including alerts, buttons, selects, form groups, and input fields.
Changes:
- Migrated storage form components from patternfly-react to @patternfly/react-core
- Replaced custom form components with PF5 native components and @patternfly/react-templates
- Updated tests from Enzyme to React Testing Library
- Added new FormStatus component for displaying loading and error states
Reviewed changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/index.js | Updated Alert and Button imports, replaced AlertBody with PF5 Alert title prop, removed bsStyle prop |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/index.js | Migrated to SimpleSelect, added Form/FormGroup structure, updated Button API, removed unused _updateDisk function |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js | Complete rewrite using PF5 components (TypeaheadSelect, NumberInput, Checkbox), added state management for selections, implemented FormStatus integration |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/FormStatus.js | New component to display loading spinners and error popovers based on STATUS values |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/disk.test.js | Rewrote tests using React Testing Library instead of Enzyme |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/controller.test.js | Rewrote tests using React Testing Library with fake timers for async operations |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/tests/integration.test.js | Updated integration tests to use rtlHelpers and React Testing Library |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/disk.scss | Removed custom CSS classes replaced by PF5 components, kept minimal styling |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/controller.scss | Deleted file - CSS no longer needed with PF5 Form components |
| webpack/assets/javascripts/react_app/components/hosts/storage/vmware/StorageContainer.scss | Removed unused .controller-container margin rule |
| package.json | Updated PatternFly packages to 5.4.x versions, added @patternfly/react-templates |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 9 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
bbf7669 to
53c71ec
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| onChange={event => | ||
| updateDisk('sizeGb', parseInt(event.target.value, 10) || 0) | ||
| } |
There was a problem hiding this comment.
The NumberInput onChange handler may not handle all edge cases properly. When the input is cleared or contains invalid characters, parseInt(event.target.value, 10) || 0 will default to 0, which bypasses the min={1} constraint. This could result in a value of 0 being set even though the minimum is 1. Consider validating that the parsed value respects the minimum constraint before calling updateDisk.
| onMinus={() => | ||
| updateDisk('sizeGb', (parseInt(sizeGb, 10) || 0) - 1) | ||
| } |
There was a problem hiding this comment.
The onMinus handler could produce a value less than the minimum (1) when sizeGb is 1. The calculation (parseInt(sizeGb, 10) || 0) - 1 would result in 0 when starting from 1. While the NumberInput component may have its own validation, it's better to enforce the minimum constraint explicitly in the handler to prevent invalid values from being set in the application state.
53c71ec to
ead6fa7
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 12 out of 12 changed files in this pull request and generated 5 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
| }); | ||
|
|
||
| it('handles null sizeGb value', () => { |
There was a problem hiding this comment.
The test name 'handles null sizeGb value' is misleading because the test actually uses sizeGb={0}, not null. The test should be renamed to 'handles zero sizeGb value' or the test should be updated to actually test with null/undefined.
| it('handles null sizeGb value', () => { | |
| it('handles zero sizeGb value', () => { |
ead6fa7 to
49fed73
Compare
49fed73 to
e551a1a
Compare
e551a1a to
9717b3b
Compare
| <Button | ||
| variant="danger" | ||
| className="close" | ||
| onClick={removeDisk} | ||
| ouiaId="btn-disk-remove" | ||
| aria-label="Remove disk" | ||
| > |
There was a problem hiding this comment.
Will it be better to name it "remove volume" instead of "remove disk" to match "add volume"?
There was a problem hiding this comment.
Yes, volumes all the way
9717b3b to
9ce5018
Compare
c2b2c43 to
5c7c5e1
Compare
|
Just based on the screenshot I think it's correct but I hope someone has the capacity to properly test it. |
kmalyjur
left a comment
There was a problem hiding this comment.
LGTM from the javascript side. I hope the Rocket team will test the edge cases more.
stejskalleos
left a comment
There was a problem hiding this comment.
- The PR is not for the full VMware form, only the storage section -> The commit message & PR title should reflect that.
- Nitpick: I can type
-20into theSize (GB)field. - If I don't select required fields
Storage Pod *orData store, the form can be submitted. I know it's a React component inserted into the form, but it would be nice not to allow it. Anyway, not gonna block on this PR.
Can you please rebase the issue over the latest develop? (because of dc528f4)
|
/packit rpm-build |
|
There appears to be a syntax error in the command provided. Please refer to the Packit documentation or use the |
|
/packit build |
|
Thanks all, I will get to the review comments this week, about
This was the behaviour before, should I change it to the default being thin for all? |
Updated
fixed
Thats not consistent with the host form behaviour for any other field (for example: name can be empty and the submit button is enabled) |
If that was the original behavior, I think it's good enough. Let's keep it that way. |
|
Talked to @ShimShtein, and he pointed out two issues, that are now fixed:
On edit host (vmExists), all volumes are expanded by default so existing disk settings are visible without clicking each one.
|
|
I have tested the PR with packit build:
|
No longer relevant








Depends on #10811 (packing review is because of that PR)
Tests were created with help of AI.
To test:
In the host form -> select a compute resource with vmware type -> go to the virtual machine tab
a. see the new style of the alarm that says "Please select a cluster" at the bottom of the form
b. select a cluster, the Storage section is updated to PF5
Screenshots of the new form: