This commit is contained in:
James Turk 2011-08-04 22:11:14 -04:00
parent 512a5f8e55
commit ffacdabb4e
5 changed files with 54 additions and 7 deletions

View File

@ -25,7 +25,7 @@
{% endblock heading %}
</h1>
</div>
<div class="span-18">
<div class="span-20 prepend-2">
{% block body %}
{% endblock %}
</div>

View File

@ -0,0 +1,33 @@
{% extends "base.html" %}
{% block heading %}
oyster
{% endblock %}
{% block body %}
<div class="span-4">
<h2>Stats</h2>
<dl>
<dt>Queue Size</dt><dd>{{queue_size}}</dd>
<dt>Tracking</dt><dd>{{tracking}}</dd>
<dt>Need Update</dt><dd>{{need_update}}</dd>
</dl>
</div>
<div class="span-12 prepend-2 last">
<h2>Logs</h2>
<table>
<tr>
<th>action</th>
<th>description</th>
<th>timestamp</th>
<th>&nbsp;</th>
</tr>
{% for log in logs %}
{% include "log_row.html" %}
{% endfor %}
</table>
</div>
{% endblock %}

View File

@ -0,0 +1,7 @@
<tr{% if log.error %} class="error" {% endif %}>
<td>{{log.action}}</td>
<td><a href="/tracked/{{log.url}}">{{log.url}}</td>
<td>{{log.timestamp}}</td>
<td>{% if log.error %}{{log.error}}{% endif %}</td>
</tr>

View File

@ -28,12 +28,7 @@ Oyster Logs
<th>&nbsp;</th>
</tr>
{% for log in logs %}
<tr{% if log.error %} class="error" {% endif %}>
<td>{{log.action}}</td>
<td><a href="/tracked/{{log.url}}">{{log.url}}</td>
<td>{{log.timestamp}}</td>
<td>{% if log.error %}{{log.error}}{% endif %}</td>
</tr>
{% include "log_row.html" %}
{% endfor %}
</table>
</div>

View File

@ -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():