Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 1a8f4704be1d24f6f48acc24a600b1b01c1dd5aa
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Wed May 28 16:53:58 2014 +0200
[frontend] monitor table design unified
---------------------------------------------------------------
frontend/coprs_frontend/coprs/models.py | 10 ++++++++++
frontend/coprs_frontend/coprs/static/copr.css | 3 ++-
.../templates/coprs/detail/_builds_table.html | 12 ++++++------
.../coprs/templates/coprs/detail/monitor.html | 14 +++++++++++---
.../coprs_frontend/coprs/templates/status.html | 10 +++++-----
.../coprs/views/coprs_ns/coprs_general.py | 6 +++++-
6 files changed, 39 insertions(+), 16 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/models.py
b/frontend/coprs_frontend/coprs/models.py
index 7d083be..519aac6 100644
--- a/frontend/coprs_frontend/coprs/models.py
+++ b/frontend/coprs_frontend/coprs/models.py
@@ -329,6 +329,16 @@ class MockChroot(db.Model, helpers.Serializer):
ver=self.os_version,
arch=self.arch)
+ @property
+ def os(self):
+ if self.os_version:
+ format_string = "{rel} {ver}"
+ else:
+ format_string = "{rel}"
+ return format_string.format(rel=self.os_release,
+ ver=self.os_version)
+
+
class CoprChroot(db.Model, helpers.Serializer):
diff --git a/frontend/coprs_frontend/coprs/static/copr.css
b/frontend/coprs_frontend/coprs/static/copr.css
index 1ef2090..baa56ef 100644
--- a/frontend/coprs_frontend/coprs/static/copr.css
+++ b/frontend/coprs_frontend/coprs/static/copr.css
@@ -303,6 +303,7 @@ table.builds-table tr.details {
table.status-table {
width: 100%;
+ text-align: center;
}
table.status-table tr:nth-child(odd) {
@@ -313,7 +314,7 @@ table.status-table tr:nth-child(even) {
background-color: #eee;
}
-table.status-table tr:first-child {
+table.status-table th {
color: #fff;
background-color: #1f4b89;
}
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
b/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
index d5751fb..2c1eae2 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/_builds_table.html
@@ -12,17 +12,17 @@
</tr>
{% for build in builds %}
<tr class="build-row build-row-{{ build.state }}" >
- <th><a href="{{url_for("coprs_ns.copr_build", username =
build.copr.owner.name, coprname = build.copr.name, build_id = build.id)}}">{{
build.id }}</a></th>
- <th>{{ build.pkgs|pkg_name }}</th>
- <th>
+ <td><a href="{{url_for("coprs_ns.copr_build", username =
build.copr.owner.name, coprname = build.copr.name, build_id = build.id)}}">{{
build.id }}</a></td>
+ <td>{{ build.pkgs|pkg_name }}</td>
+ <td>
{% if g.user %}
{{ build.submitted_on|localized_time(g.user.timezone) }}
{% else %}
{{ build.submitted_on|localized_time("UTC") }}
{% endif %}
- </th>
- <th> {{ build.started_on|time_ago(build.ended_on) }} </th>
- <th class="build-{{ build.state }}">{{ build.state }}</th>
+ </td>
+ <td> {{ build.started_on|time_ago(build.ended_on) }} </td>
+ <td class="build-{{ build.state }}">{{ build.state }}</td>
</tr>
{% endfor %}
</table>
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
index a2d9ab6..d0bbac1 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/detail/monitor.html
@@ -8,10 +8,18 @@
Latest build status:
<strong>{{ build.state }}</strong>
</p>
- <table class="monitor">
+ <table class="status-table">
+ <tr></tr>
<tr>
- <th>Package</th>
- {% for chroot in chroots %}
+ <th rowspan="2">Packages</th>
+ {% for i, chroot in oses %}
+ <th colspan="{{i}}">
+ {{ chroot|capitalize }}
+ </th>
+ {% endfor %}
+ </tr>
+ <tr>
+ {% for chroot in archs %}
<th>
{{ chroot }}
</th>
diff --git a/frontend/coprs_frontend/coprs/templates/status.html
b/frontend/coprs_frontend/coprs/templates/status.html
index f7d1f48..2f5f107 100644
--- a/frontend/coprs_frontend/coprs/templates/status.html
+++ b/frontend/coprs_frontend/coprs/templates/status.html
@@ -22,14 +22,14 @@
</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%}
+ <td>{{ build.time | time_ago }}</td>
+ <td><a href="{{ url_for('coprs_ns.copr_detail',
username = build.owner, coprname = build.copr)
}}">{{build.owner}}/{{build.copr}}</a></td>
+ <td>{%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>
+ </td>
+ <td>{{ build.chroot }}</td>
</tr>
{% endfor %}
</table>
diff --git a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
index 2d3f474..f51f7e1 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -7,6 +7,7 @@ import platform
import smtplib
import sqlalchemy
from email.mime.text import MIMEText
+from itertools import groupby
from coprs import app
from coprs import db
@@ -544,6 +545,9 @@ def copr_build_monitor(username, coprname):
out = {}
build = None
chroots = set([chroot.name for chroot in copr.active_chroots])
+ oses = [chroot.os for chroot in copr.active_chroots]
+ oses_grouped = [(len(list(group)),key) for key, group in groupby(oses)]
+ archs = [chroot.arch for chroot in copr.active_chroots]
latest_build = None
if builds:
@@ -575,6 +579,6 @@ def copr_build_monitor(username, coprname):
return flask.render_template("coprs/detail/monitor.html",
copr=copr,
build=latest_build,
- chroots=chroots,
+ chroots=chroots, oses = oses_grouped, archs = archs,
packages=sorted(out.iteritems()),
form=form)