Fixes #38992 - Update host vmware form to PF5#10817
Fixes #38992 - Update host vmware form to PF5#10817MariaAga wants to merge 1 commit intotheforeman:developfrom
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.
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/index.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/FormStatus.js
Show resolved
Hide resolved
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.
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/index.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/FormStatus.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/hosts/storage/vmware/controller/controller.test.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/hosts/storage/vmware/controller/controller.test.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
...ck/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/disk.test.js
Outdated
Show resolved
Hide resolved
...ck/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/disk.test.js
Outdated
Show resolved
Hide resolved
...ck/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/disk.test.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/hosts/storage/vmware/__tests__/integration.test.js
Outdated
Show resolved
Hide resolved
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.
...k/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/FormStatus.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/index.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/index.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
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.
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Show resolved
Hide resolved
| } | ||
| }); | ||
|
|
||
| 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', () => { |
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
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
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/index.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
9717b3b to
9ce5018
Compare
|
@adamruzicka I checked this
And I see a page with rails traceback even without this PR, by just opening the create host page and clicking submit |
"Good". Let's not worry about it here then |
9ce5018 to
7d5fd01
Compare
adamruzicka
left a comment
There was a problem hiding this comment.
I don't have anything to add apart from those last two comments
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/index.js
Outdated
Show resolved
Hide resolved
| } | ||
| /> | ||
| <Button | ||
| variant="secondary" |
There was a problem hiding this comment.
Should this be a danger variant to be in line with volume removal?
|
This PR is waiting for a UI review from @MariSvirik and a code review from @kmalyjur |
kmalyjur
left a comment
There was a problem hiding this comment.
Looks good! I'm leaving a few comments, but they are not that important.
webpack/assets/javascripts/react_app/components/hosts/storage/vmware/controller/disk/index.js
Outdated
Show resolved
Hide resolved
| </Button> | ||
| </div> | ||
| <Form> | ||
| <FormGroup label={__('Create controller')}> |
There was a problem hiding this comment.
When having more controllers, there isn't a clear separation between them. It seems like Create controller label is a part of the previous form, but we can probably leave that for @MariSvirik to determine.
| ouiaId="btn-volume-remove" | ||
| aria-label="Remove volume" | ||
| > | ||
| {__('Remove volume')} |
There was a problem hiding this comment.
Maybe a nitpick, but 'Remove volume' has a lowercase 'v' while 'Add Controller' has an uppercase 'C'. It could be nicer to unify them.
There was a problem hiding this comment.
thanks I missed them! Updated the add/remove controller buttons to use sentence case to match.
7d5fd01 to
2787150
Compare
|
I'd ACK it, but let's wait for @MariSvirik's comments. |








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: