Skip to content

Conversation

@Lukshio
Copy link

@Lukshio Lukshio commented Sep 30, 2025

Replace ForemanForm with new PF5 variant

@Lukshio Lukshio force-pushed the webhookFormUpdate branch 4 times, most recently from d47d95b to 82af696 Compare September 30, 2025 11:47
@MariaAga MariaAga requested a review from Copilot October 7, 2025 13:24
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 pull request replaces the legacy ForemanForm with PatternFly 5 (PF5) components in the webhook test modal functionality, addressing issue #38697. The migration involves transitioning from Formik-based form handling to direct state management with PF5 form components.

  • Replaced ForemanForm and ForemanFormikField with PF5 Form, ActionGroup, and Button components
  • Introduced custom FieldConstructor and AutocompleteInput components for form field management
  • Updated form state management from Formik to React useState with manual validation

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
WebhookTestModal.js Updated to use PF5 Form components and local state management
WebhookForm.js Replaced ForemanForm with PF5 Form and custom validation logic
WebhookFormTabs.js Updated to use FieldConstructor instead of ForemanFormikField
FieldConstructor.js New component providing PF5-based form field rendering with validation
AutocompleteInput.js New PF5 Select component for dropdown/typeahead functionality
ForemanFormikField.js Removed legacy Formik-based field component
Test files Updated from snapshot tests to React Testing Library with comprehensive coverage

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MariaAga MariaAga self-assigned this Oct 7, 2025
Copy link
Member

@MariaAga MariaAga left a comment

Choose a reason for hiding this comment

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

Thanks, adding this as an initial review, with some comments as well
When editing a webhook the selected template is shown as an ID instead of a text value

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 19 out of 19 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@MariaAga MariaAga added the breaks-robottelo Can be set via comment: /label breaks-robottelo label Oct 16, 2025
@Lukshio
Copy link
Author

Lukshio commented Oct 22, 2025

Adjust AutocompleteInput component to prepare move to foremanCore

@MariaAga
Copy link
Member

I think the spacing issues between input and labels is because the <form doesnt wrap the form groups but the sections

@Lukshio
Copy link
Author

Lukshio commented Nov 13, 2025

Modal is now aligned to top with 100px offset.
Form field has extra 10px margin top
Pencil is showing only if field is disabled

@kfamilonidis
Copy link

@kfamilonidis When approving a PR could you please say what did you check? (the whole code, parts of it, tested it in development setup/broker, etc.)

Sure, my approval is to give priority to this as I see very robust test coverage to:

a) FieldConstructor.test.js‎
b) AutocompleteInput.js‎

bright useage of previous tests to:

a) WebhookFormTabs.js‎
b) WebhookForm/WebhookForm.js‎ introduction to FormField

Introduction to:

a) WebhooksTable/index.js‎
b) WebhookTestModal.js‎

Removal of:

a) ForemanFormikField.js‎
b) integration.test.js.snap‎

This PR is already very large. It's part of a broader effort to merge changes from the general upgrade process, and it may resolve many issues that are blocking other PRs.

Copy link
Member

@MariaAga MariaAga left a comment

Choose a reason for hiding this comment

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

The pencil icon only shows up when the same webhook is opened for editing for the second time (refresh didnt resolve this)

@Lukshio
Copy link
Author

Lukshio commented Nov 26, 2025

The pencil icon only shows up when the same webhook is opened for editing for the second time (refresh didnt resolve this)

I can't reproduce this issue.

@adamruzicka
Copy link
Contributor

Modal is now aligned to top with 100px offset.
Pencil is showing only if field is disabled

Looks good, thank you.

Form field has extra 10px margin top

This has a downside of maybe too much padding for the first entry? If this could be solved easily then great, if not then I won't insist on it.
image

Could the checkbox be in line with its label?
-- #89 (comment)

This is still valid. In patternfly examples, the checkboxes always have an inline description. If needed, we could probably introduce a common header for the checkboxes and then have each of them have its own inline label. Alternatively we could go for a heading and on/off radios.

@adamruzicka
Copy link
Contributor

The pencil icon only shows up when the same webhook is opened for editing for the second time (refresh didnt resolve this)

I can't reproduce this issue.

Fwiw, I can. Create a webhook, force refresh, click on that webhook. It is fine on subsequent opens, but not on the first one.

@Lukshio
Copy link
Author

Lukshio commented Nov 29, 2025

I found new issue related with the extra padding in combination with top offset. The action buttons are not visible on lower screen resolutions. So the solution is remove the offset and only align to top.
Screenshot_20251129_034832

For the checkbox it's required, in the correct way, to set the form to horizontal layout, which can be beneficial here, because it will also solve the large height of Modal.

Finally I can reproduce the issue with password field. It's caused by the useState() rendering in new cycle so first open will not handle the state correctly.

Before making any changes, do you agree with changing to horizontal layout? @adamruzicka

@adamruzicka
Copy link
Contributor

do you agree with changing to horizontal layout?

No objections against that

@adamruzicka
Copy link
Contributor

image

Could we somehow disable browser's autocomplete for the typeahead fields?

@adamruzicka
Copy link
Contributor

image

Same suggestion as in f-templates.

Could the info icons be prevented from spilling onto their own line?

Assuming it won't go against design guidelines or something, could the labels be right-aligned to make it appear less jagged?

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.

Only the pencil is required, the rest are more or less nice to haves.

<GridItem span={1}>
<Button
ouiaId={`reset-${name}`}
onClick={() => setIsDisabled(false)}
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems to be broken, when editing a webhook, I can't make the field become write-able

@Lukshio
Copy link
Author

Lukshio commented Dec 11, 2025

I added the extra gap, same as in templates. And with the labels, its the same situation, design guidlines only mentions top and left align
https://v5-archive.patternfly.org/components/forms/form/design-guidelines#labels

Password field should be fixed and autocomplete removed

@kfamilonidis
Copy link

Looks good to me. I tested it on packit/build. I see: labels correctly aligned, password properly adjusted, and pencil included. Noticed also about the icons in validation. It is handled ok for this specific case.

Copy link
Member

@MariaAga MariaAga left a comment

Choose a reason for hiding this comment

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

autocomplete=target_url causes the autocomplete to not work like it does in the old form
autocomplete=off for the HTTP Method causes it to auto fill username
Clicking on the pencil causes username and password autofill (which didnt happen in the old form)

}) => (
<FormGroup
isInline
fieldId={fieldId}
Copy link
Member

@MariaAga MariaAga Dec 16, 2025

Choose a reason for hiding this comment

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

I think filling up the fieldId should fix this issue:
26 No label associated with a form field
A isn't associated with a form field.

To fix this issue, nest the in the or provide a for attribute on the that matches a form field id.

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

Labels

breaks-robottelo Can be set via comment: /label breaks-robottelo Waiting on contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants