Problem/Motivation

I have a lot of banned IPs (> 7.000). It would be more friendly to have a paged report of IPs. To load the report it takes "hours".

The pagination should work in combination with other features like filtering and bulk-selection / deletion!

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3153262

Command icon 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:

Issue fork ban-3153262

Command icon 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:

Comments

PROMES created an issue. See original summary.

Version: 9.0.x-dev » 9.1.x-dev

Drupal 9.0.10 was released on December 3, 2020 and is the final full bugfix release for the Drupal 9.0.x series. Drupal 9.0.x will not receive any further development aside from security fixes. Sites should update to Drupal 9.1.0 to continue receiving regular bugfixes.

Drupal-9-only bug reports should be targeted for the 9.1.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.2.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.1.x-dev » 9.3.x-dev

Drupal 9.1.10 (June 4, 2021) and Drupal 9.2.10 (November 24, 2021) were the last bugfix releases of those minor version series. Drupal 9 bug reports should be targeted for the 9.3.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

pagaille made their first commit to this issue’s fork.

pagaille’s picture

Status: Active » Needs review
promes’s picture

Thanks, It works.

pagaille’s picture

StatusFileSize
new1.62 KB

Glad to hear it! Here's a patch for convenience.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.15 was released on June 1st, 2022 and is the final full bugfix release for the Drupal 9.3.x series. Drupal 9.3.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.4.x-dev branch from now on, and new development or disruptive changes should be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

prasanth_kp’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new65.95 KB
new68.74 KB

Thanks for the patch,
Its working perfectly fine, Now displays 50 records per page instead of all records on a single page.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/ban/src/BanIpManager.php
@@ -37,7 +38,12 @@ public function isBanned($ip) {
   public function findAll() {
-    return $this->connection->query('SELECT * FROM {ban_ip}');
+    return $this->connection
+      ->select('ban_ip', 'b')
+      ->extend(PagerSelectExtender::class)
+      ->limit(50)
+      ->fields('b')
+      ->execute();
   }

I think we need to implement this in the BanAdmin class. Making this change of behaviour to findAll() - so that it no longer findsAll doest seem like a change in accord with our BC rules or a good one in light of the API... see

  /**
   * Finds all banned IP addresses.
   *
   * @return \Drupal\Core\Database\StatementInterface
   *   The result of the database query.
   */
  public function findAll();

would no longer be true.

Perhaps in the interests of encapsulation we can add a pager method to BanIpManagerInterface so that all the interaction with the table is via the BanManager and an alternate backend could implement this.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.9 was released on December 7, 2022 and is the final full bugfix release for the Drupal 9.4.x series. Drupal 9.4.x will not receive any further development aside from security fixes. Drupal 9 bug reports should be targeted for the 9.5.x-dev branch from now on, and new development or disruptive changes should be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

quietone’s picture

Status: Needs work » Postponed

The Ban Module was approved for removal in #1570102: [Policy] Deprecate Ban module.

This remains Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.

The deprecation work is in #3482198: [meta] Tasks to deprecate the Ban module and the removal work in #3488827: [meta] Tasks to remove Ban module.

Ban will be moved to a contributed project after the Drupal 12.x branch is open.

johnv’s picture

Title: Paged output for banned IPs » Add pager to banned IPs view

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.

mstrelan’s picture

Project: Drupal core » Ban
Version: main » 1.0.x-dev
Component: ban.module » Code
Status: Postponed » Needs work

Moved to contrib queue

anybody’s picture

Version: 1.0.x-dev » 1.1.x-dev

anybody changed the visibility of the branch drupal-3153262/3153262-paged-output-for to hidden.

anybody changed the visibility of the branch 3153262-paged-output-for to hidden.

anybody’s picture

Title: Add pager to banned IPs view » Add pagination to banned IPs view
anybody’s picture

anybody’s picture

Issue summary: View changes
Issue tags: +Novice
anybody’s picture

Please use a MR instead of a patch here for further review. Also see #11.

#3575759: Add (starts with) filtering for banned IPs table is related.

anybody’s picture

Status: Needs work » Postponed

Maybe we should consider NOT adding a pager to be able to filter directly on the page, see #3575759: Add (starts with) filtering for banned IPs table. Might simplify things and it seems a pager wasn't really needed in the last 10 years? :D

What do the other maintainers think about it?

anybody’s picture

Indeed I'd vote to close this won't fix, as "good enough" and smart. Especially once we have a collapsible field group around the large list.

grevil’s picture

I agree!

anybody’s picture

Status: Postponed » Closed (won't fix)

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.