From 0080ee6e86e66dc0f25f6bb7359587dca1a7563a Mon Sep 17 00:00:00 2001 From: Jakob Borg Date: Wed, 30 Jul 2014 22:40:08 +0200 Subject: [PATCH] Cleanup --- .gitignore | 2 +- static/app.js | 75 --------------------------------------------------- 2 files changed, 1 insertion(+), 76 deletions(-) delete mode 100644 static/app.js diff --git a/.gitignore b/.gitignore index cd33fb524..47039d3b5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,3 @@ db -st-usage-reporting +usage-reporting *.pem diff --git a/static/app.js b/static/app.js deleted file mode 100644 index 87707db07..000000000 --- a/static/app.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright (C) 2014 Jakob Borg and other contributors. All rights reserved. -// Use of this source code is governed by an MIT-style license that can be -// found in the LICENSE file. - -/*jslint browser: true, continue: true, plusplus: true */ -/*global $: false, angular: false */ - -'use strict'; - -var reports = angular.module('reports', []); - -reports.controller('ReportsCtrl', function ($scope, $http) { - $scope.report = {}; - $scope.failure = false; - $scope.categories = [ - {key: 'totFiles', descr: 'Files Managed per Node', unit: ''}, - {key: 'maxFiles', descr: 'Files in Largest Repo', unit: ''}, - {key: 'totMiB', descr: 'Data Managed per Node', unit: 'MiB'}, - {key: 'maxMiB', descr: 'Data in Largest Repo', unit: 'MiB'}, - {key: 'numNodes', descr: 'Number of Nodes in Cluster', unit: ''}, - {key: 'numRepos', descr: 'Number of Repositories Configured', unit: ''}, - {key: 'memoryUsage', descr: 'Memory Usage', unit: 'MiB'}, - {key: 'memorySize', descr: 'System Memory', unit: 'MiB'}, - {key: 'sha256Perf', descr: 'SHA-256 Hashing Performance', unit: 'MiB/s'}, - ]; - - $http.get('/report').success(function (data) { - $scope.report = data; - - var versions = []; - for (var ver in data.versions) { - versions.push([ver, data.versions[ver]]); - } - $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; - for (var o in d) { - tot += d[o]; - } - - for (var o in d) { - l.push([o, d[o], 100 * d[o] / tot]); - } - - l.sort(function (a, b) { - if (b[1] < a[1]) - return -1; - return b[1] > a[1]; - }); - return l; -}