Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include FTL's DNS port in web status and give the temperature its own line #2031

Merged
merged 11 commits into from
Dec 29, 2021
3 changes: 0 additions & 3 deletions scripts/pi-hole/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -731,8 +731,6 @@ function updateSummaryData(runOnce) {
data.ads_blocked_today = "connection";
data.ads_percentage_today = "to";
data.domains_being_blocked = "API";
// Adjust text
$("#temperature").html('<i class="fa fa-circle text-red"></i> FTL offline');
// Show spinner
$("#queries-over-time .overlay").show();
$("#forward-destinations-pie .overlay").show();
Expand All @@ -745,7 +743,6 @@ function updateSummaryData(runOnce) {
} else if (FTLoffline) {
// FTL was previously offline
FTLoffline = false;
$("#temperature").text(" ");
updateQueriesOverTime();
updateTopClientsChart();
updateTopLists();
Expand Down
49 changes: 21 additions & 28 deletions scripts/pi-hole/php/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -326,47 +326,40 @@ function pidofFTL()
<!-- Sidebar user panel -->
<div class="user-panel">
<div class="pull-left image">
<img src="img/logo.svg" alt="Pi-hole logo" width="45" height="67" style="height: 67px;">
<img src="img/logo.svg" alt="Pi-hole logo" width="45" height="90" style="height: 90px;">
</div>
<div class="pull-left info">
<p>Status</p>
<?php
$pistatus = pihole_execute('status web');
if (isset($pistatus[0])) {
$pistatus = $pistatus[0];
$pistatus = intval($pistatus[0]);
} else {
$pistatus = null;
}
if ($pistatus === "1") {
if ($pistatus == 53) {
echo '<span id="status"><i class="fa fa-circle text-green-light"></i> Active</span>';
} elseif ($pistatus === "0") {
} elseif ($pistatus == 0) {
echo '<span id="status"><i class="fa fa-circle text-red"></i> Offline</span>';
} elseif ($pistatus === "-1") {
} elseif ($pistatus == -1) {
echo '<span id="status"><i class="fa fa-circle text-red"></i> DNS service not running</span>';
} elseif ($pistatus == -2 || is_null($pistatus)) {
echo '<span id="status"><i class="fa fa-circle text-red"></i> Unknown</span>';
} else {
echo '<span id="status"><i class="fa fa-circle text-orange"></i> Unknown</span>';
echo '<span id="status"><i class="fa fa-circle text-orange"></i> DNS service on port '.$pistatus.'</span>';
yubiuser marked this conversation as resolved.
Show resolved Hide resolved
}

// CPU Temp
if($FTL)
{
if ($celsius >= -273.15) {
echo "<span id=\"temperature\"><i class=\"fa fa-fire ";
if ($celsius > $temperaturelimit) {
echo "text-red";
}
else
{
echo "text-vivid-blue";
}
?>"></i> Temp:&nbsp;<span id="rawtemp" hidden><?php echo $celsius;?></span><span id="tempdisplay"></span></span><?php
}
}
else
{
echo '<span id=\"temperature\"><i class="fa fa-circle text-red"></i> FTL offline</span>';
}
?>
?>
<br/>
DL6ER marked this conversation as resolved.
Show resolved Hide resolved
<?php $tempcolor = "text-vivid-blue";
if ($celsius > $temperaturelimit) {
$tempcolor = "text-red";}
echo "<span id=\"temperature\"><i class=\"fa fa-fire ".$tempcolor."\"></i>";
?>
<?php if ($celsius >= -273.15) {
echo "Temp:&nbsp;<span id=\"rawtemp\" hidden>" .$celsius. "</span><span id=\"tempdisplay\"></span>";
} else {
echo "No temp sensor found<span id=\"tempdisplay\"></span>";}
?></span>
<br/>
<?php
echo "<span title=\"Detected $nproc cores\"><i class=\"fa fa-circle ";
Expand Down Expand Up @@ -538,7 +531,7 @@ function pidofFTL()
</ul>
<!-- <a href="#" id="flip-status"><i class="fa fa-stop"></i> Disable</a> -->
</li>
<li id="pihole-enable" class="treeview"<?php if ($pistatus == "1") { ?> hidden<?php } ?>>
<li id="pihole-enable" class="treeview"<?php if (!in_array($pistatus,["0","-1","-2"])) { ?> hidden<?php } ?>>
<a href="#">
<i class="fa fa-fw menu-icon fa-play"></i>
<span id="enableLabel">Enable&nbsp;&nbsp;&nbsp;
Expand Down