Overview over monitoring states in admin panel.
This commit is contained in:
parent
eb3e0d96be
commit
4ea37d59cd
4 changed files with 126 additions and 2 deletions
server/resources
|
@ -4,6 +4,7 @@ angular.module('ffffng').factory('MonitoringResource', function (
|
|||
Constraints,
|
||||
Validator,
|
||||
MonitoringService,
|
||||
Logger,
|
||||
_,
|
||||
Strings,
|
||||
Resources,
|
||||
|
@ -12,6 +13,30 @@ angular.module('ffffng').factory('MonitoringResource', function (
|
|||
var isValidToken = Validator.forConstraint(Constraints.token);
|
||||
|
||||
return {
|
||||
getAll: function (req, res) {
|
||||
Resources.getValidRestParams('list', req, function (err, restParams) {
|
||||
if (err) {
|
||||
return Resources.error(res, err);
|
||||
}
|
||||
|
||||
return MonitoringService.getAll(
|
||||
restParams,
|
||||
function (err, monitoringStates, total) {
|
||||
if (err) {
|
||||
Logger.tag('monitoring', 'admin').error('Could not get monitoring states:', err);
|
||||
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
|
||||
}
|
||||
|
||||
res.set('X-Total-Count', total);
|
||||
return Resources.success(res, _.map(monitoringStates, function (state) {
|
||||
state.mapId = _.toLower(state.mac).replace(/:/g, '');
|
||||
return state;
|
||||
}));
|
||||
}
|
||||
);
|
||||
});
|
||||
},
|
||||
|
||||
confirm: function (req, res) {
|
||||
var data = Resources.getData(req);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue