2016-07-19 13:24:43 +02:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
angular.module('ffffngAdmin')
|
2017-05-06 18:40:59 +02:00
|
|
|
.directive('faDashboardStats', function ($http, $state, notification, config) {
|
|
|
|
var pathPrefix = config.rootPath === '/' ? '' : config.rootPath;
|
|
|
|
|
2016-07-19 13:24:43 +02:00
|
|
|
var link = function (scope) {
|
|
|
|
scope.stats = {};
|
2017-05-06 18:40:59 +02:00
|
|
|
$http.get(pathPrefix + '/internal/api/statistics')
|
2016-07-19 13:24:43 +02:00
|
|
|
.then(function (result) { scope.stats = result.data; })
|
|
|
|
.catch(function (e) {
|
|
|
|
notification.log('Error: ' + e.data, { addnCls: 'humane-flatty-error' });
|
|
|
|
console.error(e);
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
|
|
|
return {
|
|
|
|
'link': link,
|
|
|
|
'restrict': 'E',
|
|
|
|
'scope': {},
|
|
|
|
|
|
|
|
'templateUrl': 'views/dashboardStats.html'
|
|
|
|
};
|
|
|
|
});
|