mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 15:10:27 +00:00
Working on first-round changes for the global search feature.
This commit is contained in:
parent
67040ad9c2
commit
14e534468a
@ -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):
|
||||
|
@ -1,201 +1,258 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% set active_page = "admin_global_search" %}
|
||||
|
||||
{% block title %}
|
||||
<title>
|
||||
Global Search - {{ SITE_NAME }}
|
||||
</title>
|
||||
{% endblock %}
|
||||
{% block title %}<title>Global Search - {{ SITE_NAME }}</title>{% endblock %}
|
||||
|
||||
{% block dashboard_stat %}
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-sm-6">
|
||||
<h1 class="m-0 text-dark">
|
||||
Global Search
|
||||
<small>Search for domains, records and comments directly from PDNS API</small>
|
||||
</h1>
|
||||
<div class="content-header">
|
||||
<div class="container-fluid">
|
||||
<div class="row mb-2">
|
||||
<div class="col-6">
|
||||
<h1 class="m-0 text-dark">Global Search</h1>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
<div class="col-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item active">Global Search</li>
|
||||
</ol>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
<div class="col-sm-6">
|
||||
<ol class="breadcrumb float-sm-right">
|
||||
<li class="breadcrumb-item"><a href="{{ url_for('dashboard.dashboard') }}">Dashboard</a></li>
|
||||
<li class="breadcrumb-item active">Global Search</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.container-fluid -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.content-header -->
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Global Search</h3>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="" method="get">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" placeholder="Your keyword...">
|
||||
<div class="input-group-btn">
|
||||
<button type="submit" class="btn btn-success"><i class="fa fa-search"></i></button>
|
||||
</div>
|
||||
<section class="content">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<form action="" method="get">
|
||||
<div class="card card-outline card-primary shadow">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Global Search</h3>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body">
|
||||
<div class="callout callout-info">
|
||||
<p>This tool can be used to search for domains, records, and comments via the PDNS
|
||||
API.</p>
|
||||
</div>
|
||||
<!-- /.callout -->
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
<input type="text" name="q" class="form-control" value="{{ query }}"
|
||||
placeholder="Enter search query...">
|
||||
<button type="submit" class="btn btn-flat btn-success" title="Execute Query">
|
||||
<i class="fa fa-search"></i>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.form-group -->
|
||||
<div class="callout callout-warning">
|
||||
<p>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.</p>
|
||||
</div>
|
||||
<!-- /.callout -->
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
<div>
|
||||
<p><b>Hints:</b> 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.
|
||||
</p>
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Domains ({{ domains|length }})</h3>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-outline card-secondary shadow">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Zones ({{ domains|length }})</h3>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body table-responsive">
|
||||
<table id="tbl_domain" class="table table-bordered table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Zone Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for domain in domains %}
|
||||
<tr class="odd gradeX">
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=domain['name']) }}">{{ domain['name'] }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tbl_domain" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Domain</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for domain in domains %}
|
||||
<tr class="odd gradeX">
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=domain['name']) }}">{{ domain['name'] }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Records ({{ records|length }})</h3>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-outline card-secondary shadow">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Zone Records ({{ records|length }})</h3>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body table-responsive">
|
||||
<table id="tbl_record" class="table table-bordered table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>TTL</th>
|
||||
<th>Data</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in records %}
|
||||
<tr class="odd gradeX">
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=record['zone_id']) }}">{{ record['name'] }}</a>
|
||||
</td>
|
||||
<td>{{ record['type'] }}</td>
|
||||
<td>{{ 'Disabled' if record['disabled'] else 'Active' }}</td>
|
||||
<td>{{ record['ttl'] }}</td>
|
||||
<td>{{ record['content'] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tbl_record" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Type</th>
|
||||
<th>Status</th>
|
||||
<th>TTL</th>
|
||||
<th>Data</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for record in records %}
|
||||
<tr class="odd gradeX">
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=record['zone_id']) }}">{{ record['name'] }}</a>
|
||||
</td>
|
||||
<td>{{ record['type'] }}</td>
|
||||
<td>{{ 'Disabled' if record['disabled'] else 'Active' }}</td>
|
||||
<td>{{ record['ttl'] }}</td>
|
||||
<td>{{ record['content'] }}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Comments ({{ comments|length }})</h3>
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
<div class="card card-outline card-secondary shadow">
|
||||
<div class="card-header">
|
||||
<h3 class="card-title">Comments ({{ comments|length }})</h3>
|
||||
</div>
|
||||
<!-- /.card-header -->
|
||||
<div class="card-body table-responsive">
|
||||
<table id="tbl_comment" class="table table-bordered table-striped table-hover table-sm">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Comment</th>
|
||||
<th>Record</th>
|
||||
<th>Zone</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comment in comments %}
|
||||
<tr class="odd gradeX">
|
||||
<td>{{ comment['content'] }}</td>
|
||||
<td>{{ comment['name'] }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=comment['zone_id']) }}">{{ comment['zone_id'] }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /.card-body -->
|
||||
</div>
|
||||
<!-- /.card -->
|
||||
</div>
|
||||
<!-- /.col -->
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<table id="tbl_comment" class="table table-bordered table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Comment</th>
|
||||
<th>Record</th>
|
||||
<th>Domain</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for comment in comments %}
|
||||
<tr class="odd gradeX">
|
||||
<td>{{ comment['content'] }}</td>
|
||||
<td>{{ comment['name'] }}</td>
|
||||
<td>
|
||||
<a href="{{ url_for('domain.domain', domain_name=comment['zone_id']) }}">{{ comment['zone_id'] }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<!-- /.row -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
<!-- /.container-fluid -->
|
||||
</section>
|
||||
{% endblock %}
|
||||
|
||||
{% block head_styles %}
|
||||
<style>
|
||||
table#tbl_record { table-layout: fixed; }
|
||||
table#tbl_record thead th:nth-child(0n+1) { width: 20%;}
|
||||
table#tbl_record thead th:nth-child(0n+2),
|
||||
table#tbl_record thead th:nth-child(0n+3),
|
||||
table#tbl_record thead th:nth-child(0n+4) { width: 5%; }
|
||||
table#tbl_record thead th:nth-child(0n+2),
|
||||
table#tbl_record thead th:nth-child(0n+3),
|
||||
table#tbl_record thead th:nth-child(0n+4),
|
||||
table#tbl_record tbody td:nth-child(0n+2),
|
||||
table#tbl_record tbody td:nth-child(0n+3),
|
||||
table#tbl_record tbody td:nth-child(0n+4) { text-align: center; }
|
||||
table#tbl_record tbody td:first-of-type,
|
||||
table#tbl_record tbody td:last-of-type { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
|
||||
@media only screen and (max-device-width: 480px) {
|
||||
table#tbl_record thead th:nth-child(0n+1) { width: 10%;}
|
||||
table#tbl_record thead th:nth-child(0n+2),
|
||||
table#tbl_record thead th:nth-child(0n+3),
|
||||
table#tbl_record thead th:nth-child(0n+4) { width: 15%; }
|
||||
}
|
||||
@media only screen and (max-device-width: 992px) {
|
||||
table#tbl_record { table-layout: auto; }
|
||||
}
|
||||
@media only screen and (min-device-width: 481px) and (max-device-width: 992px) {
|
||||
table#tbl_record thead th:nth-child(0n+2),
|
||||
table#tbl_record thead th:nth-child(0n+3),
|
||||
table#tbl_record thead th:nth-child(0n+4) { width: 10%; }
|
||||
}
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
{% block extrascripts %}
|
||||
<script>
|
||||
// set up domain result data table
|
||||
$("#tbl_domain").DataTable({
|
||||
"paging": false,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
<script>
|
||||
// Initialize DataTables for zones
|
||||
$("#tbl_domain").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
|
||||
// set up domain result data table
|
||||
$("#tbl_record").DataTable({
|
||||
"paging": false,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
// Initialize DataTables for zone records
|
||||
$("#tbl_record").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
|
||||
// set up domain result data table
|
||||
$("#tbl_comment").DataTable({
|
||||
"paging": false,
|
||||
"lengthChange": false,
|
||||
"searching": false,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
</script>
|
||||
// Initialize DataTables for comments
|
||||
$("#tbl_comment").DataTable({
|
||||
"paging": true,
|
||||
"lengthChange": true,
|
||||
"searching": true,
|
||||
"ordering": true,
|
||||
"info": false,
|
||||
"autoWidth": false,
|
||||
"order": [
|
||||
[0, "asc"]
|
||||
]
|
||||
});
|
||||
</script>
|
||||
{% endblock %}
|
||||
|
Loading…
Reference in New Issue
Block a user