mirror of
https://github.com/octoleo/syncthing.git
synced 2024-12-23 03:18:59 +00:00
Summarize OS
This commit is contained in:
parent
ec85c9fdfe
commit
113b110ab4
6
main.go
6
main.go
@ -225,6 +225,9 @@ func reportHandler(w http.ResponseWriter, r *http.Request) {
|
||||
func statsForInts(data []int) map[string]int {
|
||||
sort.Ints(data)
|
||||
res := make(map[string]int, 4)
|
||||
if len(data) == 0 {
|
||||
return res
|
||||
}
|
||||
res["fp"] = data[int(float64(len(data))*0.05)]
|
||||
res["med"] = data[len(data)/2]
|
||||
res["nfp"] = data[int(float64(len(data))*0.95)]
|
||||
@ -235,6 +238,9 @@ func statsForInts(data []int) map[string]int {
|
||||
func statsForFloats(data []float64) map[string]float64 {
|
||||
sort.Float64s(data)
|
||||
res := make(map[string]float64, 4)
|
||||
if len(data) == 0 {
|
||||
return res
|
||||
}
|
||||
res["fp"] = data[int(float64(len(data))*0.05)]
|
||||
res["med"] = data[len(data)/2]
|
||||
res["nfp"] = data[int(float64(len(data))*0.95)]
|
||||
|
@ -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>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user