mirror of
https://github.com/internetarchive/brozzler.git
synced 2025-02-24 08:39:59 -05:00
twirldown for site yaml on site page
This commit is contained in:
parent
f825e76371
commit
1a7b94cae7
@ -48,7 +48,6 @@ app = flask.Flask(__name__)
|
|||||||
gunicorn_error_logger = logging.getLogger('gunicorn.error')
|
gunicorn_error_logger = logging.getLogger('gunicorn.error')
|
||||||
app.logger.handlers.extend(gunicorn_error_logger.handlers)
|
app.logger.handlers.extend(gunicorn_error_logger.handlers)
|
||||||
app.logger.setLevel(logging.INFO)
|
app.logger.setLevel(logging.INFO)
|
||||||
app.logger.info('will this show in the log?')
|
|
||||||
|
|
||||||
# configure with environment variables
|
# configure with environment variables
|
||||||
SETTINGS = {
|
SETTINGS = {
|
||||||
@ -99,18 +98,39 @@ def pages(site_id):
|
|||||||
app.logger.info("flask.request.args=%s", flask.request.args)
|
app.logger.info("flask.request.args=%s", flask.request.args)
|
||||||
start = int(flask.request.args.get("start", 0))
|
start = int(flask.request.args.get("start", 0))
|
||||||
end = int(flask.request.args.get("end", start + 90))
|
end = int(flask.request.args.get("end", start + 90))
|
||||||
app.logger.info("yes new query")
|
|
||||||
pages_ = r.table("pages").between(
|
pages_ = r.table("pages").between(
|
||||||
[site_id, 1, r.minval], [site_id, r.maxval, r.maxval],
|
[site_id, 1, r.minval], [site_id, r.maxval, r.maxval],
|
||||||
index="least_hops").order_by(index="least_hops")[start:end].run()
|
index="least_hops").order_by(index="least_hops")[start:end].run()
|
||||||
return flask.jsonify(pages=list(pages_))
|
return flask.jsonify(pages=list(pages_))
|
||||||
|
|
||||||
|
@app.route("/api/pages/<page_id>")
|
||||||
|
@app.route("/api/page/<page_id>")
|
||||||
|
def page(page_id):
|
||||||
|
page_ = r.table("pages").get(page_id).run()
|
||||||
|
return flask.jsonify(page_)
|
||||||
|
|
||||||
|
@app.route("/api/pages/<page_id>/yaml")
|
||||||
|
@app.route("/api/page/<page_id>/yaml")
|
||||||
|
def page_yaml(page_id):
|
||||||
|
page_ = r.table("pages").get(page_id).run()
|
||||||
|
return app.response_class(
|
||||||
|
yaml.dump(page_, default_flow_style=False),
|
||||||
|
mimetype='application/yaml')
|
||||||
|
|
||||||
@app.route("/api/sites/<site_id>")
|
@app.route("/api/sites/<site_id>")
|
||||||
@app.route("/api/site/<site_id>")
|
@app.route("/api/site/<site_id>")
|
||||||
def site(site_id):
|
def site(site_id):
|
||||||
site_ = r.table("sites").get(site_id).run()
|
site_ = r.table("sites").get(site_id).run()
|
||||||
return flask.jsonify(site_)
|
return flask.jsonify(site_)
|
||||||
|
|
||||||
|
@app.route("/api/sites/<site_id>/yaml")
|
||||||
|
@app.route("/api/site/<site_id>/yaml")
|
||||||
|
def site_yaml(site_id):
|
||||||
|
site_ = r.table("sites").get(site_id).run()
|
||||||
|
return app.response_class(
|
||||||
|
yaml.dump(site_, default_flow_style=False),
|
||||||
|
mimetype='application/yaml')
|
||||||
|
|
||||||
@app.route("/api/stats/<bucket>")
|
@app.route("/api/stats/<bucket>")
|
||||||
def stats(bucket):
|
def stats(bucket):
|
||||||
stats_ = r.table("stats").get(bucket).run()
|
stats_ = r.table("stats").get(bucket).run()
|
||||||
|
@ -208,6 +208,9 @@ brozzlerControllers.controller("SiteController", ["$scope", "$routeParams", "$ht
|
|||||||
loadSiteStats($http, $scope.site);
|
loadSiteStats($http, $scope.site);
|
||||||
// console.log("site = ", $scope.site);
|
// console.log("site = ", $scope.site);
|
||||||
});
|
});
|
||||||
|
$http.get("/api/site/" + $routeParams.id + "/yaml").success(function(data) {
|
||||||
|
$scope.site_yaml = data;
|
||||||
|
});
|
||||||
|
|
||||||
loadMorePages();
|
loadMorePages();
|
||||||
}]);
|
}]);
|
||||||
|
@ -11,7 +11,12 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<h2>Site {{site.seed}} (Job <a href="/jobs/{{site.job_id}}">{{site.job_id}}</a>)</h2>
|
<h2 ng-click="show_yaml = !show_yaml">
|
||||||
|
<span class="fa fa-caret-right"
|
||||||
|
ng-class="{ 'fa-caret-right': !show_yaml, 'fa-caret-down': !!show_yaml }"></span>
|
||||||
|
Site {{site.seed}} (Job <a href="/jobs/{{site.job_id}}">{{site.job_id}}</a>)
|
||||||
|
</h2>
|
||||||
|
<pre style="display:{{show_yaml?'block':'none'}}">{{site_yaml}}</pre>
|
||||||
|
|
||||||
<div class="row bigstats">
|
<div class="row bigstats">
|
||||||
<div class="col-sm-6 col-md-3">
|
<div class="col-sm-6 col-md-3">
|
||||||
|
2
setup.py
2
setup.py
@ -21,7 +21,7 @@ import setuptools
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name='brozzler',
|
name='brozzler',
|
||||||
version='1.1b3.dev45',
|
version='1.1b3.dev46',
|
||||||
description='Distributed web crawling with browsers',
|
description='Distributed web crawling with browsers',
|
||||||
url='https://github.com/internetarchive/brozzler',
|
url='https://github.com/internetarchive/brozzler',
|
||||||
author='Noah Levitt',
|
author='Noah Levitt',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user