From 56b365df4040a28bec400a28e79dde3068e817ef Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 3 Apr 2024 16:01:24 +0200 Subject: [PATCH] UI - Improvements to tag/groups page, show number of watches under each group, link group name to list (#2290) --- changedetectionio/blueprint/tags/__init__.py | 8 +++++++- .../blueprint/tags/templates/groups-overview.html | 4 +++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py index ba20cb4a..7a49822b 100644 --- a/changedetectionio/blueprint/tags/__init__.py +++ b/changedetectionio/blueprint/tags/__init__.py @@ -12,9 +12,15 @@ def construct_blueprint(datastore: ChangeDetectionStore): from .form import SingleTag add_form = SingleTag(request.form) sorted_tags = sorted(datastore.data['settings']['application'].get('tags').items(), key=lambda x: x[1]['title']) + + from collections import Counter + + tag_count = Counter(tag for watch in datastore.data['watching'].values() if watch.get('tags') for tag in watch['tags']) + output = render_template("groups-overview.html", - form=add_form, available_tags=sorted_tags, + form=add_form, + tag_count=tag_count ) return output diff --git a/changedetectionio/blueprint/tags/templates/groups-overview.html b/changedetectionio/blueprint/tags/templates/groups-overview.html index 7d942f43..23eca0a6 100644 --- a/changedetectionio/blueprint/tags/templates/groups-overview.html +++ b/changedetectionio/blueprint/tags/templates/groups-overview.html @@ -27,6 +27,7 @@ + # Watches Tag / Label name @@ -45,7 +46,8 @@ Mute notifications - {{tag.title}} + {{ "{:,}".format(tag_count[uuid]) if uuid in tag_count else 0 }} + {{ tag.title }} Edit  Delete