Skip to content

Commit

Permalink
Include FTL's DNS port in web status and give the temperature its own…
Browse files Browse the repository at this point in the history
… line (#2031)

* Inlcude port in web status

Signed-off-by: Christian König <[email protected]>

* Single line for DNS status

Signed-off-by: Christian König <[email protected]>

* Fix enable/disable status

Signed-off-by: Christian König <[email protected]>

* Give the user-panel a bit more space

Signed-off-by: Christian König <[email protected]>

* Address reviewer's comment

Signed-off-by: Christian König <[email protected]>

* Fix temp sensor

Signed-off-by: Christian König <[email protected]>

* Add  again

Signed-off-by: Christian König <[email protected]>

* Simplify CPU temp code

Signed-off-by: Christian König <[email protected]>

* Use intval() and resize the logo

Signed-off-by: Christian König <[email protected]>

* Do not substitute temperature if FTL is offline

Signed-off-by: Christian König <[email protected]>

* Apply suggestions from code review

Signed-off-by: DL6ER <[email protected]>

Co-authored-by: DL6ER <[email protected]>
  • Loading branch information
yubiuser and DL6ER authored Dec 29, 2021
1 parent c4c6089 commit 64a3675
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 31 deletions.
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>';
}

// 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/>
<?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

0 comments on commit 64a3675

Please sign in to comment.