Skip to content
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

Fixes #37398 - Extend TableIndexPage and TableHooks with new capabilities for All Hosts page #10128

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

jeremylenz
Copy link
Contributor

@jeremylenz jeremylenz commented Apr 16, 2024

This adds several features to TableIndexPage and TableHooks, enabling Katello/katello#10962 to work. Ideally the two PRs should be reviewed together.

  • add the option to use idColumnName to <RowSelectTd>. This is so you can optionally pass in an alternate idColumn to useBulkSelect.
  • Add the option to supply your own pagination component in <Table>. When using the <TableIndexPage> without specifying children, it was causing some issues with the bottom pagination not being in sync or making API requests. Allowing the parent to specify the bottomPagination solves this, because you can now guarantee that the top and bottom pagination have the same data.
  • Add a hasInteracted state to useBulkSelect. This is so you can delay showing validations (e.g. for forms and wizards ;) until the user has actually interacted with the component. It's bad UX to throw up a validation message such as "You must select at least one X!!" before the user has even gotten a chance to do anything. I had tried adding this to the pagination functions in Katello, but this solution is much more elegant.
  • Add a pushToHistory option to useSetParamsAndAPIAndSearch. When you are using an embedded table (e.g. one that should not keep itself in sync with URL params for search and pagination), you need to be able to skip changing the browser URL.
  • Add updateParamsByUrl to <TableIndexPage> for the same reason.
  • Add restrictedSearchQuery to <TableIndexPage>. This allows you to restrict all table rows to ones matching the search you specify here. This restricted search query will not show up visually in the search input, but will be added to the user search in the API request, causing every search to be "within" the restricted search query's results. Usage example: I select 50 hosts and bring up the package install wizard. The package install wizard has the 50 hosts I selected. I am able to search within those and deselect if desired, but I cannot add any hosts to the selection.

@github-actions github-actions bot added the UI label Apr 16, 2024
@jeremylenz jeremylenz changed the title Foreman modal magic Fixes #37398 - Extend TableIndexPage and TableHooks with new capabilities for All Hosts page Apr 30, 2024
@jeremylenz jeremylenz marked this pull request as ready for review April 30, 2024 13:05
@jeremylenz jeremylenz requested a review from a team as a code owner May 3, 2024 15:24
@jeremylenz
Copy link
Contributor Author

Updated package.json with "@theforeman/vendor": "^13.1.0" to enable the use of @patternfly/react-core/next.

@evgeni
Copy link
Member

evgeni commented May 3, 2024

Packit will still fail, as 13.1.0 ain't packaged yet, but we'll get there

  with new capabilities for All Hosts page

- add the option to use `idColumnName` to `<RowSelectTd>`
- Add the option to supply your own pagination component in `<Table>`
- Add a `hasInteracted` state to `useBulkSelect`
- Add a `pushToHistory` option to `useSetParamsAndAPIAndSearch` to skip changing the browser URL
- Add `updateParamsByUrl` to `<TableIndexPage>` for the same reason
- Add `restrictedSearchQuery` to `<TableIndexPage>`
@ianballou
Copy link
Contributor

Testing this PR via Katello/katello#10962 showed no technical issues.

@evgeni
Copy link
Member

evgeni commented May 7, 2024

@jeremylenz you dropped the use of @patternfly/react-core/next again?

@jeremylenz
Copy link
Contributor Author

@evgeni Nope, that use is in the Katello PR.

Copy link
Contributor

@parthaa parthaa left a comment

Choose a reason for hiding this comment

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

Happy with the changes here. Tested it with Katello PR. Works well 👍

@jeremylenz jeremylenz force-pushed the foreman-modal-magic branch 2 times, most recently from 2f2a294 to 60b7481 Compare May 15, 2024 21:39
@jeremylenz
Copy link
Contributor Author

Re: React on plugins katello/katello failures, see Katello/katello#10962 (comment)

@jeremylenz
Copy link
Contributor Author

I plan to wait til after stabilization week to merge this. Will need an ack from @theforeman/packaging then.

@jeremylenz
Copy link
Contributor Author

Foreman is now branched. @theforeman/packaging are we good here?

@evgeni
Copy link
Member

evgeni commented May 22, 2024

(that ack is purely packaging, I did not look at the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
5 participants