Skip to content

dashboard: add adlist filter dropdown to Top Blocked Domains#3791

Open
sushantbhadauria wants to merge 2 commits into
pi-hole:developmentfrom
sushantbhadauria:feature/blocklist-category-filter
Open

dashboard: add adlist filter dropdown to Top Blocked Domains#3791
sushantbhadauria wants to merge 2 commits into
pi-hole:developmentfrom
sushantbhadauria:feature/blocklist-category-filter

Conversation

@sushantbhadauria
Copy link
Copy Markdown

Allow users to filter the Top Blocked Domains table by subscription list (adlist) directly from the dashboard.

  • index.lp: add a in the Top Blocked Domains box header scripts/js/index.js: populateBlockedListFilter(): fetch /api/lists, populate dropdown with enabled blocklists updateTopDomainsTable(): when a specific list is selected, fetch a larger pool of top domains and filter client-side via /api/search/ to identify which adlist each domain belongs to, then render the top 10 matches; falls back to the unfiltered endpoint when "All lists" is selected wire dropdown change event to refresh the table. Tests Results test_web.txt

@sushantbhadauria sushantbhadauria requested a review from a team as a code owner June 1, 2026 17:52
@yubiuser
Copy link
Copy Markdown
Member

yubiuser commented Jun 1, 2026

Please provide a screenshot for your change. Btw: tests are failing

sushantbhadauria and others added 2 commits June 1, 2026 23:52
Allow users to filter the Top Blocked Domains table by subscription
list (adlist) directly from the dashboard.

- index.lp: add a <select id="ad-frequency-list-filter"> in the
  Top Blocked Domains box header
- scripts/js/index.js:
  - populateBlockedListFilter(): fetch /api/lists, populate dropdown
    with enabled blocklists
  - updateTopDomainsTable(): when a specific list is selected, fetch a
    larger pool of top domains and filter client-side via
    /api/search/<domain> to identify which adlist each domain belongs
    to, then render the top 10 matches; falls back to the unfiltered
    endpoint when "All lists" is selected
  - wire dropdown change event to refresh the table

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Sushant Bhadauria <sushant14bhadauria@gmail.com>
- Replace .forEach() with for...of loops (unicorn/no-array-for-each)
- Use Number.parseInt instead of parseInt (unicorn/prefer-number-properties)
- Add required blank lines before statements (@stylistic/padding-line-between-statements)

Co-authored-by: Cursor <cursoragent@cursor.com>
Signed-off-by: Sushant Bhadauria <sushant14bhadauria@gmail.com>
@sushantbhadauria sushantbhadauria force-pushed the feature/blocklist-category-filter branch from ff9f04e to 5f013fd Compare June 1, 2026 18:22
@sushantbhadauria
Copy link
Copy Markdown
Author

Now the test should pass but this should go post pi-hole/FTL#2904 . Here is screenshot.
Screenshot 2026-06-01 at 9 35 17 PM
Screenshot 2026-06-01 at 9 35 25 PM

@yubiuser
Copy link
Copy Markdown
Member

yubiuser commented Jun 2, 2026

Ok, I see.

What is you end goal here? What benefit does the user have, if we added this selection box? The same domain could be part of multiple list, why should I care about which list it belongs to? Note: the top blocked table also contains domains that would be blocked by a blocked domain entry or a blocking regex. How do you want to handle those?

@sushantbhadauria
Copy link
Copy Markdown
Author

Thanks for the feedback — The main goal is to help users evaluate and audit their subscription lists. When someone subscribes to 10–15 lists (ads, malware, adult content, regional lists, etc.), it's currently impossible to tell which lists are actively contributing to blocks on their network. A per-list breakdown lets them answer questions like: "Is this list doing anything useful, or can I remove it?" and "Most of my blocked traffic — is it ads or malware?"

Domain in multiple lists: a domain can appear in several lists simultaneously. The current behaviour is that filtering by list A shows all domains that are in list A, even if they also appear in other lists.

Regex / denylist entries: These are intentionally hidden when a specific list is selected, since they don't belong to any subscription list. They continue to appear normally under "All lists". I can add a note in the UI (e.g., a small tooltip or footnote) clarifying that the filtered view only reflects subscription list matches.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants