-
Notifications
You must be signed in to change notification settings - Fork 19
Fixes #38697 - ForemanForm in Webhook to PF5 #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
d47d95b to
82af696
Compare
There was a problem hiding this 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.
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Outdated
Show resolved
Hide resolved
MariaAga
left a comment
There was a problem hiding this 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
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/__tests__/WebhookForm.test.js
Show resolved
Hide resolved
...bhooks/Routes/Webhooks/Components/WebhookForm/Components/__tests__/AutocompleteInput.test.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/AutocompleteInput.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/AutocompleteInput.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookTestModal.js
Outdated
Show resolved
Hide resolved
82af696 to
80bcec7
Compare
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.css
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.css
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/AutocompleteInput.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookDeleteModal.js
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
webpack/ForemanWebhooks/Routes/Webhooks/WebhooksIndexPage/Components/WebhookTestModal.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/FieldConstructor.js
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/AutocompleteInput.js
Outdated
Show resolved
Hide resolved
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.js
Show resolved
Hide resolved
80bcec7 to
56f23fc
Compare
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/AutocompleteInput.js
Show resolved
Hide resolved
56f23fc to
306c266
Compare
|
Adjust AutocompleteInput component to prepare move to foremanCore |
|
I think the spacing issues between input and labels is because the |
40a97b7 to
79500d7
Compare
|
Modal is now aligned to top with 100px offset. |
Sure, my approval is to give priority to this as I see very robust test coverage to: a) FieldConstructor.test.js bright useage of previous tests to: a) WebhookFormTabs.js Introduction to: a) WebhooksTable/index.js Removal of: a) ForemanFormikField.js 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. |
MariaAga
left a comment
There was a problem hiding this 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)
webpack/ForemanWebhooks/Routes/Webhooks/Components/WebhookForm/Components/WebhookFormTabs.css
Outdated
Show resolved
Hide resolved
I can't reproduce this issue. |
79500d7 to
1accc52
Compare
Looks good, thank you.
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.
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. |
Fwiw, I can. Create a webhook, force refresh, click on that webhook. It is fine on subsequent opens, but not on the first one. |
|
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. 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 |
No objections against that |
1accc52 to
51a4a00
Compare
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? |
adamruzicka
left a comment
There was a problem hiding this 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)} |
There was a problem hiding this comment.
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
|
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 Password field should be fixed and autocomplete removed |
51a4a00 to
4146a5c
Compare
|
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. |
There was a problem hiding this 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} |
There was a problem hiding this comment.
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.




Replace ForemanForm with new PF5 variant