Add flag for client configuration

This commit is contained in:
Christian Zeitnitz 2021-03-28 14:44:05 +02:00
parent 1715237529
commit 6eb51a2d63
2 changed files with 7 additions and 4 deletions

View File

@ -152,6 +152,7 @@ function DisplayDashboard(&$extraFooterScripts)
exec('cat ' . RASPI_DNSMASQ_LEASES . '| grep -E $(iw dev ' . $apInterface . ' station dump | grep -oE ' . $MACPattern . ' | paste -sd "|")', $clients); exec('cat ' . RASPI_DNSMASQ_LEASES . '| grep -E $(iw dev ' . $apInterface . ' station dump | grep -oE ' . $MACPattern . ' | paste -sd "|")', $clients);
} }
$ifaceStatus = $clientinfo["connected"]=="y" ? "up" : "down"; $ifaceStatus = $clientinfo["connected"]=="y" ? "up" : "down";
$isClientConfigured = true;
switch($clientinfo["type"]) { switch($clientinfo["type"]) {
case "eth": case "eth":
case "usb": case "usb":
@ -174,7 +175,8 @@ function DisplayDashboard(&$extraFooterScripts)
default: default:
$client_title = "No information available"; $client_title = "No information available";
$type_name = "Not configured"; $type_name = "Not configured";
$ifaceStatus = "warn"; $ifaceStatus = "warn";
$isClientConfigured = false;
} }
echo renderTemplate( echo renderTemplate(
@ -197,7 +199,8 @@ function DisplayDashboard(&$extraFooterScripts)
"strTxPackets", "strTxPackets",
"strTxBytes", "strTxBytes",
"txPower", "txPower",
"clientinfo" "clientinfo",
"isClientConfigured"
) )
); );
$extraFooterScripts[] = array('src'=>'app/js/dashboardchart.js', 'defer'=>false); $extraFooterScripts[] = array('src'=>'app/js/dashboardchart.js', 'defer'=>false);

View File

@ -9,7 +9,7 @@
<div class="col"> <div class="col">
<button class="btn btn-light btn-icon-split btn-sm service-status float-right"> <button class="btn btn-light btn-icon-split btn-sm service-status float-right">
<span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span> <span class="icon"><i class="fas fa-circle service-status-<?php echo $ifaceStatus ?>"></i></span>
<span class="text service-status"><?php echo $type_name; if ($isConfigured=($ifaceStatus!="warn")) echo ' '. _($ifaceStatus); ?></span> <span class="text service-status"><?php echo $type_name; if ( $isClientConfigured ) echo ' '. _($ifaceStatus); ?></span>
</button> </button>
</div> </div>
</div><!-- /.row --> </div><!-- /.row -->
@ -69,7 +69,7 @@
<div class=""><?php echo _("No Client device or not yet configured"); ?></div> <div class=""><?php echo _("No Client device or not yet configured"); ?></div>
<?php endif; ?> <?php endif; ?>
</div> </div>
<?php if ($isConfigured) : ?> <?php if ($isClientConfigured) : ?>
<div class="col-md mt-2 d-flex justify-content-center"> <div class="col-md mt-2 d-flex justify-content-center">
<?php <?php
preg_match("/.*\((\s*\d*)\s*%\s*\)/",$clientinfo["signal"],$match); preg_match("/.*\((\s*\d*)\s*%\s*\)/",$clientinfo["signal"],$match);