Grab system load from API and set with angular

This commit is contained in:
Kyle Johnson 2014-11-21 20:06:59 +00:00
parent 345f152181
commit e541976b77
3 changed files with 16 additions and 2 deletions

View File

@ -17,6 +17,14 @@ ZoneMinder.factory('Header', function($http) {
}; };
}); });
ZoneMinder.factory('Footer', function($http) {
return {
getLoad: function(callback) {
$http.get('/api/host/getLoad.json').success(callback);
}
};
});
ZoneMinder.factory('Event', function($http) { ZoneMinder.factory('Event', function($http) {
return { return {
getEvent: function(eventId) { getEvent: function(eventId) {

View File

@ -11,6 +11,12 @@ ZoneMinder.controller('HeaderController', function($scope, Header) {
}); });
}); });
ZoneMinder.controller('FooterController', function($scope, Footer) {
Footer.getLoad(function(load) {
$scope.load = load.load;
});
});
ZoneMinder.controller('EventController', function($scope, $location, Event) { ZoneMinder.controller('EventController', function($scope, $location, Event) {
var eventId = $location.search().eid; var eventId = $location.search().eid;

View File

@ -1,6 +1,6 @@
<div id="footer"> <div id="footer" ng-controller="FooterController">
<div class="container-fluid"> <div class="container-fluid">
<p class="pull-right text-muted"><?= $SLANG['Load'] ?>: <?= getLoad() ?> - <p class="pull-right text-muted"><?= $SLANG['Load'] ?>: <span ng-bind="load"></span> -
<?= $SLANG['Disk'] ?>: <?= getDiskPercent() ?>% - <?= $SLANG['Disk'] ?>: <?= getDiskPercent() ?>% -
<?= makePopupLink( '?view=version', 'zmVersion', 'version', 'v' . ZM_VERSION, canEdit( 'System' ) ) ?> - <?= makePopupLink( '?view=version', 'zmVersion', 'version', 'v' . ZM_VERSION, canEdit( 'System' ) ) ?> -
<?php <?php