Problem/Motivation
The workspace manage page can not handle the case when thousands of entities are changed in a workspace.
Steps to reproduce
Change 2000 or more entities inside a workspace.
Proposed resolution
Add pagination to the workspace manage page.
Remaining tasks
Make the pager limit configurable, like the taxonomy one?
User interface changes
Nope.
API changes
API addition: three new optional parameters are added to \Drupal\workspaces\WorkspaceAssociationInterface::getTrackedEntities().
Data model changes
Nope.
Release notes snippet
Nope.
| Comment | File | Size | Author |
|---|---|---|---|
| #22 | Screenshot 2024-04-26 at 2.17.00 PM.png | 100.15 KB | smustgrave |
| #19 | 3273461-nr-bot.txt | 2.14 KB | needs-review-queue-bot |
Issue fork drupal-3273461
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3273461-add-pagination-to
changes, plain diff MR !7194
Comments
Comment #2
amateescu commentedThis should do it.
Comment #4
amateescu commentedLet's keep the previous sort order for now. It might make sense to try and change that in a different issue, since we want to show the latest revisions first in the UI.
Comment #10
amateescu commentedComment #11
smustgrave commentedTest-only feature shows test coverage
I don't have 50 workspaces :) but based on how I've seen other parts of core do this this appears correct.
Comment #12
amateescu commented@smustgrave, you don't need 50 workspaces, just to edit >50 entities in a workspace :P
One thing I don't really like about this MR is the large number of arguments of
WorkspaceAssociation::getTrackedEntities(), but I didn't have any better idea. Maybe a new method is needed for getting a "paginated" list of tracked entities, without the ability to filter by entity type ID and entity ID... not sure.Comment #13
alexpottIs there any reason why we're not using \Drupal\Core\Database\Query\PagerSelectExtender and \Drupal\Core\Database\Query\TableSortExtender?
Comment #14
amateescu commented@alexpott because
WorkspaceAssociation::getTrackedEntities()is a "low level" API function that shouldn't be influenced by any global pager. Maybe this is another point in favor of adding a separate method for this listing :)Comment #15
alexpottMaybe we could add getTrackedEntitiesAsQuery() and return the query object for us to do stuff with - or just not use it... but given \Drupal\workspaces\WorkspaceAssociation::TABLE - maybe this returning a query object you to do stuff to would work nicely.
Comment #16
alexpottGonna put this back to needs review while @amateescu has a think.
Comment #17
smustgrave commentedPer slack from @amateescu
Comment #18
amateescu commentedImplemented the separate method as discussed above, and it looks much better!
Regarding
\Drupal\Core\Database\Query\TableSortExtender, we can't use it because the data displayed in the table is coming from the individual revision objects, not from the `workspace_association` table.Comment #19
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #20
amateescu commentedComment #21
amateescu commentedBtw, a quick`n`dirty way to test this MR is to edit a couple of entities in a workspace and manually change
WorkspaceViewBuilder.php::$limitto 1 :)Comment #22
smustgrave commentedI did just that haha thanks for the pointer
I applied some minor change to the MR for the return type but overall rest of the changes appear good
Comment #23
alexpottCommitted and pushed f7950eb418 to 11.x and fdac75b8b0 to 10.3.x. Thanks!