Skip to content

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

Merged
ShimShtein merged 1 commit into
theforeman:developfrom
MariaAga:update-vmware
Jun 9, 2026
Merged

Fixes #38992 - Update host vmware form to PF5#10817
ShimShtein merged 1 commit into
theforeman:developfrom
MariaAga:update-vmware

Conversation

@MariaAga

@MariaAga MariaAga commented Jan 14, 2026

Copy link
Copy Markdown
Member

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

Copilot AI left a comment

Copy link
Copy Markdown

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.

Copilot AI left a comment

Copy link
Copy Markdown

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.

Comment thread webpack/assets/javascripts/react_app/components/hosts/storage/vmware/index.js Outdated

Copilot AI left a comment

Copy link
Copy Markdown

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)
}

Copilot AI Jan 14, 2026

Copy link

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)
}

Copilot AI Jan 14, 2026

Copy link

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.

Copilot AI left a comment

Copy link
Copy Markdown

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

Copilot AI Jan 15, 2026

Copy link

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
Copy Markdown
Member Author

Updated buttons to only have 1 primary as before
image

@adamruzicka adamruzicka left a comment

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
MariaAga force-pushed the update-vmware branch 2 times, most recently from c2b2c43 to 5c7c5e1 Compare May 18, 2026 15:52
@ekohl

ekohl commented May 18, 2026

Copy link
Copy Markdown
Member

Just based on the screenshot I think it's correct but I hope someone has the capacity to properly test it.

@kmalyjur kmalyjur left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM from the javascript side. I hope the Rocket team will test the edge cases more.

@stejskalleos stejskalleos self-assigned this May 29, 2026

@stejskalleos stejskalleos left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

  • 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 -20 into the Size (GB) field.
  • If I don't select required fields Storage Pod * or Data 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)

@ShimShtein

Copy link
Copy Markdown
Member

/packit rpm-build

@packit-as-a-service

Copy link
Copy Markdown

There appears to be a syntax error in the command provided. Please refer to the Packit documentation or use the /packit help command.

@ShimShtein

Copy link
Copy Markdown
Member

/packit build

@ShimShtein

Copy link
Copy Markdown
Member

Did some testing, OCP compute resource is not affected.
One nitpick: when showing the list of disks, only the first disk in a controller is expanded. Is it intentional?
image
While we are at it, the defaults are also not consistent: only the first disk is defined as "thin" by default, all others are defined as "thick" (thin checkbox is unmarked). Is it also intentional?
Otherwise LGTM.

@MariaAga

MariaAga commented Jun 1, 2026

Copy link
Copy Markdown
Member Author

Thanks all, I will get to the review comments this week, about

While we are at it, the defaults are also not consistent: only the first disk is defined as "thin" by default, all others are defined as "thick" (thin checkbox is unmarked). Is it also intentional?

This was the behaviour before, should I change it to the default being thin for all?

@MariaAga

MariaAga commented Jun 2, 2026

Copy link
Copy Markdown
Member Author

The PR is not for the full VMware form, only the storage section -> The commit message & PR title should reflect that.

Updated

Nitpick: I can type -20 into the Size (GB) field.

fixed

If I don't select required fields Storage Pod * or Data 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.

Thats not consistent with the host form behaviour for any other field (for example: name can be empty and the submit button is enabled)

@ShimShtein

Copy link
Copy Markdown
Member

This was the behaviour before, should I change it to the default being thin for all?

If that was the original behavior, I think it's good enough. Let's keep it that way.

@MariaAga

MariaAga commented Jun 3, 2026

Copy link
Copy Markdown
Member Author

Talked to @ShimShtein, and he pointed out two issues, that are now fixed:

  • Volume expansion

On edit host (vmExists), all volumes are expanded by default so existing disk settings are visible without clicking each one.
On new host, the first volume and the most recently added volume stay expanded.
New disk defaults

  • New volumes no longer inherit Storage Pod or Data store from an existing disk when adding a volume or controller. Each new disk starts with empty storage fields and must be configured explicitly. (This was a leftover from a discussed logic, its not changing the original behaviour)

@ShimShtein ShimShtein left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@ShimShtein

Copy link
Copy Markdown
Member

I have tested the PR with packit build:

  • Create a host with the default disk
  • create the host and add more disks and controllers
  • Edit host with multiple disks and see the R/O disk info
  • make sure OCP-V compute resource still works as previously.

@ShimShtein
ShimShtein dismissed stale reviews from adamruzicka and stejskalleos June 9, 2026 08:09

No longer relevant

@ShimShtein
ShimShtein merged commit 62ef8d0 into theforeman:develop Jun 9, 2026
39 of 42 checks passed
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.

9 participants