Set the logState in header via angular

This commit is contained in:
Kyle Johnson 2014-11-16 00:35:10 +00:00
parent 175e7d3e22
commit 64122b3b98
3 changed files with 10 additions and 1 deletions

View File

@ -10,6 +10,9 @@ ZoneMinder.factory('Header', function($http) {
return {
getLogState: function(callback) {
$http.get('/api/monitors.json').success(callback);
},
getDaemonStatus: function(callback) {
$http.get('/api/host/daemonCheck.json').success(callback);
}
};
});

View File

@ -4,6 +4,12 @@ ZoneMinder.controller('HeaderController', function($scope, Header) {
Header.getLogState(function(results) {
console.log(results);
});
Header.getDaemonStatus(function(results) {
if (results.result == 1) {
$scope.isRunning = true;
}
});
});
ZoneMinder.controller('EventController', function($scope, $location, Event) {

View File

@ -12,7 +12,7 @@
<div class="container-fluid">
<a href="?view=console"><span class="navbar-brand">ZoneMinder</span></a>
<button type="button" class="btn btn-<?= $statusClass ?> btn-md navbar-btn pull-right" data-toggle="modal" data-target="#myModal">
<button type="button" class="btn btn-md navbar-btn pull-right" ng-class="isRunning ? 'btn-success' : 'btn-danger'" data-toggle="modal" data-target="#myModal">
<span class="glyphicon glyphicon-off"></span>
</button>