mirror of
https://github.com/cwinfo/powerdns-admin.git
synced 2024-11-09 23:20:27 +00:00
Started first-round of updates on the activity feature AKA history, but it's a very broken implementation that will require a complete re-build. Saving that for later.
This commit is contained in:
parent
761909f0f8
commit
c4d9bf3a9c
@ -1,22 +1,13 @@
|
|||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
|
|
||||||
{% set active_page = "admin_history" %}
|
{% set active_page = "admin_history" %}
|
||||||
|
{% block title %}<title>Activity - {{ SITE_NAME }}</title>{% endblock %}
|
||||||
{% block title %}
|
|
||||||
<title>
|
|
||||||
History - {{ SITE_NAME }}
|
|
||||||
</title>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block dashboard_stat %}
|
{% block dashboard_stat %}
|
||||||
<div class="content-header">
|
<div class="content-header">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row mb-2">
|
<div class="row mb-2">
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<h1 class="m-0 text-dark">
|
<h1 class="m-0 text-dark">Activity</h1>
|
||||||
History
|
|
||||||
<small>Recent Events</small>
|
|
||||||
</h1>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<ol class="breadcrumb float-sm-right">
|
<ol class="breadcrumb float-sm-right">
|
||||||
@ -30,19 +21,22 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% import 'applied_change_macro.html' as applied_change_macro %}
|
{% import 'applied_change_macro.html' as applied_change_macro %}
|
||||||
<section class="content">
|
<section class="content">
|
||||||
<div class="container-fluid">
|
<div class="container-fluid">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12">
|
<div class="col-12">
|
||||||
<div class="card card-outline card-secondary">
|
<div class="card card-outline card-secondary">
|
||||||
<div class="card-header with-border">
|
<div class="card-header with-border">
|
||||||
<h3 class="card-title">History Management</h3>
|
<h3 class="card-title">Activity Search</h3>
|
||||||
{% if current_user.role.name != 'User' %}
|
{% if current_user.role.name == 'Administrator' %}
|
||||||
<button type="button" class="btn btn-danger float-right" data-toggle="modal" data-target="#modal_clear_history" {% if current_user.role.name != 'Administrator' %}disabled{% endif %}>
|
<div class="card-tools">
|
||||||
|
<button type="button" class="btn btn-danger" data-toggle="modal"
|
||||||
|
data-target="#modal_clear_history" title="Clear Activity">
|
||||||
<i class="fa-solid fa-trash"></i>
|
<i class="fa-solid fa-trash"></i>
|
||||||
Clear History
|
Clear Activity
|
||||||
</button>
|
</button>
|
||||||
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body clearfix">
|
<div class="card-body clearfix">
|
||||||
@ -59,7 +53,8 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link with-border" href="#tabs-account" data-toggle="pill" role="tab">
|
<a class="nav-link with-border" href="#tabs-account" data-toggle="pill"
|
||||||
|
role="tab">
|
||||||
Search By Account
|
Search By Account
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
@ -80,32 +75,40 @@
|
|||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div class="autocomplete" style="width:250px;">
|
<div class="autocomplete" style="width:250px;">
|
||||||
<input type="text" class="form-control" id="domain_name_filter" name="domain_name_filter" placeholder="Enter * to search for any domain" value="">
|
<input type="text" class="form-control" id="domain_name_filter"
|
||||||
|
name="domain_name_filter"
|
||||||
|
placeholder="Enter * to search for any domain" value="">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<div style="position: relative; top:10px;">
|
<div style="position: relative; top:10px;">
|
||||||
<td>Record Changelog only  </td>
|
<td>Record Changelog only  </td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" id="domain_changelog_only_checkbox" name="domain_changelog_only_checkbox"
|
<input type="checkbox" id="domain_changelog_only_checkbox"
|
||||||
class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;">
|
name="domain_changelog_only_checkbox"
|
||||||
</td>
|
class="checkbox"
|
||||||
</div>
|
style="border:2px dotted #00f;display:block;background:#ff0000;">
|
||||||
</td>
|
</td>
|
||||||
</div>
|
</div>
|
||||||
<div class="tab-pane" id="tabs-account">
|
</td>
|
||||||
<td><label>Account Name</label></td>
|
</div>
|
||||||
<td>
|
<div class="tab-pane" id="tabs-account">
|
||||||
<div class="autocomplete" style="width:250px;">
|
<td><label>Account Name</label></td>
|
||||||
<input type="text" class="form-control" id="account_name_filter" name="account_name_filter" placeholder="Enter * to search for any account" value="">
|
|
||||||
</div>
|
|
||||||
</td>
|
|
||||||
</div>
|
|
||||||
<div class="tab-pane" id="tabs-auth">
|
|
||||||
<td><label>Username</label></td>
|
|
||||||
<td>
|
<td>
|
||||||
<div class="autocomplete" style="width:250px;">
|
<div class="autocomplete" style="width:250px;">
|
||||||
<input type="text" class="form-control" id="auth_name_filter" name="auth_name_filter" placeholder="Enter * to search for any username" value="">
|
<input type="text" class="form-control" id="account_name_filter"
|
||||||
|
name="account_name_filter"
|
||||||
|
placeholder="Enter * to search for any account" value="">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</div>
|
||||||
|
<div class="tab-pane" id="tabs-auth">
|
||||||
|
<td><label>Username</label></td>
|
||||||
|
<td>
|
||||||
|
<div class="autocomplete" style="width:250px;">
|
||||||
|
<input type="text" class="form-control" id="auth_name_filter"
|
||||||
|
name="auth_name_filter"
|
||||||
|
placeholder="Enter * to search for any username" value="">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
|
|
||||||
@ -115,22 +118,29 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
<td>  All</td>
|
<td>  All</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" checked id="auth_all_checkbox" name="auth_all_checkbox"
|
<input type="checkbox" checked id="auth_all_checkbox" name="auth_all_checkbox"
|
||||||
class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;">
|
class="checkbox"
|
||||||
|
style="border:2px dotted #00f;display:block;background:#ff0000;">
|
||||||
</td>
|
</td>
|
||||||
<td>  LOCAL</td>
|
<td>  LOCAL</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" checked id="auth_local_only_checkbox" name="auth_local_only_checkbox"
|
<input type="checkbox" checked id="auth_local_only_checkbox"
|
||||||
class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;">
|
name="auth_local_only_checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
style="border:2px dotted #00f;display:block;background:#ff0000;">
|
||||||
</td>
|
</td>
|
||||||
<td>  OAuth</td>
|
<td>  OAuth</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" checked id="auth_oauth_only_checkbox" name="auth_oauth_only_checkbox"
|
<input type="checkbox" checked id="auth_oauth_only_checkbox"
|
||||||
class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;">
|
name="auth_oauth_only_checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
style="border:2px dotted #00f;display:block;background:#ff0000;">
|
||||||
</td>
|
</td>
|
||||||
<td>  SAML</td>
|
<td>  SAML</td>
|
||||||
<td>
|
<td>
|
||||||
<input type="checkbox" checked id="auth_saml_only_checkbox" name="auth_saml_only_checkbox"
|
<input type="checkbox" checked id="auth_saml_only_checkbox"
|
||||||
class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;">
|
name="auth_saml_only_checkbox"
|
||||||
|
class="checkbox"
|
||||||
|
style="border:2px dotted #00f;display:block;background:#ff0000;">
|
||||||
</td>
|
</td>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -146,7 +156,8 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
<td><label>Changed by:  </label></td>
|
<td><label>Changed by:  </label></td>
|
||||||
<td>
|
<td>
|
||||||
<div class="autocomplete" style="width:250px;">
|
<div class="autocomplete" style="width:250px;">
|
||||||
<input type="text" style=" border:1px solid #d2d6de; width:250px; height: 34px;" id="user_name_filter" name="user_name_filter" value="">
|
<input type="text" style=" border:1px solid #d2d6de; width:250px; height: 34px;"
|
||||||
|
id="user_name_filter" name="user_name_filter" value="">
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -155,7 +166,8 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
<label>Minimum date:  </label>
|
<label>Minimum date:  </label>
|
||||||
</td>
|
</td>
|
||||||
<td style="position: relative; top:10px;">
|
<td style="position: relative; top:10px;">
|
||||||
<input type="text" id="min" name="min" class="datepicker" autocomplete="off" style=" border:1px solid #d2d6de; width:250px; height: 34px;">
|
<input type="text" id="min" name="min" class="datepicker" autocomplete="off"
|
||||||
|
style=" border:1px solid #d2d6de; width:250px; height: 34px;">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -163,17 +175,27 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
<label>Maximum date:  </label>
|
<label>Maximum date:  </label>
|
||||||
</td>
|
</td>
|
||||||
<td style="position: relative; top:20px;">
|
<td style="position: relative; top:20px;">
|
||||||
<input type="text" id="max" name="max" class="datepicker" autocomplete="off" style=" border:1px solid #d2d6de; width:250px; height: 34px;">
|
<input type="text" id="max" name="max" class="datepicker" autocomplete="off"
|
||||||
|
style=" border:1px solid #d2d6de; width:250px; height: 34px;">
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr><td> </td></tr>
|
<tr>
|
||||||
<tr><td> </td></tr>
|
<td> </td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td> </td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<button type="submit" id="search-submit" name="search-submit" class="btn btn-primary button-filter"><i class="fa fa-search"></i> Search</button>
|
<button type="submit" id="search-submit" name="search-submit"
|
||||||
|
class="btn btn-primary button-filter"><i class="fa fa-search"></i> Search
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<button id="clear-filters" name="clear-filters" class="btn btn-warning button-clearf"><i class="fa fa-trash"></i> Clear Filters</button>
|
<button id="clear-filters" name="clear-filters"
|
||||||
|
class="btn btn-warning button-clearf"><i class="fa fa-trash"></i> Clear
|
||||||
|
Filters
|
||||||
|
</button>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
@ -182,23 +204,24 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
</div>
|
</div>
|
||||||
<div id="table_from_ajax"></div>
|
<div id="table_from_ajax"></div>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block extrascripts %}
|
{% block extrascripts %}
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
/* Don't let user search with a blank main field */
|
/* Don't let user search with a blank main field */
|
||||||
var canSearch=true;
|
var canSearch = true;
|
||||||
|
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/admin/history_table",
|
url: "/admin/history_table",
|
||||||
type: "get",
|
type: "get",
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
console.log('Submission was successful.');
|
console.log('Submission was successful.');
|
||||||
$("#table_from_ajax").html(response);
|
$("#table_from_ajax").html(response);
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function (xhr) {
|
||||||
console.log("Sending data: ", data, " failed")
|
console.log("Sending data: ", data, " failed")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -209,26 +232,26 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
|
|
||||||
// Show/hide filters
|
// Show/hide filters
|
||||||
$('#domain_name_filter, #account_name_filter, #auth_name_filter').on('keyup change', function (e) {
|
$('#domain_name_filter, #account_name_filter, #auth_name_filter').on('keyup change', function (e) {
|
||||||
if ( $('#domain_name_filter').val() == "" && $('#account_name_filter').val() == "" && $('#auth_name_filter').val() == "")
|
if ($('#domain_name_filter').val() == "" && $('#account_name_filter').val() == "" && $('#auth_name_filter').val() == "")
|
||||||
canSearch=false;
|
canSearch = false;
|
||||||
else
|
else
|
||||||
canSearch=true;
|
canSearch = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle giving later mindate than current max
|
// Handle giving later mindate than current max
|
||||||
$('#min').on('change', function () {
|
$('#min').on('change', function () {
|
||||||
if (minDate.val() > maxDate.val())
|
if (minDate.val() > maxDate.val())
|
||||||
$('#max').datepicker('setDate', minDate.val() );
|
$('#max').datepicker('setDate', minDate.val());
|
||||||
});
|
});
|
||||||
|
|
||||||
// Handle giving earlier maxdate than current min
|
// Handle giving earlier maxdate than current min
|
||||||
$('#max').on('keyup change', function () {
|
$('#max').on('keyup change', function () {
|
||||||
if (maxDate.val() < minDate.val())
|
if (maxDate.val() < minDate.val())
|
||||||
$('#min').datepicker('setDate', maxDate.val() );
|
$('#min').datepicker('setDate', maxDate.val());
|
||||||
});
|
});
|
||||||
|
|
||||||
$(function() {
|
$(function () {
|
||||||
$( ".datepicker" ).datepicker({
|
$(".datepicker").datepicker({
|
||||||
changeMonth: true,
|
changeMonth: true,
|
||||||
changeYear: true,
|
changeYear: true,
|
||||||
format: "yyyy-mm-dd",
|
format: "yyyy-mm-dd",
|
||||||
@ -246,16 +269,15 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Handle "ALL" Checkbox
|
//Handle "ALL" Checkbox
|
||||||
$('#auth_all_checkbox').on('ifChecked',function() {
|
$('#auth_all_checkbox').on('ifChecked', function () {
|
||||||
$('#auth_local_only_checkbox').iCheck('check');
|
$('#auth_local_only_checkbox').iCheck('check');
|
||||||
$('#auth_oauth_only_checkbox').iCheck('check');
|
$('#auth_oauth_only_checkbox').iCheck('check');
|
||||||
$('#auth_saml_only_checkbox').iCheck('check');
|
$('#auth_saml_only_checkbox').iCheck('check');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#auth_all_checkbox').on('ifUnchecked',function() {
|
$('#auth_all_checkbox').on('ifUnchecked', function () {
|
||||||
//check if all were checked
|
//check if all were checked
|
||||||
if($('#auth_local_only_checkbox').is(':checked') && $('#auth_oauth_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked'))
|
if ($('#auth_local_only_checkbox').is(':checked') && $('#auth_oauth_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked')) {
|
||||||
{
|
|
||||||
$('#auth_local_only_checkbox').iCheck('uncheck');
|
$('#auth_local_only_checkbox').iCheck('uncheck');
|
||||||
$('#auth_oauth_only_checkbox').iCheck('uncheck');
|
$('#auth_oauth_only_checkbox').iCheck('uncheck');
|
||||||
$('#auth_saml_only_checkbox').iCheck('uncheck');
|
$('#auth_saml_only_checkbox').iCheck('uncheck');
|
||||||
@ -263,28 +285,28 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
});
|
});
|
||||||
|
|
||||||
//Handle other auth checkboxes
|
//Handle other auth checkboxes
|
||||||
$('#auth_local_only_checkbox').on('ifChecked',function() {
|
$('#auth_local_only_checkbox').on('ifChecked', function () {
|
||||||
//check if all others were checked
|
//check if all others were checked
|
||||||
if($('#auth_oauth_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked'))
|
if ($('#auth_oauth_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked'))
|
||||||
$('#auth_all_checkbox').iCheck('check');
|
$('#auth_all_checkbox').iCheck('check');
|
||||||
});
|
});
|
||||||
$('#auth_local_only_checkbox').on('ifUnchecked',function() {
|
$('#auth_local_only_checkbox').on('ifUnchecked', function () {
|
||||||
$('#auth_all_checkbox').iCheck('uncheck');
|
$('#auth_all_checkbox').iCheck('uncheck');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#auth_oauth_only_checkbox').on('ifChecked',function() {
|
$('#auth_oauth_only_checkbox').on('ifChecked', function () {
|
||||||
if($('#auth_local_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked'))
|
if ($('#auth_local_only_checkbox').is(':checked') && $('#auth_saml_only_checkbox').is(':checked'))
|
||||||
$('#auth_all_checkbox').iCheck('check');
|
$('#auth_all_checkbox').iCheck('check');
|
||||||
});
|
});
|
||||||
$('#auth_oauth_only_checkbox').on('ifUnchecked',function() {
|
$('#auth_oauth_only_checkbox').on('ifUnchecked', function () {
|
||||||
$('#auth_all_checkbox').iCheck('uncheck');
|
$('#auth_all_checkbox').iCheck('uncheck');
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#auth_saml_only_checkbox').on('ifChecked',function() {
|
$('#auth_saml_only_checkbox').on('ifChecked', function () {
|
||||||
if($('#auth_local_only_checkbox').is(':checked') && $('#auth_oauth_only_checkbox').is(':checked'))
|
if ($('#auth_local_only_checkbox').is(':checked') && $('#auth_oauth_only_checkbox').is(':checked'))
|
||||||
$('#auth_all_checkbox').iCheck('check');
|
$('#auth_all_checkbox').iCheck('check');
|
||||||
});
|
});
|
||||||
$('#auth_saml_only_checkbox').on('ifUnchecked',function() {
|
$('#auth_saml_only_checkbox').on('ifUnchecked', function () {
|
||||||
$('#auth_all_checkbox').iCheck('uncheck');
|
$('#auth_all_checkbox').iCheck('uncheck');
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -313,11 +335,13 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
the text field element and an array of possible autocompleted values:*/
|
the text field element and an array of possible autocompleted values:*/
|
||||||
var currentFocus;
|
var currentFocus;
|
||||||
/*execute a function when someone writes in the text field:*/
|
/*execute a function when someone writes in the text field:*/
|
||||||
inp.addEventListener("input", function(e) {
|
inp.addEventListener("input", function (e) {
|
||||||
var a, b, i, val = this.value;
|
var a, b, i, val = this.value;
|
||||||
/*close any already open lists of autocompleted values*/
|
/*close any already open lists of autocompleted values*/
|
||||||
closeAllLists();
|
closeAllLists();
|
||||||
if (!val) { return false;}
|
if (!val) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
currentFocus = -1;
|
currentFocus = -1;
|
||||||
/*create a DIV element that will contain the items (values):*/
|
/*create a DIV element that will contain the items (values):*/
|
||||||
a = document.createElement("DIV");
|
a = document.createElement("DIV");
|
||||||
@ -337,7 +361,7 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
/*insert a input field that will hold the current array item's value:*/
|
/*insert a input field that will hold the current array item's value:*/
|
||||||
b.innerHTML += "<input type='hidden' value='" + arr[i] + "'>";
|
b.innerHTML += "<input type='hidden' value='" + arr[i] + "'>";
|
||||||
/*execute a function when someone clicks on the item value (DIV element):*/
|
/*execute a function when someone clicks on the item value (DIV element):*/
|
||||||
b.addEventListener("click", function(e) {
|
b.addEventListener("click", function (e) {
|
||||||
/*insert the value for the autocomplete text field:*/
|
/*insert the value for the autocomplete text field:*/
|
||||||
inp.value = this.getElementsByTagName("input")[0].value;
|
inp.value = this.getElementsByTagName("input")[0].value;
|
||||||
/*close the list of autocompleted values,
|
/*close the list of autocompleted values,
|
||||||
@ -349,7 +373,7 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
/*execute a function presses a key on the keyboard:*/
|
/*execute a function presses a key on the keyboard:*/
|
||||||
inp.addEventListener("keydown", function(e) {
|
inp.addEventListener("keydown", function (e) {
|
||||||
var x = document.getElementById(this.id + "autocomplete-list");
|
var x = document.getElementById(this.id + "autocomplete-list");
|
||||||
if (x) x = x.getElementsByTagName("div");
|
if (x) x = x.getElementsByTagName("div");
|
||||||
if (e.keyCode == 40) {
|
if (e.keyCode == 40) {
|
||||||
@ -373,6 +397,7 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function addActive(x) {
|
function addActive(x) {
|
||||||
/*a function to classify an item as "active":*/
|
/*a function to classify an item as "active":*/
|
||||||
if (!x) return false;
|
if (!x) return false;
|
||||||
@ -383,12 +408,14 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
/*add class "autocomplete-active":*/
|
/*add class "autocomplete-active":*/
|
||||||
x[currentFocus].classList.add("autocomplete-active");
|
x[currentFocus].classList.add("autocomplete-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeActive(x) {
|
function removeActive(x) {
|
||||||
/*a function to remove the "active" class from all autocomplete items:*/
|
/*a function to remove the "active" class from all autocomplete items:*/
|
||||||
for (var i = 0; i < x.length; i++) {
|
for (var i = 0; i < x.length; i++) {
|
||||||
x[i].classList.remove("autocomplete-active");
|
x[i].classList.remove("autocomplete-active");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeAllLists(elmnt) {
|
function closeAllLists(elmnt) {
|
||||||
/*close all autocomplete lists in the document,
|
/*close all autocomplete lists in the document,
|
||||||
except the one passed as an argument:*/
|
except the one passed as an argument:*/
|
||||||
@ -399,6 +426,7 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*execute a function when someone clicks in the document:*/
|
/*execute a function when someone clicks in the document:*/
|
||||||
document.addEventListener("click", function (e) {
|
document.addEventListener("click", function (e) {
|
||||||
closeAllLists(e.target);
|
closeAllLists(e.target);
|
||||||
@ -413,77 +441,75 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
|
|
||||||
|
|
||||||
// prevent multiple filter field at the same time
|
// prevent multiple filter field at the same time
|
||||||
$('#domain_tab').click(function() {
|
$('#domain_tab').click(function () {
|
||||||
$('#account_name_filter').val('');
|
$('#account_name_filter').val('');
|
||||||
$('#auth_name_filter').val('');
|
$('#auth_name_filter').val('');
|
||||||
$('#user_name_filter').removeAttr('disabled');
|
$('#user_name_filter').removeAttr('disabled');
|
||||||
canSearch=false;
|
canSearch = false;
|
||||||
main_field="Domain Name"
|
main_field = "Domain Name"
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#account_tab').click(function() {
|
$('#account_tab').click(function () {
|
||||||
$('#domain_name_filter').val('');
|
$('#domain_name_filter').val('');
|
||||||
$('#auth_name_filter').val('');
|
$('#auth_name_filter').val('');
|
||||||
$('#user_name_filter').removeAttr('disabled');
|
$('#user_name_filter').removeAttr('disabled');
|
||||||
canSearch=false;
|
canSearch = false;
|
||||||
main_field="Account Name"
|
main_field = "Account Name"
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#user_auth_tab').click( function() {
|
$('#user_auth_tab').click(function () {
|
||||||
$('#domain_name_filter').val('');
|
$('#domain_name_filter').val('');
|
||||||
$('#account_name_filter').val('');
|
$('#account_name_filter').val('');
|
||||||
$('#user_name_filter').val('');
|
$('#user_name_filter').val('');
|
||||||
$('#user_name_filter').attr('disabled','disabled');
|
$('#user_name_filter').attr('disabled', 'disabled');
|
||||||
canSearch=false;
|
canSearch = false;
|
||||||
main_field="Username"
|
main_field = "Username"
|
||||||
});
|
});
|
||||||
|
|
||||||
$('#activity_tab').click( function() {
|
$('#activity_tab').click(function () {
|
||||||
$('#domain_name_filter').val('');
|
$('#domain_name_filter').val('');
|
||||||
$('#account_name_filter').val('');
|
$('#account_name_filter').val('');
|
||||||
$('#auth_name_filter').val('');
|
$('#auth_name_filter').val('');
|
||||||
$('#user_name_filter').removeAttr('disabled');
|
$('#user_name_filter').removeAttr('disabled');
|
||||||
$('#search-submit').removeAttr('disabled','disabled');
|
$('#search-submit').removeAttr('disabled', 'disabled');
|
||||||
canSearch=true;
|
canSearch = true;
|
||||||
main_field=""
|
main_field = ""
|
||||||
});
|
});
|
||||||
|
|
||||||
// if search submit is pressed, and max date not initialized
|
// if search submit is pressed, and max date not initialized
|
||||||
// then initialize it
|
// then initialize it
|
||||||
$('#search-submit').on('click', function() {
|
$('#search-submit').on('click', function () {
|
||||||
if ($('#max').val() === "" || $('#max').val() === undefined)
|
if ($('#max').val() === "" || $('#max').val() === undefined)
|
||||||
$('#max').datepicker('setDate', 'now');
|
$('#max').datepicker('setDate', 'now');
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#history-search-form").submit(function(e){ // ajax call to load results on submition
|
$("#history-search-form").submit(function (e) { // ajax call to load results on submition
|
||||||
e.preventDefault(); // prevent page reloading
|
e.preventDefault(); // prevent page reloading
|
||||||
|
|
||||||
if(!canSearch)
|
if (!canSearch) {
|
||||||
{
|
|
||||||
showErrorModal("Please fill out the " + main_field + " field.");
|
showErrorModal("Please fill out the " + main_field + " field.");
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
var form = $(this);
|
var form = $(this);
|
||||||
var tzoffset = (new Date()).getTimezoneOffset();
|
var tzoffset = (new Date()).getTimezoneOffset();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/admin/history_table",
|
url: "/admin/history_table",
|
||||||
type: "get",
|
type: "get",
|
||||||
data: form.serialize() + "&tzoffset=" + tzoffset,
|
data: form.serialize() + "&tzoffset=" + tzoffset,
|
||||||
success: function(response) {
|
success: function (response) {
|
||||||
console.log('Submission was successful.');
|
console.log('Submission was successful.');
|
||||||
$("#table_from_ajax").html(response);
|
$("#table_from_ajax").html(response);
|
||||||
|
|
||||||
},
|
},
|
||||||
error: function(xhr) {
|
error: function (xhr) {
|
||||||
console.log("Sending data: ", data, " failed")
|
console.log("Sending data: ", data, " failed")
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block modals %}
|
{% block modals %}
|
||||||
<!-- Clear History Confirmation Box -->
|
<!-- Clear History Confirmation Box -->
|
||||||
<div class="modal fade modal-warning" id="modal_clear_history">
|
<div class="modal fade modal-warning" id="modal_clear_history">
|
||||||
@ -500,7 +526,8 @@ class="checkbox" style="border:2px dotted #00f;display:block;background:#ff0000;
|
|||||||
</div>
|
</div>
|
||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
|
||||||
<button type="button" class="btn btn-danger float-right" onclick="applyChanges({'_csrf_token': '{{ csrf_token() }}'}, $SCRIPT_ROOT + '/admin/history', false, true);">
|
<button type="button" class="btn btn-danger float-right"
|
||||||
|
onclick="applyChanges({'_csrf_token': '{{ csrf_token() }}'}, $SCRIPT_ROOT + '/admin/history', false, true);">
|
||||||
Clear History
|
Clear History
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -136,7 +136,7 @@
|
|||||||
<li class="{{ 'nav-item active' if active_page == 'admin_history' else 'nav-item' }}">
|
<li class="{{ 'nav-item active' if active_page == 'admin_history' else 'nav-item' }}">
|
||||||
<a href="{{ url_for('admin.history') }}" class="nav-link">
|
<a href="{{ url_for('admin.history') }}" class="nav-link">
|
||||||
<i class="nav-icon fa-solid fa-timeline"></i>
|
<i class="nav-icon fa-solid fa-timeline"></i>
|
||||||
<p>History</p>
|
<p>Activity</p>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="{{ 'nav-item active' if active_page == 'admin_domain_template' else 'nav-item' }}">
|
<li class="{{ 'nav-item active' if active_page == 'admin_domain_template' else 'nav-item' }}">
|
||||||
|
Loading…
Reference in New Issue
Block a user