Display stills of each monitor, set per-monitor alerts
This commit displays a still of each monitor at page load time. The panel surrounding the monitor is context sensitive - if zmc or zma is not running, the panel is red (well, pink). Also if either zmc or zma are not running, we add an icon in the panel's header, explaining what is wrong.
This commit is contained in:
parent
addc985656
commit
ff65a701eb
|
@ -50,6 +50,34 @@ ZoneMinder.controller('ConsoleController', function($scope, Console) {
|
|||
$scope['Counts' + mid] = count;
|
||||
}
|
||||
});
|
||||
|
||||
Console.getMonitors().then(function(results) {
|
||||
var monitors = new Array();
|
||||
var daemons = ['zmc', 'zma']; // Daemons to check for each monitor
|
||||
|
||||
// For each monitor
|
||||
angular.forEach(results['data']['monitors'], function(value, key) {
|
||||
var id = value.Monitor.Id;
|
||||
var alerts = value.Monitor.alerts = new Array();
|
||||
|
||||
// Check if the above daemons are running for it
|
||||
angular.forEach(daemons, function(daemon) {
|
||||
// Ask the API for the daemonStatus of the id
|
||||
Console.daemonStatus(id, daemon).then(function(results) {
|
||||
value.Monitor.alerts[daemon] = results.data.status;
|
||||
|
||||
// If there is a failed daemon, set a generic error
|
||||
if (daemon) {
|
||||
value.Monitor.alert = 'zma or zmc is not running';
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
monitors.push(value.Monitor);
|
||||
});
|
||||
|
||||
$scope.monitors = monitors;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -60,40 +60,21 @@ xhtmlHeaders( __FILE__, $SLANG['Console'] );
|
|||
<div class="col-md-10">
|
||||
|
||||
<div ng-controller="ConsoleController">
|
||||
<div class="row">
|
||||
<?php foreach( $displayMonitors as $monitor ) {
|
||||
if ( !$monitor['zmc'] )
|
||||
$dclass = "danger";
|
||||
else
|
||||
{
|
||||
if ( !$monitor['zma'] )
|
||||
$dclass = "warning";
|
||||
else
|
||||
$dclass = "info";
|
||||
}
|
||||
?>
|
||||
<div class="col-md-3">
|
||||
<div class="panel panel-<?= $dclass ?>">
|
||||
<div class="panel-heading">
|
||||
<input class="pull-right btn btn-default" type="checkbox" name="markMids[]" value="<?= $monitor['Id'] ?>" onclick="setButtonStates( this )"<?php if ( !canEdit( 'Monitors' ) ) { ?> disabled="disabled"<?php } ?>/>
|
||||
<h2 class="text-left panel-title"><?= $monitor['Name'] ?> <small>(<?= $monitor['Id'] ?>)</small></h2>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-4" ng-repeat="monitor in monitors">
|
||||
<div class="panel" ng-class="(monitor.alerts.zmc || monitor.alerts.zma) ? 'panel-default' : 'panel-danger'">
|
||||
<div class="panel-heading">
|
||||
<a ng-hide="(monitor.alerts.zmc || monitor.alerts.zma)" class="pull-right" href="#" tooltip="{{ monitor.alert }}"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span></a>
|
||||
<h2 class="text-left panel-title">{{ monitor.Name }} <small>({{monitor.Id}})</small></h2>
|
||||
</div>
|
||||
|
||||
<div class="panel-body center-block">
|
||||
<div>
|
||||
<?php
|
||||
$scale = 50;
|
||||
$streamSrc = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
|
||||
outputImageStill( "liveStream".$monitor['Id'], $streamSrc, reScale( $monitor['Width'], $scale ), reScale( $monitor['Height'], $scale ), $monitor['Name'] );
|
||||
?>
|
||||
<div class="panel-body center-block">
|
||||
<img class="img-responsive img-rounded" ng-src="/cgi-bin/nph-zms?mode=single&monitor={{monitor.Id}}&scale=50" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<p><span ng-bind="Counts<?= $monitor['Id'] ?>"></span> recent events</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue