Repository :
http://git.fedorahosted.org/cgit/copr.git
On branch : master
---------------------------------------------------------------
commit 0ba2efaa9971a1aeaf4079221058ef916c90be69
Author: Adam Samalik <asamalik(a)redhat.com>
Date: Thu Aug 28 17:31:05 2014 +0200
[frontend] recent builds on the home page
---------------------------------------------------------------
frontend/coprs_frontend/coprs/static/copr.css | 32 +++++++++---
.../coprs_frontend/coprs/templates/coprs/show.html | 56 ++++++++++++--------
.../coprs/views/coprs_ns/coprs_general.py | 24 ++++++---
3 files changed, 75 insertions(+), 37 deletions(-)
diff --git a/frontend/coprs_frontend/coprs/static/copr.css
b/frontend/coprs_frontend/coprs/static/copr.css
index df9e141..d78df1e 100644
--- a/frontend/coprs_frontend/coprs/static/copr.css
+++ b/frontend/coprs_frontend/coprs/static/copr.css
@@ -48,21 +48,38 @@ div.left-side-space {
}
div.left-side-space div {
- margin-top: 30px;
+ margin-top: 15px;
+ margin-bottom: 15px;
+ text-overflow: ellipsis;
+ overflow: hidden;
+ //border-top: 1px solid #ddd;
}
-div.left-side-space div a{
- font-size: 1.1em;
+div.left-side-space div div {
+ border: none;
+ margin-top: 0px;
+ //background-color: #f9f9f9;
+}
+
+div.left-side-space div a.menu {
+ font-size: 1.2em;
font-weight: bold;
+ //background-color: #ececec;
+ display: block;
+ margin-bottom: 8px;
}
-div.left-side-space div div.recent{
- margin-top: 10px;
+div.left-side-space div div.recent {
+ margin-bottom: 15px;
+ margin-top: 0px;
}
div.left-side-space div div.recent a {
- font-size: 1.3em;
- font-weight: normal;
+ font-size: 1em;
+}
+
+div.left-side-space div div.recent span.head {
+ font-weight: bold;
}
div.left-side-space div div.recent span.time {
@@ -153,6 +170,7 @@ div.about-copr {
background-color: #ececec;
padding-top: 1em;
padding-bottom: 1em;
+ margin-bottom: 1em;
border-radius: 5px;
-moz-border-radius: 5px;
diff --git a/frontend/coprs_frontend/coprs/templates/coprs/show.html
b/frontend/coprs_frontend/coprs/templates/coprs/show.html
index 517bbca..682d131 100644
--- a/frontend/coprs_frontend/coprs/templates/coprs/show.html
+++ b/frontend/coprs_frontend/coprs/templates/coprs/show.html
@@ -3,8 +3,20 @@
{% block header %}Project List{% endblock %}
{% from "_helpers.html" import render_pagination %}
{% block body %}
- {% if g.user %}
+ {% if not g.user and not fulltext%}
+ <div class="about-copr">
+ <p>Copr is an easy-to-use automatic build system providing a package
repository as its output.</p>
+ <p>Start with making your own repository in these three
steps:</p>
+ <ol>
+ <li>choose an architecture and system you want to build
for</li>
+ <li>provide Copr with src.rpm packages available online</li>
+ <li>let Copr do all the work and wait for your new repo</li>
+ </ol>
+ <p>For more information please visit <a
href="https://fedorahosted.org/copr/">Copr wiki</a></p>
+ </div>
+ {% endif %}
<div class="user-info">
+ {% if g.user %}
<a href="{{ url_for('coprs_ns.coprs_by_owner', username=g.user.name)
}}" title="My Projects">
<img src="{{ g.user.gravatar_url }}" alt="User Image">
</a>
@@ -13,17 +25,33 @@
<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>
+ {% endif %}
<div class="left-side-space">
<div>
- <a href="{{url_for('status_ns.waiting')}}">Copr
status</a>
+ <a class="menu"
href="{{url_for('status_ns.waiting')}}">Task queue</a>
+ <div>
+ {% if running_tasks: %}
+ {{running_tasks}}
+ {% else: %}
+ No
+ {% endif %} running <br>
+ {% if waiting_tasks: %}
+ {{waiting_tasks}}
+ {% else: %}
+ No
+ {% endif %} waiting
+ </div>
</div>
<div>
- <a href="{{url_for('recent_ns.recent')}}">My finished
builds</a>
+ <a class="menu"
href="{{url_for('recent_ns.recent')}}">
+ {% if g.user: %} My recent builds {% else %} Recent builds {% endif %}
+ </a>
{% if users_builds: %}
{% for build in users_builds: %}
<div class="recent">
- <a href="{{url_for("coprs_ns.copr_build",
username = build.copr.owner.name, coprname = build.copr.name, build_id =
build.id)}}">{{build.id}}</a> <span class="build
build-{{build.state}}">{{build.state}} </span><br>
- {{build.pkgs | pkg_name}} <br>
+ <span class="head">
+ <a href="{{url_for("coprs_ns.copr_build",
username = build.copr.owner.name, coprname = build.copr.name, build_id =
build.id)}}">{{build.id}}</a> - <span class="build
build-{{build.state}}">{{build.state}} </span></span><br>
+ <span> {{build.pkgs | pkg_name}} </span> <br>
<span class="time">{{build.ended_on|time_ago()}}
ago</span>
</div>
{% endfor %}
@@ -31,23 +59,7 @@
</div>
</div>
</div>
- {% endif %}
- {% if not g.user and not fulltext%}
- <div class="about-copr">
- <p>Copr is an easy-to-use automatic build system providing a package
repository as its output.</p>
- <p>Start with making your own repository in these three
steps:</p>
- <ol>
- <li>choose an architecture and system you want to build
for</li>
- <li>provide Copr with src.rpm packages available online</li>
- <li>let Copr do all the work and wait for your new repo</li>
- </ol>
- <p>For more information please visit <a
href="https://fedorahosted.org/copr/">Copr wiki</a></p>
- </div>
- {% endif %}
- <div class="pagination">
- {{ render_pagination(request, paginator) }}
- </div>
- <div class="coprs-list-{% if g.user %}thin{% else %}thick{% endif %}">
+ <div class="coprs-list-{% if g.user %}thin{% else %}thin{% endif %}">
{% if g.user %}
<div class="add-copr">+
<a href="{{url_for('coprs_ns.copr_add', username=g.user.name)
}}">
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 bb8d11b..ed7d9ca 100644
--- a/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
+++ b/frontend/coprs_frontend/coprs/views/coprs_ns/coprs_general.py
@@ -34,14 +34,18 @@ def coprs_show(page=1):
coprs = paginator.sliced_query
- if flask.g.user:
- users_builds = builds_logic.BuildsLogic.get_recent_tasks(flask.g.user, 5)
- else:
- users_builds = []
+ # flask.g.user is none when no user is logged - showing builds from everyone
+ users_builds = builds_logic.BuildsLogic.get_recent_tasks(flask.g.user, 5)
+
+ waiting_tasks = len(list(builds_logic.BuildsLogic.get_build_task_queue()))
+ running_tasks = len(list(builds_logic.BuildsLogic.get_build_tasks(
+ helpers.StatusEnum("running"))))
return flask.render_template("coprs/show.html",
coprs=coprs,
paginator=paginator,
+ waiting_tasks=waiting_tasks,
+ running_tasks=running_tasks,
users_builds=users_builds)
@@ -57,14 +61,18 @@ def coprs_by_owner(username=None, page=1):
coprs = paginator.sliced_query
- if flask.g.user:
- users_builds = builds_logic.BuildsLogic.get_recent_tasks(flask.g.user, 5)
- else:
- users_builds = []
+ # flask.g.user is none when no user is logged - showing builds from everyone
+ users_builds = builds_logic.BuildsLogic.get_recent_tasks(flask.g.user, 5)
+
+ waiting_tasks = len(list(builds_logic.BuildsLogic.get_build_task_queue()))
+ running_tasks = len(list(builds_logic.BuildsLogic.get_build_tasks(
+ helpers.StatusEnum("running"))))
return flask.render_template("coprs/show.html",
coprs=coprs,
paginator=paginator,
+ waiting_tasks=waiting_tasks,
+ running_tasks=running_tasks,
users_builds=users_builds)