-
Notifications
You must be signed in to change notification settings - Fork 1k
Fixes #36106: PF5 Refactor - EditorNavbar, EditorOptions #10728
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: develop
Are you sure you want to change the base?
Conversation
3e7a6c1 to
880cb47
Compare
f7cbd8f to
86ff36b
Compare
webpack/assets/javascripts/react_app/common/IntegrationTestHelper.js
Outdated
Show resolved
Hide resolved
...ets/javascripts/react_app/components/Editor/__tests__/__snapshots__/integration.test.js.snap
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/__tests__/integration.test.js
Outdated
Show resolved
Hide resolved
...pts/react_app/components/Editor/components/__tests__/__snapshots__/EditorNavbar.test.js.snap
Outdated
Show resolved
Hide resolved
kfamilonidis
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.
Still needs progress to remove the snaps from the test that are testing components properties, but have noticed that some snaps are different from others; some are keeping store props, and some keeping components props. I would like to ask for some opinion on should we remove both snap types, or should we keep the store props - as the later might be serve as fixtures in the future (maybe transition to other store).
4474901 to
2fefd25
Compare
The |
a7def11 to
ebd3141
Compare
webpack/assets/javascripts/react_app/common/IntegrationTestHelper.js
Outdated
Show resolved
Hide resolved
Locator for the template nagigation bar (Editor/Changes/Preview) has slightly changed. Related to change theforeman/foreman#10728
| import PropTypes from 'prop-types'; | ||
|
|
||
| import { Button, FormControl } from 'patternfly-react'; | ||
| import { FormControl } from 'patternfly-react'; |
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.
Do we still need this though?
It's used for upload file functionality, but I guess we can use FileUploadField from PF instead.
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 feel that we still need this. The tabs UI is handled differently in EditorOptions. upload file renders grouped icons with help menus with some offering form with dropdown; see settings.
FileUploadField will render as Tab. That would be different from the current flow of the user experience. Tabs now are split left-to-right with split in the middle and the ones floating right are grouped together. Changing FileUploadField will be possible breaking the flow of these items that are currently grouped together (show/hide, revert, import, settings).
| <Tooltip content={__('Import File')} position={TooltipPosition.top}> | ||
| <Button | ||
| ouiaId="import-file-button" | ||
| disabled={selectedView !== 'input'} |
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.
Comment from Copilot is still valid.
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.
yes, this comment is valid. I fixed it, ty. In EditorRadioButton, NavItem isDisabled is breaking the app.
| title, | ||
| }) => ( | ||
| <NavItem | ||
| role="presentation" |
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.
What's that for? I don't see it listed as one of the props for NavItem: https://v5-archive.patternfly.org/components/navigation#navitem
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.
is used for linking the test with getByRole instead of using custom css. It's evolution in UI semantics that is included some parts in codebase and I adjusted it the same (because I thought would make more sence). Is used in PF6 as default attribute for NavItem, and here is passed as prop to children.
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'd personally avoid changing internal stuff that we don't control or maybe shouldn't just for the sake of testing. That's what ouia's for. Or we could write a new custom selector getBySomething if current ones are not sufficient enough.
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.
since its an Icon it should have a title and aria-title for accesebility and clarity , we can use that for testing. Also this icon is never really visible, I opened https://issues.redhat.com/browse/SAT-40711 for it
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 changed the implementation of NavItem to Tabs. Using the role attribute to link them helped me focus only on the elements that needed changes for the new abstraction. Now, Tabs handle the role attribute internally, and the tests required minimum updates. This ensures the tests are verifying exactly what’s needed.
I don’t think settings belongs as part of the Tabs UI, and it shouldn’t be. However, I agree that the showHide attribute logic is mixed in and a bit obscure throughout the component. That part will need closer attention.
6989067 to
555686e
Compare
I have tried to use the |
555686e to
27874e1
Compare
256ef67 to
7af06d2
Compare
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.
Quick notes:
- Why is there space between the navbar and the editor?
- when clicking on the safemode checkbox nothing happens
- Clicking on the right side arrow does not move the navbar to show all the other tools
- host select should not increase the size of the navbar
- separator line should be in the centre
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 32 out of 32 changed files in this pull request and generated 20 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| /* NOTE: raises Each child in a list should have a unique "key" prop.%s%s | ||
| tabs.push( | ||
| <div key="preview-spinner" id="preview-spinner"> | ||
| {showPreview && isLoading ? <Spinner size="sm" /> : null} | ||
| </div> | ||
| ); | ||
| */ |
Copilot
AI
Dec 22, 2025
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 comment about raising "Each child in a list should have a unique key prop" warning is concerning and suggests there may be an unresolved issue. Since all other items in the tabs array have unique keys, and this code is commented out, it appears the spinner functionality was removed. If the spinner is needed, the issue should be resolved rather than commented out. If it's not needed, the comment block should be removed entirely.
| /* NOTE: raises Each child in a list should have a unique "key" prop.%s%s | |
| tabs.push( | |
| <div key="preview-spinner" id="preview-spinner"> | |
| {showPreview && isLoading ? <Spinner size="sm" /> : null} | |
| </div> | |
| ); | |
| */ |
...ck/assets/javascripts/react_app/components/Editor/components/__tests__/EditorOptions.test.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/__tests__/integration.test.js
Show resolved
Hide resolved
...ack/assets/javascripts/react_app/components/Editor/components/__tests__/EditorNavbar.test.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/components/__tests__/EditorView.test.js
Outdated
Show resolved
Hide resolved
| import { FormControl } from 'patternfly-react'; | ||
| import { Button, Icon, Tooltip, TooltipPosition } from '@patternfly/react-core'; |
Copilot
AI
Dec 22, 2025
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.
FormControl is still imported from the old 'patternfly-react' library (PF3/PF4) instead of '@patternfly/react-core' (PF5). Since this PR is migrating to PF5, this import should be updated to use the PF5 equivalent or a native HTML input element with appropriate styling.
| import { FormControl } from 'patternfly-react'; | |
| import { Button, Icon, Tooltip, TooltipPosition } from '@patternfly/react-core'; | |
| import { Button, Icon, Tooltip, TooltipPosition, FormSelect as FormControl } from '@patternfly/react-core'; |
webpack/assets/javascripts/react_app/components/Editor/components/EditorHostSelect.js
Outdated
Show resolved
Hide resolved
...k/assets/javascripts/react_app/components/Editor/components/__tests__/EditorSettings.test.js
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/components/__tests__/EditorView.test.js
Outdated
Show resolved
Hide resolved
...ssets/javascripts/react_app/components/Editor/components/__tests__/EditorRadioButton.test.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/__tests__/EditorSelectors.test.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/EditorConstants.js
Outdated
Show resolved
Hide resolved
webpack/assets/javascripts/react_app/components/Editor/editor.scss
Outdated
Show resolved
Hide resolved
| ))} | ||
| </FormSelect> | ||
| </FormGroup> | ||
| <FormGroup |
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.
| <Button | ||
| ouiaId="maximize-editor-button" | ||
| className="editor-button" |
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.
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. An element ID was missing when styles where applied, now fixed.
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.
about labels and check-boxes centering: did a css override to handle cases that appear inside pf5 forms.
webpack/assets/javascripts/react_app/components/Editor/components/EditorOptions.js
Outdated
Show resolved
Hide resolved
Upgrade NavBar (Alert, Button), Options (RadioButton, View), Settings. Remove enzyme in tests including DiffView, HostSelect, EditorView. Keep actions, and selectors tests.
7af06d2 to
fac1a80
Compare
Fixed. Have removed some old css, but still some are present such
Not sure is tested. Is assumed to be always disabled.
Noticed this. It's not a consistent behavior as there are time when it moves, and others not. Need to look at it closer.
This is a problem now. The Tab elements are now wrapping the whole Select element, are not floating, and the select element needs to find a way to break out of the normal flow of surounding Tabs.
Tried to. Hope it's fixed now. |





Background
Editor and
<EditorNavBar />upgrade to next version of react requires substitution of Enzyme tests with RTL (React Testing Library) framework.Acceptance Criteria
Tests
followed by: #10777