From 14e534468aa659788937bdc8d17b795dfde4daf6 Mon Sep 17 00:00:00 2001 From: Matt Scott Date: Sun, 19 Feb 2023 15:54:11 -0500 Subject: [PATCH] Working on first-round changes for the global search feature. --- powerdnsadmin/routes/admin.py | 9 +- .../templates/admin_global_search.html | 411 ++++++++++-------- 2 files changed, 242 insertions(+), 178 deletions(-) diff --git a/powerdnsadmin/routes/admin.py b/powerdnsadmin/routes/admin.py index 5a90e10..eb27950 100644 --- a/powerdnsadmin/routes/admin.py +++ b/powerdnsadmin/routes/admin.py @@ -2055,7 +2055,14 @@ def global_search(): else: pass - return render_template('admin_global_search.html', domains=domains, records=records, comments=comments) + params: dict = { + 'query': query if query is not None else '', + 'domains': domains, + 'records': records, + 'comments': comments, + } + + return render_template('admin_global_search.html', **params) def validateURN(value): diff --git a/powerdnsadmin/templates/admin_global_search.html b/powerdnsadmin/templates/admin_global_search.html index dfe14a6..73de785 100644 --- a/powerdnsadmin/templates/admin_global_search.html +++ b/powerdnsadmin/templates/admin_global_search.html @@ -1,201 +1,258 @@ {% extends "base.html" %} - {% set active_page = "admin_global_search" %} - -{% block title %} - - Global Search - {{ SITE_NAME }} - -{% endblock %} +{% block title %}Global Search - {{ SITE_NAME }}{% endblock %} {% block dashboard_stat %} -
-
-
-
-

- Global Search - Search for domains, records and comments directly from PDNS API -

+
+
+
+
+

Global Search

+
+ +
+ +
+ +
+
-
- -
-
+
-
+ {% endblock %} {% block content %} -
-
-
-
-
-
-

Global Search

-
-
-
-
- -
- -
+
+
+
+
+ +
+
+

Global Search

+
+ +
+
+

This tool can be used to search for domains, records, and comments via the PDNS + API.

+
+ +
+
+ + +
+
+ +
+

The * character can be used in your keyword as a wildcard character and the ? + character can be used as a wildcard for a single character.

+
+ +
+ +
+ +
- -
-

Hints: The * character can be used in your keyword as a wildcard character and the ? character can be used as - a wildcard for a - single character. -

-
+
-
-
-
+ -
-
-
-
-

Domains ({{ domains|length }})

+
+
+
+
+

Zones ({{ domains|length }})

+
+ +
+ + + + + + + + {% for domain in domains %} + + + + {% endfor %} + +
Zone Name
+ {{ domain['name'] }} +
+
+ +
+ +
+
-
- - - - - - - - {% for domain in domains %} - - - - {% endfor %} - -
Domain
- {{ domain['name'] }} -
-
-
-
-
+ -
-
-
-
-

Records ({{ records|length }})

+
+
+
+
+

Zone Records ({{ records|length }})

+
+ +
+ + + + + + + + + + + + {% for record in records %} + + + + + + + + {% endfor %} + +
NameTypeStatusTTLData
+ {{ record['name'] }} + {{ record['type'] }}{{ 'Disabled' if record['disabled'] else 'Active' }}{{ record['ttl'] }}{{ record['content'] }}
+
+ +
+ +
+
-
- - - - - - - - - - - - {% for record in records %} - - - - - - - - {% endfor %} - -
NameTypeStatusTTLData
- {{ record['name'] }} - {{ record['type'] }}{{ 'Disabled' if record['disabled'] else 'Active' }}{{ record['ttl'] }}{{ record['content'] }}
-
-
-
-
+ -
-
-
-
-

Comments ({{ comments|length }})

+
+
+
+
+

Comments ({{ comments|length }})

+
+ +
+ + + + + + + + + + {% for comment in comments %} + + + + + + {% endfor %} + +
CommentRecordZone
{{ comment['content'] }}{{ comment['name'] }} + {{ comment['zone_id'] }} +
+
+ +
+ +
+
-
- - - - - - - - - - {% for comment in comments %} - - - - - - {% endfor %} - -
CommentRecordDomain
{{ comment['content'] }}{{ comment['name'] }} - {{ comment['zone_id'] }} -
-
-
+
-
-
-
+ + +{% endblock %} + +{% block head_styles %} + {% endblock %} {% block extrascripts %} - + // Initialize DataTables for comments + $("#tbl_comment").DataTable({ + "paging": true, + "lengthChange": true, + "searching": true, + "ordering": true, + "info": false, + "autoWidth": false, + "order": [ + [0, "asc"] + ] + }); + {% endblock %}