mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 00:29:53 -05:00
list jobless sites on brozzler-webconsole front page
This commit is contained in:
parent
4fa1571bc5
commit
94a8e70226
@ -27,7 +27,6 @@ except ImportError as e:
|
||||
'brozzler[webconsole]".\nSee README.rst for more information.',
|
||||
type(e).__name__, e)
|
||||
sys.exit(1)
|
||||
|
||||
import rethinkstuff
|
||||
import json
|
||||
import os
|
||||
@ -149,6 +148,16 @@ def sites(job_id):
|
||||
s["cookie_db"] = base64.b64encode(s["cookie_db"]).decode("ascii")
|
||||
return flask.jsonify(sites=sites_)
|
||||
|
||||
@app.route("/api/jobless-sites")
|
||||
def jobless_sites():
|
||||
# XXX inefficient (unindexed) query
|
||||
sites_ = list(r.table("sites").filter(~r.row.has_fields("job_id")).run())
|
||||
# TypeError: <binary, 7168 bytes, '53 51 4c 69 74 65...'> is not JSON serializable
|
||||
for s in sites_:
|
||||
if "cookie_db" in s:
|
||||
s["cookie_db"] = base64.b64encode(s["cookie_db"]).decode("ascii")
|
||||
return flask.jsonify(sites=sites_)
|
||||
|
||||
@app.route("/api/jobs/<int:job_id>")
|
||||
@app.route("/api/job/<int:job_id>")
|
||||
def job(job_id):
|
||||
|
@ -79,6 +79,9 @@ brozzlerControllers.controller("HomeController", ["$scope", "$http",
|
||||
$http.get("/api/services").success(function(data) {
|
||||
$scope.services = data.services;
|
||||
});
|
||||
$http.get("/api/jobless-sites").success(function(data) {
|
||||
$scope.joblessSites = data.sites;
|
||||
});
|
||||
}]);
|
||||
|
||||
brozzlerControllers.controller("WorkersListController", ["$scope", "$http",
|
||||
|
@ -41,7 +41,6 @@
|
||||
</div>
|
||||
|
||||
<h2>Jobs</h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-striped">
|
||||
@ -66,4 +65,23 @@
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h2>Jobless Sites</h2>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>id</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr ng-repeat="site in joblessSites">
|
||||
<td><a href="/sites/{{site.id}}">{{site.id}}</a></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user