From 701f0146192318a9888bd822c0bd27c101d2c662 Mon Sep 17 00:00:00 2001 From: librelad Date: Thu, 20 Aug 2026 00:15:58 +0100 Subject: [PATCH] Hide zero-count filter chips on the Updates tab MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit An empty chip is a dead end: clicking it can only ever produce "Nothing matches this filter". Hidden rather than disabled, because a greyed-out chip still occupies the eye, and "no apps have CVEs" is better said by the row of chips being short than by a control you are told not to press. Two exceptions. `all` is never hidden — it is the way back. And the active chip stays put even at zero: a rescan can empty the filter you are standing in, and pulling it out from under the selection would leave the list filtered by a chip that is no longer on screen. Verified against the running WebUI: Updates sits at 0 here and its chip is gone, leaving All 14 / Newer 3 / Security 11, with every remaining chip still selecting correctly. Forcing the filter to `updates` re-shows that chip marked active, so the zero-but-selected case renders as intended. Co-Authored-By: Claude Opus 5 --- .../apps/overview/js/overview-manager.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/containers/libreportal/frontend/components/apps/overview/js/overview-manager.js b/containers/libreportal/frontend/components/apps/overview/js/overview-manager.js index c9c9989..a0b1e2d 100644 --- a/containers/libreportal/frontend/components/apps/overview/js/overview-manager.js +++ b/containers/libreportal/frontend/components/apps/overview/js/overview-manager.js @@ -583,8 +583,18 @@ class OverviewManager { const nUpd = up.apps.filter((a) => a.update_available).length; const nNew = up.apps.filter((a) => !a.update_available && a.newer_version).length; const nSec = up.apps.filter((a) => (a.cves || []).length).length; - const chip = (id, label, n) => - ``; + // An empty chip is a dead end — clicking it can only ever produce "Nothing + // matches this filter". Hidden rather than disabled: a greyed-out chip still + // occupies the eye, and "no apps have CVEs" is better said by the row of + // chips being short than by a control you are told not to press. + // The active chip is the exception and stays put even at zero: a rescan can + // empty the filter you are standing in, and pulling it out from under the + // selection would leave the list filtered by a chip that is no longer there. + // 'all' is never hidden — it is the way back. + const chip = (id, label, n) => { + if (n === 0 && id !== 'all' && this.filter !== id) return ''; + return ``; + }; const rows = shown.map((a) => this.updateRow(a)).join('') || `
Nothing matches this filter.
`; // The auto-check line leads the body (with its right-side Check-now nudge); // "Update all" lives in the tab header's action slot (renderTab), so the