Change repo stats to use the RAC table and a nice UI

This commit is contained in:
Joseph Schorr 2016-06-22 14:50:59 -04:00
parent dbe14fe729
commit 853cca35f3
10 changed files with 184 additions and 125 deletions

View file

@ -27,6 +27,21 @@ angular.module('quay').directive('repoPanelInfo', function () {
$scope.repository.description = content;
$scope.repository.put();
};
$scope.getAggregatedUsage = function(stats, days) {
var count = 0;
var startDate = moment().subtract(days + 1, 'days');
for (var i = 0; i < stats.length; ++i) {
var stat = stats[i];
var statDate = moment(stat['date']);
if (statDate.isBefore(startDate)) {
continue;
}
count += stat['count'];
}
return count;
};
}
};
return directiveDefinitionObject;