mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-08-10 23:40:30 -04:00
4 space indent everywhere
This commit is contained in:
parent
0591548861
commit
9ed1ac817e
6 changed files with 195 additions and 196 deletions
|
@ -1,49 +1,49 @@
|
|||
"use strict";
|
||||
|
||||
var brozzlerConsoleApp = angular.module("brozzlerConsoleApp", [
|
||||
"ngRoute",
|
||||
"brozzlerControllers",
|
||||
"ngRoute",
|
||||
"brozzlerControllers",
|
||||
]);
|
||||
|
||||
brozzlerConsoleApp.config(["$routeProvider", "$locationProvider",
|
||||
function($routeProvider, $locationProvider) {
|
||||
$routeProvider.
|
||||
when("/jobs", {
|
||||
templateUrl: "/static/partials/jobs.html",
|
||||
controller: "JobsListController"
|
||||
}).
|
||||
when("/jobs/:id", {
|
||||
templateUrl: "/static/partials/job.html",
|
||||
controller: "JobController"
|
||||
}).
|
||||
when("/sites/:id", {
|
||||
templateUrl: "/static/partials/site.html",
|
||||
controller: "SiteController"
|
||||
}).
|
||||
when("/", {
|
||||
redirectTo: "/jobs"
|
||||
}).
|
||||
otherwise({
|
||||
template: '<div> <div class="page-header"> <h1>Not Found</h1> </div> <div class="row"> <div class="col-sm-12"> How the heck did you get here? </div> </div> </div> ',
|
||||
});
|
||||
function($routeProvider, $locationProvider) {
|
||||
$routeProvider.
|
||||
when("/jobs", {
|
||||
templateUrl: "/static/partials/jobs.html",
|
||||
controller: "JobsListController"
|
||||
}).
|
||||
when("/jobs/:id", {
|
||||
templateUrl: "/static/partials/job.html",
|
||||
controller: "JobController"
|
||||
}).
|
||||
when("/sites/:id", {
|
||||
templateUrl: "/static/partials/site.html",
|
||||
controller: "SiteController"
|
||||
}).
|
||||
when("/", {
|
||||
redirectTo: "/jobs"
|
||||
}).
|
||||
otherwise({
|
||||
template: '<div> <div class="page-header"> <h1>Not Found</h1> </div> <div class="row"> <div class="col-sm-12"> How the heck did you get here? </div> </div> </div> ',
|
||||
});
|
||||
|
||||
$locationProvider.html5Mode({
|
||||
enabled: true,
|
||||
requireBase: false,
|
||||
});
|
||||
}]);
|
||||
$locationProvider.html5Mode({
|
||||
enabled: true,
|
||||
requireBase: false,
|
||||
});
|
||||
}]);
|
||||
|
||||
// copied from https://bitbucket.org/webarchive/ait5/src/master/archiveit/static/app/js/filters/ByteFormat.js
|
||||
brozzlerConsoleApp.filter("byteformat", function() {
|
||||
return function(bytes, precision) {
|
||||
var bytes_f = parseFloat(bytes);
|
||||
if (bytes_f == 0 || isNaN(bytes_f) || !isFinite(bytes_f)) return "0";
|
||||
if (bytes_f < 1024) return bytes_f.toFixed(0) + " bytes";
|
||||
if (typeof precision === "undefined") precision = 1;
|
||||
var units = ["bytes", "kB", "MB", "GB", "TB", "PB"];
|
||||
var number = Math.floor(Math.log(bytes_f) / Math.log(1024));
|
||||
var result = (bytes_f / Math.pow(1024, Math.floor(number))).toFixed(precision) + " " + units[number];
|
||||
return result;
|
||||
}
|
||||
return function(bytes, precision) {
|
||||
var bytes_f = parseFloat(bytes);
|
||||
if (bytes_f == 0 || isNaN(bytes_f) || !isFinite(bytes_f)) return "0";
|
||||
if (bytes_f < 1024) return bytes_f.toFixed(0) + " bytes";
|
||||
if (typeof precision === "undefined") precision = 1;
|
||||
var units = ["bytes", "kB", "MB", "GB", "TB", "PB"];
|
||||
var number = Math.floor(Math.log(bytes_f) / Math.log(1024));
|
||||
var result = (bytes_f / Math.pow(1024, Math.floor(number))).toFixed(precision) + " " + units[number];
|
||||
return result;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -3,91 +3,91 @@
|
|||
var brozzlerControllers = angular.module("brozzlerControllers", []);
|
||||
|
||||
brozzlerControllers.controller("JobsListController", ["$scope", "$http",
|
||||
function($scope, $http) {
|
||||
$http.get("/api/jobs").success(function(data) {
|
||||
$scope.jobs = data.jobs;
|
||||
});
|
||||
}]);
|
||||
function($scope, $http) {
|
||||
$http.get("/api/jobs").success(function(data) {
|
||||
$scope.jobs = data.jobs;
|
||||
});
|
||||
}]);
|
||||
|
||||
brozzlerControllers.controller("JobController", ["$scope", "$routeParams", "$http",
|
||||
function($scope, $routeParams, $http) {
|
||||
$http.get("/api/jobs/" + $routeParams.id).success(function(data) {
|
||||
$scope.job = data;
|
||||
$scope.job.page_count = $scope.job.queued_count = 0;
|
||||
console.log("job=", $scope.job);
|
||||
$http.get("/api/stats/" + $scope.job.conf.warcprox_meta.stats.buckets[0]).success(function(data) {
|
||||
$scope.job.stats = data;
|
||||
// console.log("job stats=", $scope.job.stats);
|
||||
});
|
||||
});
|
||||
function($scope, $routeParams, $http) {
|
||||
$http.get("/api/jobs/" + $routeParams.id).success(function(data) {
|
||||
$scope.job = data;
|
||||
$scope.job.page_count = $scope.job.queued_count = 0;
|
||||
console.log("job=", $scope.job);
|
||||
$http.get("/api/stats/" + $scope.job.conf.warcprox_meta.stats.buckets[0]).success(function(data) {
|
||||
$scope.job.stats = data;
|
||||
// console.log("job stats=", $scope.job.stats);
|
||||
});
|
||||
});
|
||||
|
||||
function statsSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/stats/" + bucket + " = ", data);
|
||||
site.stats = data;
|
||||
}
|
||||
}
|
||||
function statsSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/stats/" + bucket + " = ", data);
|
||||
site.stats = data;
|
||||
}
|
||||
}
|
||||
|
||||
function pageCountSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/sites/" + site.id + "/page_count = ", data);
|
||||
site.page_count = data.count;
|
||||
$scope.job.page_count += data.count;
|
||||
}
|
||||
}
|
||||
function pageCountSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/sites/" + site.id + "/page_count = ", data);
|
||||
site.page_count = data.count;
|
||||
$scope.job.page_count += data.count;
|
||||
}
|
||||
}
|
||||
|
||||
function queuedCountSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/sites/" + site.id + "/queued_count = ", data);
|
||||
site.queued_count = data.count;
|
||||
$scope.job.queued_count += data.count;
|
||||
}
|
||||
}
|
||||
function queuedCountSuccessCallback(site, bucket) {
|
||||
return function(data) {
|
||||
// console.log("site = ", site);
|
||||
// console.log("/api/sites/" + site.id + "/queued_count = ", data);
|
||||
site.queued_count = data.count;
|
||||
$scope.job.queued_count += data.count;
|
||||
}
|
||||
}
|
||||
|
||||
$http.get("/api/jobs/" + $routeParams.id + "/sites").success(function(data) {
|
||||
$scope.sites = data.sites;
|
||||
// console.log("sites=", $scope.sites);
|
||||
for (var i = 0; i < $scope.sites.length; i++) {
|
||||
var site = $scope.sites[i];
|
||||
$http.get("/api/sites/" + site.id + "/page_count").success(pageCountSuccessCallback(site, bucket));
|
||||
$http.get("/api/sites/" + site.id + "/queued_count").success(queuedCountSuccessCallback(site, bucket));
|
||||
$http.get("/api/jobs/" + $routeParams.id + "/sites").success(function(data) {
|
||||
$scope.sites = data.sites;
|
||||
// console.log("sites=", $scope.sites);
|
||||
for (var i = 0; i < $scope.sites.length; i++) {
|
||||
var site = $scope.sites[i];
|
||||
$http.get("/api/sites/" + site.id + "/page_count").success(pageCountSuccessCallback(site, bucket));
|
||||
$http.get("/api/sites/" + site.id + "/queued_count").success(queuedCountSuccessCallback(site, bucket));
|
||||
|
||||
// parse Warcprox-Meta to find stats bucket
|
||||
var warcprox_meta = angular.fromJson(site.extra_headers["Warcprox-Meta"]);
|
||||
for (var j = 0; j < warcprox_meta.stats.buckets.length; j++) {
|
||||
if (warcprox_meta.stats.buckets[j].indexOf("seed") >= 0) {
|
||||
var bucket = warcprox_meta.stats.buckets[j];
|
||||
// console.log("warcprox_meta.stats.buckets[" + j + "]=" + bucket);
|
||||
$http.get("/api/stats/" + bucket).success(statsSuccessCallback(site, bucket));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
// parse Warcprox-Meta to find stats bucket
|
||||
var warcprox_meta = angular.fromJson(site.extra_headers["Warcprox-Meta"]);
|
||||
for (var j = 0; j < warcprox_meta.stats.buckets.length; j++) {
|
||||
if (warcprox_meta.stats.buckets[j].indexOf("seed") >= 0) {
|
||||
var bucket = warcprox_meta.stats.buckets[j];
|
||||
// console.log("warcprox_meta.stats.buckets[" + j + "]=" + bucket);
|
||||
$http.get("/api/stats/" + bucket).success(statsSuccessCallback(site, bucket));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}]);
|
||||
|
||||
brozzlerControllers.controller("SiteController", ["$scope", "$routeParams", "$http",
|
||||
function($scope, $routeParams, $http) {
|
||||
$http.get("/api/site/" + $routeParams.id).success(function(data) {
|
||||
$scope.site = data;
|
||||
// console.log("site = ", $scope.site);
|
||||
});
|
||||
|
||||
$http.get("/api/site/" + $routeParams.id + "/pages?start=0&end=99").success(function(data) {
|
||||
$scope.pages = data.pages;
|
||||
// console.log("pages = ", $scope.pages);
|
||||
});
|
||||
}]);
|
||||
function($scope, $routeParams, $http) {
|
||||
$http.get("/api/site/" + $routeParams.id).success(function(data) {
|
||||
$scope.site = data;
|
||||
// console.log("site = ", $scope.site);
|
||||
});
|
||||
|
||||
$http.get("/api/site/" + $routeParams.id + "/pages?start=0&end=99").success(function(data) {
|
||||
$scope.pages = data.pages;
|
||||
// console.log("pages = ", $scope.pages);
|
||||
});
|
||||
}]);
|
||||
|
||||
/*
|
||||
$http.get("/api/site/" + $routeParams.id).then(function(response) {
|
||||
console.log("/api/site/" + $routeParams.id + " returned", response);
|
||||
$scope.site = response.data;
|
||||
return $http.get("/api/site/" + $routeParams.id + "/pages");
|
||||
}).then(function(response) {
|
||||
console.log("/api/site/" + $routeParams.id + "/pages returned", response);
|
||||
$scope.site.pages = response.data.pages;
|
||||
});
|
||||
*/
|
||||
$http.get("/api/site/" + $routeParams.id).then(function(response) {
|
||||
console.log("/api/site/" + $routeParams.id + " returned", response);
|
||||
$scope.site = response.data;
|
||||
return $http.get("/api/site/" + $routeParams.id + "/pages");
|
||||
}).then(function(response) {
|
||||
console.log("/api/site/" + $routeParams.id + "/pages returned", response);
|
||||
$scope.site.pages = response.data.pages;
|
||||
});
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue