Added Statistics
See: https://github.com/freifunkhamburg/ffffng/issues/24
This commit is contained in:
parent
2d5db51d24
commit
3c80be4d00
8 changed files with 203 additions and 0 deletions
server/resources
26
server/resources/statisticsResource.js
Normal file
26
server/resources/statisticsResource.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('ffffng').factory('StatisticsResource', function (
|
||||
Logger,
|
||||
NodeService,
|
||||
Resources,
|
||||
ErrorTypes
|
||||
) {
|
||||
return {
|
||||
get: function (req, res) {
|
||||
NodeService.getNodeStatistics(function (err, nodeStatistics) {
|
||||
if (err) {
|
||||
Logger.tag('statistics').error('Error getting statistics:', err);
|
||||
return Resources.error(res, {data: 'Internal error.', type: ErrorTypes.internalError});
|
||||
}
|
||||
|
||||
return Resources.success(
|
||||
res,
|
||||
{
|
||||
nodes: nodeStatistics
|
||||
}
|
||||
);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue