Skip to content

Fixes #38992 - Update host vmware form to PF5#10817

Open
MariaAga wants to merge 1 commit intotheforeman:developfrom
MariaAga:update-vmware
Open

Fixes #38992 - Update host vmware form to PF5#10817
MariaAga wants to merge 1 commit intotheforeman:developfrom
MariaAga:update-vmware

Conversation

@MariaAga
Copy link
Member

@MariaAga MariaAga commented Jan 14, 2026

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:

Screenshot From 2026-01-13 11-08-48 Screenshot From 2026-01-09 13-49-46 Screenshot From 2026-01-08 11-42-22

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Comment on lines 192 to 194
onChange={event =>
updateDisk('sizeGb', parseInt(event.target.value, 10) || 0)
}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Comment on lines 196 to 198
onMinus={() =>
updateDisk('sizeGb', (parseInt(sizeGb, 10) || 0) - 1)
}
Copy link

Copilot AI Jan 14, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

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', () => {
Copy link

Copilot AI Jan 15, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
it('handles null sizeGb value', () => {
it('handles zero sizeGb value', () => {

Copilot uses AI. Check for mistakes.
@MariaAga
Copy link
Member Author

Updated buttons to only have 1 primary as before
image

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

Not sure if it is caused by this, but submitting the form with fields missing leads to a page with rails traceback:

New:
image

Old:
image

Comment on lines 71 to 77
<Button
variant="danger"
className="close"
onClick={removeDisk}
ouiaId="btn-disk-remove"
aria-label="Remove disk"
>
Copy link
Contributor

Choose a reason for hiding this comment

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

It was not immediately obvious to me what the red button would do with it being so close to the name of the disk. It was much clearer before this change

New:
image

Old:
image

Copy link
Member Author

Choose a reason for hiding this comment

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

I think it would be best to give it text, as I didnt see the old page like that, and with a wide screen the old page makes sense.
image

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for text

Copy link
Member Author

Choose a reason for hiding this comment

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

image Added text to the button and moved it to the right

Copy link
Member Author

Choose a reason for hiding this comment

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

Will it be better to name it "remove volume" instead of "remove disk" to match "add volume"?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, volumes all the way

Copy link
Member Author

Choose a reason for hiding this comment

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

updated, thanks

@MariaAga
Copy link
Member Author

@adamruzicka I checked this

Not sure if it is caused by this, but submitting the form with fields missing leads to a page with rails traceback:

And I see a page with rails traceback even without this PR, by just opening the create host page and clicking submit

@adamruzicka
Copy link
Contributor

And I see a page with rails traceback even without this PR,

"Good". Let's not worry about it here then

Copy link
Contributor

@adamruzicka adamruzicka left a comment

Choose a reason for hiding this comment

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

I don't have anything to add apart from those last two comments

}
/>
<Button
variant="secondary"
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be a danger variant to be in line with volume removal?

@MariaAga
Copy link
Member Author

This PR is waiting for a UI review from @MariSvirik and a code review from @kmalyjur

Copy link
Contributor

@kmalyjur kmalyjur left a comment

Choose a reason for hiding this comment

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

Looks good! I'm leaving a few comments, but they are not that important.

</Button>
</div>
<Form>
<FormGroup label={__('Create controller')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

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')}
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe a nitpick, but 'Remove volume' has a lowercase 'v' while 'Add Controller' has an uppercase 'C'. It could be nicer to unify them.

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks I missed them! Updated the add/remove controller buttons to use sentence case to match.

@MariaAga
Copy link
Member Author

MariaAga commented Feb 4, 2026

Screenshot after the latest changes:
image

@kmalyjur
Copy link
Contributor

kmalyjur commented Feb 9, 2026

I'd ACK it, but let's wait for @MariSvirik's comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants