From: Michael Tremer Date: Wed, 14 Jan 2026 18:26:34 +0000 (+0000) Subject: dbl: Improve search result and show it on report pages X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63e9812cb98f4e8ad5ad928e9103ee3ba403efb5;p=ipfire.org.git dbl: Improve search result and show it on report pages Signed-off-by: Michael Tremer --- diff --git a/src/backend/dbl.py b/src/backend/dbl.py index ce19b219..65bc2095 100644 --- a/src/backend/dbl.py +++ b/src/backend/dbl.py @@ -116,7 +116,9 @@ class DBL(Object): tasks[task] = result[slug] # Return a mapping with the list and domains - return { task.result() : tasks[task] for task in tasks } + return { + task.result() : SearchResult(self.backend, **tasks[task]) for task in tasks + } class Model(pydantic.BaseModel): @@ -344,6 +346,13 @@ class Report(Model): # Closed By closed_by : str | None = None + # Closed? + def is_closed(self): + if self.closed_at: + return True + + return False + # Comment comment : str = "" @@ -406,3 +415,14 @@ class DomainHistory(Model): # Allows allows: int = 0 + + +class SearchResult(Model): + # Domain + domain: str + + # Changed At + changed_at: datetime.datetime + + # Status + status: str diff --git a/src/templates/dbl/reports/show.html b/src/templates/dbl/reports/show.html index 4df43eac..58452da0 100644 --- a/src/templates/dbl/reports/show.html +++ b/src/templates/dbl/reports/show.html @@ -64,6 +64,33 @@ {% if report.comment %}
{{ report.comment }}
{% end %} + + {# Status #} + {% if status %} +
+ {{ _("Status") }} +
+ + + {% end %} diff --git a/src/templates/dbl/search.html b/src/templates/dbl/search.html index 5408b10c..67317f21 100644 --- a/src/templates/dbl/search.html +++ b/src/templates/dbl/search.html @@ -23,7 +23,7 @@
{# Show any results #} {% if results %} - {% for list, domains in sorted(results.items()) %} + {% for list, result in sorted(results.items()) %} {% end %} diff --git a/src/web/dbl.py b/src/web/dbl.py index 0d370fc6..73bb7057 100644 --- a/src/web/dbl.py +++ b/src/web/dbl.py @@ -133,7 +133,13 @@ class ReportHandler(base.AnalyticsMixin, BaseHandler): # Fetch the list list = await report.get_list() - self.render("dbl/reports/show.html", report=report, list=list) + # Fetch the domain status + if report.is_closed(): + status = None + else: + status = await self.backend.dbl.search(report.name) + + self.render("dbl/reports/show.html", report=report, list=list, status=status) class SearchHandler(base.AnalyticsMixin, BaseHandler):