Summarize OS
This commit is contained in:
@@ -34,11 +34,27 @@ reports.controller('ReportsCtrl', function ($scope, $http) {
|
||||
$scope.versions = sortedList(data.versions);
|
||||
$scope.platforms = sortedList(data.platforms);
|
||||
|
||||
var os = aggregate(data.platforms, function (x) {return x.replace(/-.*/, '');})
|
||||
$scope.os = sortedList(os);
|
||||
|
||||
}).error(function () {
|
||||
$scope.failure = true;
|
||||
});
|
||||
});
|
||||
|
||||
function aggregate(d, f) {
|
||||
var r = {};
|
||||
for (var o in d) {
|
||||
var k = f(o);
|
||||
if (k in r) {
|
||||
r[k] += d[o];
|
||||
} else {
|
||||
r[k] = d[o];
|
||||
}
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function sortedList(d) {
|
||||
var l = [];
|
||||
var tot = 0;
|
||||
|
||||
@@ -52,7 +52,7 @@ found in the LICENSE file.
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -68,7 +68,7 @@ found in the LICENSE file.
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="col-md-4">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
@@ -84,6 +84,22 @@ found in the LICENSE file.
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>OS</th><th class="text-right">Nodes</th><th class="text-right">Share</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="p in os">
|
||||
<td>{{p[0]}}</td>
|
||||
<td class="text-right">{{p[1]}}</td>
|
||||
<td class="text-right">{{p[2] | number:2}}%</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user