Merge pull request #366 from glaszig/feature/improved-service-status-indicator

improved service status display
This commit is contained in:
Bill Zimmerman 2019-08-08 20:55:04 +02:00 committed by GitHub
commit a00f1be009
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 40 additions and 13 deletions

29
dist/css/custom.css vendored
View file

@ -49,6 +49,35 @@
min-height:500px; min-height:500px;
} }
.service-status-running,
.service-status-stopped {
background-color: #fff;
color: #333;
text-transform: uppercase;
line-height: inherit;
}
.service-status-running:before,
.service-status-stopped:before {
display: inline-block;
height: 16px;
width: 16px;
content: "\2022";
font-size: 3.5em;
color: green;
line-height: 16px;
vertical-align: bottom;
margin-right: 2px;
}
.service-status-stopped:before {
color: red;
animation: flash 1s linear infinite;
}
@keyframes flash {
50% {
opacity: 0;
}
}
.logoutput { .logoutput {
width:100%; width:100%;
height:300px; height:300px;

View file

@ -96,14 +96,10 @@ function DisplayDHCPConfig()
} else { } else {
$status->addMessage('dnsmasq already stopped', 'info'); $status->addMessage('dnsmasq already stopped', 'info');
} }
} else {
if ($dnsmasq_state) {
$status->addMessage('Dnsmasq is running', 'success');
} else {
$status->addMessage('Dnsmasq is not running', 'warning');
}
} }
$serviceStatus = $dnsmasq_state ? "running" : "stopped";
exec('cat '. RASPI_DNSMASQ_CONFIG, $return); exec('cat '. RASPI_DNSMASQ_CONFIG, $return);
$conf = ParseConfig($return); $conf = ParseConfig($return);
$arrRange = explode(",", $conf['dhcp-range']); $arrRange = explode(",", $conf['dhcp-range']);
@ -140,7 +136,10 @@ function DisplayDHCPConfig()
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-exchange fa-fw"></i> <?php echo _("Configure DHCP"); ?></div> <div class="panel-heading">
<i class="fa fa-exchange fa-fw"></i> <?php echo _("Configure DHCP"); ?>
<span class="label pull-right service-status-<?php echo $serviceStatus ?>">dnsmasq <?php echo _($serviceStatus) ?></span>
</div>
<!-- /.panel-heading --> <!-- /.panel-heading -->
<div class="panel-body"> <div class="panel-body">
<p><?php $status->showMessages(); ?></p> <p><?php $status->showMessages(); ?></p>

View file

@ -44,11 +44,7 @@ function DisplayHostAPDConfig()
exec('cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig); exec('cat '. RASPI_HOSTAPD_CONFIG, $hostapdconfig);
exec('pidof hostapd | wc -l', $hostapdstatus); exec('pidof hostapd | wc -l', $hostapdstatus);
if ($hostapdstatus[0] == 0) { $serviceStatus = $hostapdstatus[0] == 0 ? "stopped" : "running";
$status->addMessage('HostAPD is not running', 'warning');
} else {
$status->addMessage('HostAPD is running', 'success');
}
foreach ($hostapdconfig as $hostapdconfigline) { foreach ($hostapdconfig as $hostapdconfigline) {
if (strlen($hostapdconfigline) === 0) { if (strlen($hostapdconfigline) === 0) {
@ -65,7 +61,10 @@ function DisplayHostAPDConfig()
<div class="row"> <div class="row">
<div class="col-lg-12"> <div class="col-lg-12">
<div class="panel panel-primary"> <div class="panel panel-primary">
<div class="panel-heading"><i class="fa fa-dot-circle-o fa-fw"></i> <?php echo _("Configure hotspot"); ?></div> <div class="panel-heading">
<i class="fa fa-dot-circle-o fa-fw"></i> <?php echo _("Configure hotspot"); ?>
<span class="label pull-right service-status-<?php echo $serviceStatus ?>">hostapd <?php echo _($serviceStatus) ?></span>
</div>
<!-- /.panel-heading --> <!-- /.panel-heading -->
<div class="panel-body"> <div class="panel-body">
<p><?php $status->showMessages(); ?></p> <p><?php $status->showMessages(); ?></p>