From ffacdabb4e94d875747872319725f5f384038e4e Mon Sep 17 00:00:00 2001 From: James Turk Date: Thu, 4 Aug 2011 22:11:14 -0400 Subject: [PATCH] index --- oyster/templates/base.html | 2 +- oyster/templates/index.html | 33 +++++++++++++++++++++++++++++++++ oyster/templates/log_row.html | 7 +++++++ oyster/templates/logs.html | 7 +------ oyster/web.py | 12 ++++++++++++ 5 files changed, 54 insertions(+), 7 deletions(-) create mode 100644 oyster/templates/index.html create mode 100644 oyster/templates/log_row.html diff --git a/oyster/templates/base.html b/oyster/templates/base.html index dd17f28..2a3762e 100644 --- a/oyster/templates/base.html +++ b/oyster/templates/base.html @@ -25,7 +25,7 @@ {% endblock heading %} -
+
{% block body %} {% endblock %}
diff --git a/oyster/templates/index.html b/oyster/templates/index.html new file mode 100644 index 0000000..0501831 --- /dev/null +++ b/oyster/templates/index.html @@ -0,0 +1,33 @@ +{% extends "base.html" %} + +{% block heading %} +oyster +{% endblock %} + +{% block body %} + +
+

Stats

+
+
Queue Size
{{queue_size}}
+
Tracking
{{tracking}}
+
Need Update
{{need_update}}
+
+
+ +
+

Logs

+ + + + + + + + {% for log in logs %} + {% include "log_row.html" %} + {% endfor %} +
actiondescriptiontimestamp 
+
+ +{% endblock %} diff --git a/oyster/templates/log_row.html b/oyster/templates/log_row.html new file mode 100644 index 0000000..d4930cd --- /dev/null +++ b/oyster/templates/log_row.html @@ -0,0 +1,7 @@ + + + {{log.action}} + {{log.url}} + {{log.timestamp}} + {% if log.error %}{{log.error}}{% endif %} + diff --git a/oyster/templates/logs.html b/oyster/templates/logs.html index e3c2cbe..7e3b009 100644 --- a/oyster/templates/logs.html +++ b/oyster/templates/logs.html @@ -28,12 +28,7 @@ Oyster Logs   {% for log in logs %} - - {{log.action}} - {{log.url}} - {{log.timestamp}} - {% if log.error %}{{log.error}}{% endif %} - + {% include "log_row.html" %} {% endfor %}
diff --git a/oyster/web.py b/oyster/web.py index 2576b6b..1ae9669 100644 --- a/oyster/web.py +++ b/oyster/web.py @@ -36,6 +36,18 @@ app = flask.Flask('oyster') client = Client() +@app.route('/') +@api_wrapper('index.html') +def index(): + status = { + 'queue_size': app.work_queue.qsize(), + 'tracking': client.db.tracked.count(), + 'need_update': client.get_update_queue_size(), + 'logs': client.db.logs.find().sort('$natural', -1).limit(20) + } + return status + + @app.route('/status/') @api_wrapper() def doc_list():