Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 3aa0fc8d780e47a8a44e5c3cad2a0160451c585c
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Tue Mar 18 14:33:10 2014 +0100
status page finished
---------------------------------------------------------------
frontend/coprs_frontend/coprs/filters.py | 17 +++++++++
.../coprs_frontend/coprs/templates/coprs/show.html | 4 ++
.../coprs_frontend/coprs/templates/status.html | 37 ++++++++++++++++++++
3 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/filters.py
b/frontend/coprs_frontend/coprs/filters.py
index 6a3432e..d079123 100644
--- a/frontend/coprs_frontend/coprs/filters.py
+++ b/frontend/coprs_frontend/coprs/filters.py
@@ -54,6 +54,23 @@ def localized_time(time_in, timezone):
return dt_my_tz.strftime(format_tz)
+(a)app.template_filter('time_ago')
+def time_ago(time_in):
+ """ returns string saying how long ago the time on input was
+
+ Input is in EPOCH (seconds since epoch).
+ """
+ now = datetime.datetime.now()
+ diff = now - datetime.datetime.fromtimestamp(time_in)
+ secdiff = diff.seconds
+ if secdiff < 120:
+ return "1 minute"
+ elif secdiff < 7200:
+ return str(secdiff/60) + " minutes"
+ else:
+ return str(secdiff/3600) + "hours"
+
+
@app.template_filter("markdown")
def markdown_filter(data):
if not data:
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/show.html
b/frontend/coprs_frontend/coprs/templates/coprs/show.html
index a3d041e..c64f765 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/show.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/show.html
@@ -13,6 +13,10 @@
<a href="{{ url_for('coprs_ns.coprs_by_owner',
username=g.user.name) }}" title="My Projects">{{ g.user.coprs_count
}}</a>
</p>
<p class="other-text">projects</p>
+ <hr>
+ <p class="coprs-count">
+ <a href="{{url_for("status_ns.status_home")}}">Copr
status</a>
+ </p>
</div>
{% endif %}
{% if not g.user and not fulltext%}
diff --git a/frontend/coprs_frontend/coprs/templates/status.html
b/frontend/coprs_frontend/coprs/templates/status.html
new file mode 100644
index 0000000..f7d1f48
--- /dev/null
+++ b/frontend/coprs_frontend/coprs/templates/status.html
@@ -0,0 +1,37 @@
+{% extends "layout.html" %}
+{% block title %} Copr status {% endblock %}
+{% block header %} Copr status {% endblock %}
+{% block body %}
+<h1>{%if number == 0:%}
+ No tasks
+ {%elif number == 1:%}
+ {{number}} task
+ {%else%}
+ {{number}} tasks
+ {%endif%}
+ in queue
+</h1>
+
+ </h2>
+<table class="status-table">
+ <tr>
+ <th>Waiting</th>
+ <th>Project</th>
+ <th>Packages</th>
+ <th>Chroot</th>
+ </tr>
+ {% for build in builds %}
+ <tr>
+ <th>{{ build.time | time_ago }}</th>
+ <th><a href="{{ url_for('coprs_ns.copr_detail',
username = build.owner, coprname = build.copr)
}}">{{build.owner}}/{{build.copr}}</a></th>
+ <th>{%for pkg in build.pkgs[0:2]:%}{{pkg}}<br>{%endfor%}
+ {%if build.pkgs|length > 2:%}
+ ...{{build.pkgs|length}} more
+ {%endif%}
+ </th>
+ <th>{{ build.chroot }}</th>
+ </tr>
+ {% endfor %}
+</table>
+
+{% endblock %}