Add pagination to the workspace manage page

Created on 5 April 2022, almost 3 years ago
Updated 30 April 2024, 9 months ago

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.

πŸ› Bug report
Status

Fixed

Version

10.3 ✨

Component
WorkspacesΒ  β†’

Last updated about 18 hours ago

No maintainer
Created by

πŸ‡·πŸ‡΄Romania amateescu

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • Status changed to Needs review 11 months ago
  • Pipeline finished with Success
    11 months ago
    Total: 594s
    #129958
  • Status changed to RTBC 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave
    1) Drupal\Tests\workspaces\Functional\WorkspaceTest::testWorkspaceManagePage
    Behat\Mink\Exception\ExpectationException: Link with label Term 1 found.
    /builds/issue/drupal-3273461/core/tests/Drupal/Tests/WebAssert.php:580
    /builds/issue/drupal-3273461/core/tests/Drupal/Tests/WebAssert.php:350
    /builds/issue/drupal-3273461/core/modules/workspaces/tests/src/Functional/WorkspaceTest.php:224
    /builds/issue/drupal-3273461/vendor/phpunit/phpunit/src/Framework/TestResult.php:728
    ERRORS!
    Tests: 9, Assertions: 211, Errors: 1.
    

    Test-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.

  • πŸ‡·πŸ‡΄Romania amateescu

    @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.

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Is there any reason why we're not using \Drupal\Core\Database\Query\PagerSelectExtender and \Drupal\Core\Database\Query\TableSortExtender?

  • πŸ‡·πŸ‡΄Romania amateescu

    @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 :)

  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Maybe 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.

  • Status changed to Needs review 10 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Gonna put this back to needs review while @amateescu has a think.

  • Status changed to Needs work 10 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    Per slack from @amateescu

  • Status changed to Needs review 10 months ago
  • πŸ‡·πŸ‡΄Romania amateescu

    Implemented the separate method as discussed above, and it's 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.

  • Pipeline finished with Failed
    10 months ago
    Total: 201s
    #156616
  • Status changed to Needs work 10 months ago
  • The 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.

  • Status changed to Needs review 10 months ago
  • πŸ‡·πŸ‡΄Romania amateescu

    Btw, a quick`n`dirty way to test this MR is to edit a couple of entities in a workspace and manually change WorkspaceViewBuilder.php::$limit to 1 :)

  • Pipeline finished with Success
    10 months ago
    Total: 492s
    #156646
  • Pipeline finished with Success
    9 months ago
    Total: 674s
    #157754
  • Status changed to RTBC 9 months ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    I 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

  • Status changed to Fixed 9 months ago
  • πŸ‡¬πŸ‡§United Kingdom alexpott πŸ‡ͺπŸ‡ΊπŸŒ

    Committed and pushed f7950eb418 to 11.x and fdac75b8b0 to 10.3.x. Thanks!

    • alexpott β†’ committed fdac75b8 on 10.3.x
      Issue #3273461 by amateescu, smustgrave, alexpott: Add pagination to the...
    • alexpott β†’ committed f7950eb4 on 11.x
      Issue #3273461 by amateescu, smustgrave, alexpott: Add pagination to the...
Production build 0.71.5 2024