2014-11-16 03:34:00 +08:00
|
|
|
var ZoneMinder = angular.module('ZoneMinder', [
|
2014-11-25 23:25:34 +08:00
|
|
|
'ZoneMinderControllers',
|
|
|
|
'tc.chartjs'
|
2014-11-16 03:34:00 +08:00
|
|
|
]);
|
|
|
|
|
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
|
|
|
|
2014-11-26 00:25:10 +08:00
|
|
|
ZoneMinder.factory('Host', function($http) {
|
2014-11-22 04:06:59 +08:00
|
|
|
return {
|
|
|
|
getLoad: function(callback) {
|
|
|
|
$http.get('/api/host/getLoad.json').success(callback);
|
2014-11-26 00:25:10 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
});
|
|
|
|
|
|
|
|
ZoneMinder.factory('Footer', function($http) {
|
|
|
|
return {
|
2014-11-22 06:16:19 +08:00
|
|
|
getDiskPercent: function(callback) {
|
|
|
|
$http.get('/api/host/getDiskPercent.json').success(callback);
|
2014-11-24 08:56:20 +08:00
|
|
|
},
|
|
|
|
getVersion: function(callback) {
|
|
|
|
$http.get('/api/host/getVersion.json').success(callback);
|
2014-11-22 04:06:59 +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:10:01 +08:00
|
|
|
|
|
|
|
ZoneMinder.factory('Config', function($http) {
|
|
|
|
return {
|
2014-11-20 12:11:33 +08:00
|
|
|
getCategories: function() {
|
|
|
|
return $http.get('/api/configs/categories.json');
|
|
|
|
},
|
|
|
|
getCategory: function(category) {
|
|
|
|
return $http.get('/api/configs/categories/' + category + '.json')
|
|
|
|
},
|
2014-11-20 12:10:01 +08:00
|
|
|
setConfigModel: function() {
|
|
|
|
return $http.get('/api/configs/keyValue.json')
|
|
|
|
},
|
2014-11-20 12:11:33 +08:00
|
|
|
updateOption: function(configId, newValue) {
|
|
|
|
var putData = "Config[Value]=" + newValue;
|
|
|
|
//var postData = {Config[Value]: configValue};
|
|
|
|
|
|
|
|
|
|
|
|
return $http({
|
|
|
|
method: 'POST',
|
|
|
|
url: '/api/configs/' + configId + '.json',
|
|
|
|
data: putData,
|
|
|
|
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
//return $http.post ('/api/configs/' + configId + '.json', postData)
|
|
|
|
}
|
2014-11-20 12:10:01 +08:00
|
|
|
};
|
|
|
|
});
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
});
|