Provide a way to disable "select all on all pages"

Created on 27 January 2020, over 5 years ago
Updated 23 February 2023, about 2 years ago

We need to implement the same fix referenced in the parent issue in the 8.x branch.

Removing the option to select all items across pages should allow the admin to prevent users from shooting themselves in the foot, if he knows such an operation is likely to be used / executed.

πŸ“Œ Task
Status

Needs work

Version

4.1

Component

User interface

Created by

πŸ‡ΊπŸ‡ΈUnited States alfattal Minnesota

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.

  • πŸ‡¨πŸ‡ΏCzech Republic jaroslav červenΓ½

    I created patch for to use.

  • πŸ‡¨πŸ‡ΏCzech Republic jaroslav červenΓ½

    The client almost deleted 15,000 contents out of inattention, but we managed to solve it from the backup.
    This is UX problem.

  • ivnish Kazakhstan

    Graber can you propose a good solution how to fix this?

  • πŸ‡΅πŸ‡±Poland Graber

    Just address my comments on the PR. The patch in #10 contains exactly the changes from the PR at the time of writing this.

  • First commit to issue fork.
  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    @graber I'm surprised by some of your comments in PR. Seems like you don't see a use case of he patch.
    Atm we have only two options for the behavior:
    - checked - Always show selection info
    - unchecked - Calculated way to determine wheter we need to show it or not

    And we don't have any way to hide that block at all.
    This patch provides such a way.

    I updated a patch a bit, to fix the schema.
    But this is not ready solution yet, we also need to provide an upgrade path.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.1.x + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    15 pass
  • @hitchshock opened merge request.
  • πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

    Also, MR used outdated source branch, so I made a new one and updated the patch file.

  • πŸ‡¬πŸ‡§United Kingdom sharonho London

    Is there a patch that works with 4.2.5? Thanks

  • πŸ‡¨πŸ‡¦Canada star-szr

    Attaching a patch of the latest merge request against 4.2.5.

  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8
    last update over 1 year ago
    2 pass, 14 fail
  • πŸ‡ͺπŸ‡ΈSpain guardiola86

    Patch in 21 works with 4.2.6. It also hide the element "Selected X items"

  • Status changed to RTBC 12 months ago
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.1 + Environment: PHP 7.3 & MySQL 5.7
    last update 12 months ago
    Composer error. Unable to continue.
  • Open in Jenkins β†’ Open on Drupal.org β†’
    Core: 10.2.x + Environment: PHP 8.2 & MySQL 8
    last update 12 months ago
    15 pass
  • Status changed to Needs work 11 months ago
  • πŸ‡΅πŸ‡±Poland Graber

    On case of the patch referenced in #21 πŸ“Œ Provide a way to disable "select all on all pages" Needs work tests fail. The MR on the other hand looks good byt the select description needs updating so users know what's the "Default behavior". Also, in the MR there's a schema update which means we'll need an update hook for any existing config.

    Still needs work in any case.

  • Status changed to Needs review 2 months ago
  • πŸ‡ΊπŸ‡¦Ukraine knyshuk.vova

    Attaching a patch against 4.3.4.

  • πŸ‡ΊπŸ‡ΈUnited States alfattal Minnesota

    The patch in #25 works exactly as expected. +1 for RTBC.

  • πŸ‡ΊπŸ‡ΈUnited States alfattal Minnesota
  • First commit to issue fork.
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    mparker17 β†’ changed the visibility of the branch 4.3.x to hidden.

  • Pipeline finished with Canceled
    23 days ago
    Total: 79s
    #479285
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    I've turned the patch by @knyshuk.vova in #25 πŸ“Œ Provide a way to disable "select all on all pages" Needs work into a merge request.

    Next, I'll address the issue identified in #27 πŸ“Œ Provide a way to disable "select all on all pages" Needs work .

  • Pipeline finished with Success
    23 days ago
    Total: 181s
    #479286
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    Interesting, I don't see changes in any patches or merge requests that address the issue identified in #27 πŸ“Œ Provide a way to disable "select all on all pages" Needs work .

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    We should also add tests.

  • Pipeline finished with Success
    22 days ago
    Total: 196s
    #479587
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    To prove to myself what was going on, I added a test.

    With the patch in this issue...

    1. The 'Default Behavior' (i.e.: force_selection_info = '') is to:
      1. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table is empty (0 results)
      2. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 1 page of results
      3. show the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 2+ pages of results
    2. The 'Always show' (i.e.: force_selection_info = 'show') is to:
      1. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table is empty (0 results)
      2. show the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 1 page of results
      3. show the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 2+ pages of results
    3. The 'Always hide' (i.e.: force_selection_info = 'hide') is to:
      1. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table is empty (0 results)
      2. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 1 page of results
      3. hide the 'Select / deselect all results (all pages, N total)' checkbox (i.e.: input name="select_all") when the table has 2+ pages of results

    Given the above behavior, regarding the comment in #27...

    The patch in #25 works fine. However, it doesn't provide the option to disable the (Select / deselect all results) which is what this ticket is basically about.

    My understanding is that the 'Always hide' (i.e.: force_selection_info = 'hide') is a way to disable the "Select / deselect all results" checkbox? But maybe @alfattal is talking about something else, and I am misunderstanding #27?

  • Pipeline finished with Success
    22 days ago
    Total: 444s
    #480397
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    I've pushed an update hook to fix existing views (and I wrote a test for the update hook).

    I also put a Choice constraint on the force_selection_info configuration

    Looking at the configuration form control, I find it a bit confusing.

        $form['force_selection_info'] = [
          '#type' => 'select',
          '#title' => $this->t('Force show selection info state'),
          '#default_value' => $this->options['force_selection_info'],
          '#description' => $this->t('Should the selection info fieldset be shown above the view even if there is only one page of results and full selection can be seen in the view itself?'),
          '#options' => [
            '' => $this->t('Default Behavior'),
            'show' => $this->t('Always show'),
            'hide' => $this->t('Always hide'),
          ],
        ];
    

    At the very least, I would recommend that we change the key/label of the "Default" option β€” neither the key (i.e.: an empty string) nor the label ("Default Behaviour") describes what it does very well. Maybe something like 'only_multiple' => $this->t('Only when there are multiple pages'),?

    I daresay the title and description could be reworded as well, but I don't want to derail the discussion either.

    @graber what are your thoughts as a maintainer?

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    Moving back to "Needs Review"

  • Pipeline finished with Success
    22 days ago
    Total: 212s
    #480479
  • πŸ‡΅πŸ‡±Poland Graber

    At the very least, I would recommend that we change the key/label of the "Default" option β€” neither the key (i.e.: an empty string) nor the label ("Default Behaviour") describes what it does very well.

    Yes but from what I remember there may be more conditions. Should check first.

  • Pipeline finished with Success
    21 days ago
    Total: 229s
    #480556
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    Yes but from what I remember there may be more conditions. Should check first.

    @graber, I apologize, but are you asking me to check if there are more conditions? (I'm happy to try, but I'm asking for clarification because I don't want to be a bottleneck)

  • πŸ‡ΊπŸ‡ΈUnited States alfattal Minnesota

    @mparker17 Thank you for your comments and work on this issue and sorry if my comment in #27 πŸ“Œ Provide a way to disable "select all on all pages" Needs work wasn't clear enough. The patch in #25 πŸ“Œ Provide a way to disable "select all on all pages" Needs work as well as MR!103 hides the whole selection box which is useful for deselecting selected files.

    In the screenshot below, I've managed to hide the "select all on all pages" checkbox and link using CSS display: none.

    As you can see, the selection box in the middle is still showing which allow users to deselect the files

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    @alfattal, got it, thanks! I'll take a look!

  • Pipeline finished with Failed
    21 days ago
    Total: 275s
    #481432
  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    @alfattal, I've figured out a way to make the visibility of the "Items selected" details box independent from the visibility of the "Select / Deselect all results (all pages)" checkbox.

    I'm uploading it as a patch because it goes a bit further out-of-scope than what @jerrylow originally proposed as their own solution to the issue they filed (also, Hi @jerrylow! πŸ‘‹). If the other people in this issue agree that this is the direction that they want to go, I'll simply push the commit from my local.

    I've uploaded a patch to 4.3.x as is tradition; as well as an interdiff from the most-recent-commit to the merge request (commit 51e5c5c2) to show the proposed changes for someone already familiar with what's in the merge request.

    Feedback (from everyone in this issue, as well as the maintainers) is welcome!

    You can see in the attached screenshots that I've replaced the "Force show selection info state" with two controls: a control to change the visibility of the "Items selected" details element, and a separate control to change the visibility of the "Select / Deselect all results (all pages)" checkbox.

    Screenshot of config page and resulting view, configured to only show the selection box:

    Screenshot of config page and resulting view, configured to only show the select all checkbox:

    Screenshot of config page and resulting view, configured to show neither selection control

    Screenshot of config page and resulting view, configured to show both selection controls:

  • πŸ‡ΊπŸ‡ΈUnited States alfattal Minnesota

    @mparker17 Thank you so much for your work. The patch in #42 works flawlessly and it's precisely what this ticket is about. +1 for RTBC.

  • πŸ‡¨πŸ‡¦Canada mparker17 UTC-4

    @alfattal, awesome, I have pushed the commit! Reviews welcome!

  • Pipeline finished with Success
    17 days ago
    Total: 286s
    #483785
Production build 0.71.5 2024