Add colors to sidebar items indicating how the status of the individual pages are (green = fully functional, orange = mostly functions, yellow = partially functional, red = missing)

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER
2023-02-23 17:27:23 +01:00
parent 5f7ceda54f
commit d53df52b49
5 changed files with 79 additions and 95 deletions
-43
View File
@@ -1,43 +0,0 @@
<?php
/*
* Pi-hole: A black hole for Internet advertisements
* (c) 2017 Pi-hole, LLC (https://pi-hole.net)
* Network-wide ad blocking via your own hardware.
*
* This file is copyright under the latest version of the EUPL.
* Please see LICENSE file for your rights under this license.
*/
require 'scripts/pi-hole/php/header_authenticated.php';
?>
<!-- Title -->
<div class="page-header">
<h1>Generate debug log</h1>
</div>
<div class="box">
<div class="box-header with-border"><h1 class="box-title">Options:</h1></div>
<div class="box-body">
<div>
<input type="checkbox" id="dbcheck">
<label for="dbcheck"><strong>Execute database integrity check.</strong>
<br class="hidden-md hidden-lg"><span class="text-red">This can add several minutes to debug log time.</span>
</label>
</div>
<div>
<input type="checkbox" id="upload">
<label for="upload"><strong>Upload debug log and provide Debug Token.</strong>
<br class="hidden-md hidden-lg"><span>The URL token will be shown at the end of the report, once finished.</span>
</label>
</div>
</div>
</div>
<br>
<p>Once you click this button a debug log will be generated and can automatically be uploaded if we detect a working internet connection.</p>
<button type="button" id="debugBtn" class="btn btn-lg btn-primary btn-block">Generate debug log</button>
<pre id="output" style="width: 100%; height: 100%;" hidden></pre>
<script src="<?php echo fileversion('scripts/pi-hole/js/debug.js'); ?>"></script>
<?php
require 'scripts/pi-hole/php/footer.php';
?>
-3
View File
@@ -195,9 +195,6 @@ function delLease(ip) {
dhcpLeaesTable.rows().deselect();
utils.changeTableButtonStates(dhcpLeaesTable);
})
.done(
utils.checkleases // Update icon warnings count
)
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while deleting lease: " + ip, jqXHR.responseText);
+46 -9
View File
@@ -185,9 +185,6 @@ function delRecord(ip) {
utils.showAlert("error", "", "Error while deleting DNS record: " + ip, response.record);
}
})
.done(
utils.checkrecords // Update icon warnings count
)
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while deleting DNS record: " + ip, jqXHR.responseText);
@@ -222,9 +219,6 @@ function delCNAMERecord(ip) {
);
}
})
.done(
utils.checkrecords // Update icon warnings count
)
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert(
@@ -237,8 +231,51 @@ function delCNAMERecord(ip) {
});
}
/*
$(document).ready(function () {
processDNSRecordsConfig();
$("#btnAdd-host").on("click", function () {
const elem = $("#Hip").val() + " " + $("#Hdomain").val();
const path = "/api/config/dns/hosts/" + elem;
$.ajax({
url: path,
method: "PUT",
})
.done(function (response) {
utils.enableAll();
if (response === undefined) {
utils.showAlert("success", "far fa-trash-alt", "Successfully added DNS record", "");
dnsRecordsTable.ajax.reload(null, false);
} else {
utils.showAlert("error", "", "Error while adding DNS record", response.record);
}
})
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while deleting DNS record", jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console
});
});
$("#btnAdd-cname").on("click", function () {
var elem = $("#Cdomain").val() + "," + $("#Ctarget").val();
var ttlVal = parseInt($("#Cttl").val(), 10);
if (isFinite(ttlVal) && ttlVal >= 0) elem += "," + ttlVal;
const path = "/api/config/dns/cnameRecords/" + elem;
$.ajax({
url: path,
method: "PUT",
})
.done(function (response) {
utils.enableAll();
if (response === undefined) {
utils.showAlert("success", "far fa-trash-alt", "Successfully added CNAME record", "");
dnsRecordsTable.ajax.reload(null, false);
} else {
utils.showAlert("error", "", "Error while adding CNAME record", response.record);
}
})
.fail(function (jqXHR, exception) {
utils.enableAll();
utils.showAlert("error", "", "Error while deleting CNAME record", jqXHR.responseText);
console.log(exception); // eslint-disable-line no-console
});
});
});
*/
+21 -27
View File
@@ -21,13 +21,13 @@
<!-- Home Page -->
<li class="menu-main<?php if ($scriptname === 'index.php') { ?> active<?php } ?>">
<a href="index.php">
<i class="fa fa-fw menu-icon fa-home"></i> <span>Dashboard</span>
<i class="fa fa-fw menu-icon fa-home"></i> <span class="text-green">Dashboard</span>
</a>
</li>
<!-- Query Log -->
<li class="menu-analysis<?php if ($scriptname === 'queries.php') { ?> active<?php } ?>">
<a href="queries.php">
<i class="fa fa-fw menu-icon fa-file-alt"></i> <span>Query Log</span>
<i class="fa fa-fw menu-icon fa-file-alt"></i> <span class="text-green">Query Log</span>
</a>
</li>
@@ -35,7 +35,7 @@
<!-- Group Management -->
<li class="menu-group<?php if ($scriptname === 'groups.php') { ?> active<?php } ?>">
<a href="groups.php">
<i class="fa fa-fw menu-icon fa-user-friends"></i> <span>Groups
<i class="fa fa-fw menu-icon fa-user-friends"></i> <span class="text-red">Groups
<span class="pull-right-container">
<span class="label label-primary pull-right" id="num_groups" title="Number of defined groups"></span>
</span>
@@ -43,7 +43,7 @@
</li>
<li class="menu-group<?php if ($scriptname === 'groups-clients.php') { ?> active<?php } ?>">
<a href="groups-clients.php">
<i class="fa fa-fw menu-icon fa-laptop"></i> <span>Clients
<i class="fa fa-fw menu-icon fa-laptop"></i> <span class="text-red">Clients
<span class="pull-right-container">
<span class="label label-primary pull-right" id="num_clients" title="Number of defined clients"></span>
</span>
@@ -51,7 +51,7 @@
</li>
<li class="menu-group<?php if ($scriptname === 'groups-domains.php') { ?> active<?php } ?>">
<a href="groups-domains.php">
<i class="fa fa-fw menu-icon fa-list"></i> <span>Domains
<i class="fa fa-fw menu-icon fa-list"></i> <span class="text-red">Domains
<span class="pull-right-container">
<span class="label bg-red pull-right" id="num_denied" title="Number of deny rules (domains and regex)"></span>
<span class="label bg-green pull-right" id="num_allowed" title="Number of allow rules (domains and regex)"></span>
@@ -60,7 +60,7 @@
</li>
<li class="menu-group<?php if ($scriptname === 'groups-adlists.php') { ?> active<?php } ?>">
<a href="groups-adlists.php">
<i class="fa fa-fw menu-icon fa-shield-alt"></i> <span>Adlists
<i class="fa fa-fw menu-icon fa-shield-alt"></i> <span class="text-red">Adlists
<span class="pull-right-container">
<span class="label bg-blue pull-right" id="num_lists" title="Number of defined adlists"></span>
<span class="label bg-yellow pull-right" id="num_gravity" title="Total number of domains blocked by your Pi-hole"></span>
@@ -73,7 +73,7 @@
<!-- Enable/Disable Blocking -->
<li id="pihole-disable" class="menu-dns treeview">
<a href="#">
<i class="fa fa-fw menu-icon fa-stop"></i> <span>Disable Blocking&nbsp;&nbsp;&nbsp;<span id="flip-status-disable"></span></span>
<i class="fa fa-fw menu-icon fa-stop"></i> <span class="text-red">Disable Blocking&nbsp;&nbsp;&nbsp;<span id="flip-status-disable"></span></span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
@@ -110,7 +110,7 @@
<li id="pihole-enable" class="menu-dns treeview"<?php if (!in_array($pistatus, array('0', '-1', '-2'))) { ?> hidden<?php } ?>>
<a href="#">
<i class="fa fa-fw menu-icon fa-play"></i>
<span id="enableLabel">Enable Blocking&nbsp;&nbsp;&nbsp;
<span id="enableLabel" class="text-red">Enable Blocking&nbsp;&nbsp;&nbsp;
<span id="flip-status-enable"></span>
</span>
</a>
@@ -127,42 +127,42 @@
<ul class="treeview-menu">
<li class="<?php if ($scriptname === 'settings-system.php') { ?> active<?php } ?>">
<a href="settings-system.php">
<i class="fa-fw menu-icon fa-solid fa-circle-info"></i> System
<i class="fa-fw menu-icon fa-solid fa-circle-info"></i> <span class="text-green">System</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-dns.php') { ?> active<?php } ?>">
<a href="settings-dns.php">
<i class="fa-fw menu-icon fa-solid fa-book-atlas"></i> DNS
<i class="fa-fw menu-icon fa-solid fa-book-atlas"></i> <span class="text-orange">DNS</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-dhcp.php') { ?> active<?php } ?>">
<a href="settings-dhcp.php">
<i class="fa-fw menu-icon fa-solid fa-sitemap"></i> DHCP
<i class="fa-fw menu-icon fa-solid fa-sitemap"></i> <span class="text-orange">DHCP</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-api.php') { ?> active<?php } ?>">
<a href="settings-api.php">
<i class="fa-fw menu-icon fa-solid fa-window-restore"></i> Web interface / API
<i class="fa-fw menu-icon fa-solid fa-window-restore"></i> <span class="text-orange">Web interface / API</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-privacy.php') { ?> active<?php } ?>">
<a href="settings-privacy.php">
<i class="fa-fw menu-icon fa-solid fa-binoculars"></i> Privacy
<i class="fa-fw menu-icon fa-solid fa-binoculars"></i> <span class="text-orange">Privacy</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-advanced.php') { ?> active<?php } ?> settings-level-2">
<a href="settings-advanced.php">
<i class="fa-fw menu-icon fa-solid fa-pen-to-square"></i> Advanced
<i class="fa-fw menu-icon fa-solid fa-pen-to-square"></i> <span class="text-orange">Advanced</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-teleporter.php') { ?> active<?php } ?>">
<a href="settings-teleporter.php">
<i class="fa-fw menu-icon fa-solid fa-file-export"></i> Teleporter
<i class="fa-fw menu-icon fa-solid fa-file-export"></i> <span class="text-red">Teleporter</span>
</a>
</li>
<li class="<?php if ($scriptname === 'settings-dns-records.php') { ?> active<?php } ?>">
<a href="settings-dns-records.php">
<i class="fa-fw menu-icon fa-solid fa-address-book"></i> Local DNS Records
<i class="fa-fw menu-icon fa-solid fa-address-book"></i> <span class="text-orange">Local DNS Records</span>
</a>
</li>
</ul>
@@ -180,14 +180,14 @@
<!-- Pi-hole diagnosis -->
<li class="<?php if ($scriptname === 'messages.php') { ?> active<?php } ?>">
<a href="messages.php">
<i class="fa fa-fw menu-icon fa-file-medical-alt"></i> Pi-hole diagnosis
<i class="fa fa-fw menu-icon fa-file-medical-alt"></i> <span class="text-green">Pi-hole diagnosis</span>
<span class="pull-right-container warning-count hidden"></span>
</a>
</li>
<!-- Tail log files -->
<li class="treeview <?php if ($scriptname === 'taillog.php') { ?> active<?php } ?>">
<a href="#">
<i class="fa-fw menu-icon fa-solid fa-list-ul"></i> Tail log files
<i class="fa-fw menu-icon fa-solid fa-list-ul"></i> <span class="text-green">Tail log files</span>
<span class="pull-right-container">
<i class="fa fa-angle-left pull-right"></i>
</span>
@@ -222,25 +222,19 @@
<!-- Run gravity.sh -->
<li class="<?php if ($scriptname === 'gravity.php') { ?> active<?php } ?>">
<a href="gravity.php">
<i class="fa fa-fw menu-icon fa-arrow-circle-down"></i> Update Gravity
<i class="fa fa-fw menu-icon fa-arrow-circle-down"></i> <span class="text-red">Update Gravity</span>
</a>
</li>
<!-- Query Lists -->
<li class="<?php if ($scriptname === 'queryads.php') { ?> active<?php } ?>">
<a href="queryads.php">
<i class="fa fa-fw menu-icon fa-search"></i> Search Adlists
</a>
</li>
<!-- Generate debug log -->
<li class="<?php if ($scriptname === 'debug.php') { ?> active<?php } ?>">
<a href="debug.php">
<i class="fa fa-fw menu-icon fa-ambulance"></i> Generate debug log
<i class="fa fa-fw menu-icon fa-search"></i> <span class="text-red">Search Adlists</span>
</a>
</li>
<!-- Network -->
<li class="<?php if ($scriptname === 'network.php') { ?> active<?php } ?>">
<a href="network.php">
<i class="fa fa-fw menu-icon fa-network-wired"></i> Network
<i class="fa fa-fw menu-icon fa-network-wired"></i> <span class="text-red">Network</span>
</a>
</li>
</ul>
+12 -13
View File
@@ -34,11 +34,11 @@ require 'scripts/pi-hole/php/header_authenticated.php';
<div class="row">
<div class="form-group col-md-6">
<label for="domain">Domain:</label>
<input id="domain" type="url" class="form-control" placeholder="Add a domain (example.com or sub.example.com)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
<input id="Hdomain" type="url" class="form-control" placeholder="Add a domain (example.com or sub.example.com)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="form-group col-md-6">
<label for="target">IP address:</label>
<input id="ip" type="text" class="form-control" placeholder="Associated IP address" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
<input id="Hip" type="text" class="form-control" placeholder="Associated IP address" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
</div>
</div>
@@ -48,7 +48,7 @@ require 'scripts/pi-hole/php/header_authenticated.php';
<p>The reason for this is that Pi-hole will not send additional queries upstream when serving <code>CNAME</code> replies. As consequence, if you set a target that isn't already known, the reply to the client may be incomplete. Pi-hole just returns the information it knows at the time of the query. This results in certain limitations for <code>CNAME</code> targets,
for instance, only <i>active</i> DHCP leases work as targets - mere DHCP <i>leases</i> aren't sufficient as they aren't (yet) valid DNS records.</p>
<p>Additionally, you can't <code>CNAME</code> external domains (<code>bing.com</code> to <code>google.com</code>) successfully as this could result in invalid SSL certificate errors when the target server does not serve content for the requested domain.</p>
<button type="button" id="btnAdd" class="btn btn-primary pull-right">Add</button>
<button type="button" id="btnAdd-host" class="btn btn-primary pull-right">Add</button>
</div>
</div>
</div>
@@ -91,23 +91,22 @@ require 'scripts/pi-hole/php/header_authenticated.php';
<!-- /.box-header -->
<div class="box-body">
<div class="row">
<div class="form-group col-md-6">
<div class="form-group col-md-5">
<label for="domain">Domain:</label>
<input id="domain" type="url" class="form-control" placeholder="Add a domain (example.com or sub.example.com)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
<input id="Cdomain" type="url" class="form-control" placeholder="Add a domain (example.com or sub.example.com)" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="form-group col-md-6">
<div class="form-group col-md-5">
<label for="target">Target Domain:</label>
<input id="target" type="url" class="form-control" placeholder="Associated Target Domain" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
<input id="Ctarget" type="url" class="form-control" placeholder="Associated Target Domain" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
<div class="form-group col-md-2">
<label for="target">TTL (optinal):</label>
<input id="Cttl" type="numeric" class="form-control" placeholder="TTL in seconds" autocomplete="off" spellcheck="false" autocapitalize="none" autocorrect="off">
</div>
</div>
</div>
<div class="box-footer clearfix">
<strong>Note:</strong>
<p>The target of a <code>CNAME</code> must be a domain that the Pi-hole already has in its cache or is authoritative for. This is a universal limitation of <code>CNAME</code> records.</p>
<p>The reason for this is that Pi-hole will not send additional queries upstream when serving <code>CNAME</code> replies. As consequence, if you set a target that isn't already known, the reply to the client may be incomplete. Pi-hole just returns the information it knows at the time of the query. This results in certain limitations for <code>CNAME</code> targets,
for instance, only <i>active</i> DHCP leases work as targets - mere DHCP <i>leases</i> aren't sufficient as they aren't (yet) valid DNS records.</p>
<p>Additionally, you can't <code>CNAME</code> external domains (<code>bing.com</code> to <code>google.com</code>) successfully as this could result in invalid SSL certificate errors when the target server does not serve content for the requested domain.</p>
<button type="button" id="btnAdd" class="btn btn-primary pull-right">Add</button>
<button type="button" id="btnAdd-cname" class="btn btn-primary pull-right">Add</button>
</div>
</div>
</div>