2014-11-16 03:34:00 +08:00
|
|
|
var ZoneMinder = angular.module('ZoneMinder', [
|
|
|
|
'ZoneMinderControllers'
|
|
|
|
]);
|
|
|
|
|
2014-11-16 07:50:04 +08:00
|
|
|
ZoneMinder.config(['$locationProvider', function($locationProvider){
|
|
|
|
$locationProvider.html5Mode(true);
|
|
|
|
}]);
|
|
|
|
|
2014-11-16 03:34:00 +08:00
|
|
|
ZoneMinder.factory('Header', function($http) {
|
|
|
|
return {
|
|
|
|
getLogState: function(callback) {
|
|
|
|
$http.get('/api/monitors.json').success(callback);
|
2014-11-16 08:35:10 +08:00
|
|
|
},
|
|
|
|
getDaemonStatus: function(callback) {
|
|
|
|
$http.get('/api/host/daemonCheck.json').success(callback);
|
2014-11-16 03:34:00 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
2014-11-16 07:50:46 +08:00
|
|
|
|
|
|
|
ZoneMinder.factory('Event', function($http) {
|
|
|
|
return {
|
|
|
|
getEvent: function(eventId) {
|
|
|
|
return $http.get('/api/events/'+ eventId +'.json');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2014-11-19 23:53:07 +08:00
|
|
|
ZoneMinder.factory('Console', function($http) {
|
|
|
|
return {
|
|
|
|
getConsoleEvents: function(interval) {
|
|
|
|
return $http.get('/api/events/consoleEvents/'+interval+'.json');
|
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
2014-11-20 12:05:22 +08:00
|
|
|
ZoneMinder.directive('angularHtmlBind', function($compile) {
|
|
|
|
return function(scope, elm, attrs) {
|
|
|
|
scope.$watch(attrs.angularHtmlBind, function(newValue, oldValue) {
|
|
|
|
if (newValue && newValue !== oldValue) {
|
|
|
|
elm.html(newValue);
|
|
|
|
$compile(elm.contents())(scope);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|