From 459941fb2fdb7365b0169ea06e9148afdd0319e0 Mon Sep 17 00:00:00 2001 From: Dirk Brenken Date: Sat, 22 Aug 2026 08:05:35 +0200 Subject: [PATCH] =?UTF-8?q?luci-app-banip:=20correction=20to=20the=20prese?= =?UTF-8?q?ntation=20of=20the=20=E2=80=98worst=20sets=E2=80=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Top- and Worst-Lists rendered the identical 'elements / packets' string, so a set appearing in both showed the same numbers twice with two very different bars. Worst Sets now shows the value it is ranked by. Signed-off-by: Dirk Brenken --- applications/luci-app-banip/Makefile | 2 +- .../resources/view/banip/setreport.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/applications/luci-app-banip/Makefile b/applications/luci-app-banip/Makefile index 161b82a385..268f99ef2b 100644 --- a/applications/luci-app-banip/Makefile +++ b/applications/luci-app-banip/Makefile @@ -7,7 +7,7 @@ LUCI_TITLE:=LuCI support for banIP LUCI_DEPENDS:=+luci-base +banip PKG_VERSION:=1.8.12 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=Apache-2.0 PKG_MAINTAINER:=Dirk Brenken diff --git a/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/setreport.js b/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/setreport.js index daec7c8547..e05bbb65f2 100644 --- a/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/setreport.js +++ b/applications/luci-app-banip/htdocs/luci-static/resources/view/banip/setreport.js @@ -408,12 +408,8 @@ return view.extend({ /* ranked lists with relative bars - - A quota only means something once the counters exist. The report - carries an empty string rather than a zero while the 'count' option - is off, which is what separates "not counted" from "counted zero". */ - function topList(title, hint, entries, color, empty) { + function topList(title, hint, entries, color, empty, fmtValue) { const list = entries.slice(0, 10); /* both lists are ranked by their bar metric, so the peak is the head */ const peak = list.reduce(function (max, entry) { @@ -426,13 +422,17 @@ return view.extend({ } else if (hits.counted === 0) { note = _('packet counters disabled'); } + const pair = `${_('elements')} / ${_('packets')}`; const rows = list.map(function (entry) { const width = peak > 0 ? Math.round(entry.value / peak * 100) : 0; return E('div', { 'class': 'ban-row' }, [ E('div', { 'class': 'ban-row-top' }, [ E('span', { 'class': 'ban-row-name' }, [entry.name]), - E('span', { 'class': 'ban-row-cnt' }, [ - `${fmtCount(entry.elements)} / ${fmtCount(entry.hits)}` + E('span', { + 'class': 'ban-row-cnt', + 'title': `${fmtCount(entry.elements)} / ${fmtCount(entry.hits)} ${pair}` + }, [ + fmtValue ? fmtValue(entry) : `${fmtCount(entry.elements)} / ${fmtCount(entry.hits)}` ]) ]), E('div', { 'class': 'ban-bar' }, [ @@ -470,7 +470,8 @@ return view.extend({ ]), E('div', { 'class': 'ban-grid' }, [ topList(_('Top Sets'), _('elements / packets'), hits.hits, 'info', _('no hits yet')), - topList(_('Worst Sets'), _('elements per packet'), hits.worst, 'err', '-') + topList(_('Worst Sets'), _('elements per packet'), hits.worst, 'err', '-', + function (entry) { return fmtCount(Math.round(entry.value)); }) ]), E('div', { 'class': 'ban-grid' }, [ E('div', { 'class': 'ban-card' }, [