diff --git a/changelog.d/1044.added.md b/changelog.d/1044.added.md new file mode 100644 index 000000000..4c606c151 --- /dev/null +++ b/changelog.d/1044.added.md @@ -0,0 +1 @@ +Add text field to filter incident list by tags diff --git a/src/argus/htmx/incident/filter.py b/src/argus/htmx/incident/filter.py index 7ef7f80a5..209af1bcb 100644 --- a/src/argus/htmx/incident/filter.py +++ b/src/argus/htmx/incident/filter.py @@ -47,6 +47,16 @@ class IncidentFilterForm(forms.Form): required=False, label="Sources", ) + tags = forms.CharField( + widget=forms.TextInput( + attrs={ + "placeholder": "enter tags...", + "class": "show-selected-box input input-accent input-bordered input-md border overflow-y-auto min-h-8 h-auto max-h-16 max-w-xs leading-tight", + } + ), + required=False, + label="Tags", + ) maxlevel = forms.IntegerField( widget=forms.NumberInput( attrs={"type": "range", "step": "1", "min": min(Level).value, "max": max(Level).value} @@ -89,6 +99,10 @@ def to_filterblob(self): if sourceSystemIds: filterblob["sourceSystemIds"] = sourceSystemIds + tags = self.cleaned_data.get("tags", []) + if tags: + filterblob["tags"] = tags.split(", ") + maxlevel = self.cleaned_data.get("maxlevel", 0) if maxlevel: filterblob["maxlevel"] = maxlevel diff --git a/src/argus/htmx/templates/htmx/incident/_incident_filterbox.html b/src/argus/htmx/templates/htmx/incident/_incident_filterbox.html index f8f2ac70f..f18c956a7 100644 --- a/src/argus/htmx/templates/htmx/incident/_incident_filterbox.html +++ b/src/argus/htmx/templates/htmx/incident/_incident_filterbox.html @@ -14,7 +14,7 @@ {% for field in filter_form %} {% if not field.field.in_header %}