[Pkg-debile-commits] [debile-web] 03/03: Improve the choices of source/job lists
Jon Severinsson
jonno-guest at moszumanska.debian.org
Sun Mar 30 15:37:47 UTC 2014
This is an automated email from the git hooks/post-receive script.
jonno-guest pushed a commit to branch master
in repository debile-web.
commit 0dc68664c8f7813f19f20347e1d9300d6fa30b69
Author: Jon Severinsson <jon at severinsson.net>
Date: Sun Mar 30 16:47:15 2014 +0200
Improve the choices of source/job lists
---
debileweb/blueprints/frontend.py | 126 +++++++++++++++++++++++++++++++++++----
templates/index.html | 15 +++--
templates/jobs.html | 10 ++--
templates/sources.html | 10 ++--
4 files changed, 135 insertions(+), 26 deletions(-)
diff --git a/debileweb/blueprints/frontend.py b/debileweb/blueprints/frontend.py
index 3a53e80..8466ff4 100644
--- a/debileweb/blueprints/frontend.py
+++ b/debileweb/blueprints/frontend.py
@@ -93,15 +93,49 @@ def index():
info['jobs_info'] = jobs_info
builders_info.append(info)
- pending_jobs = session.query(Job).filter(
+ info = {}
+ info['unfinished_sources'] = session.query(Source).filter(
+ Source.jobs.any(Job.finished_at == None),
+ ).count()
+ info['queued_sources'] = session.query(Source).filter(
+ Source.jobs.any(
+ ~Job.depedencies.any() &
+ (Job.externally_blocked == False) &
+ (Job.assigned_at == None)
+ ),
+ ).count()
+ info['unbuilt_sources'] = session.query(Source).filter(
+ Source.jobs.any(
+ Job.check.has(Check.build == True) &
+ (Job.finished_at == None)
+ ),
+ ).count()
+ info['failed_sources'] = session.query(Source).filter(
+ Source.jobs.any(Job.failed == True),
+ ).count()
+
+ info['unfinished_jobs'] = session.query(Job).filter(
+ Job.finished_at == None,
+ ).count()
+ info['queued_jobs'] = session.query(Job).filter(
+ ~Job.depedencies.any(),
+ Job.externally_blocked == False,
Job.assigned_at == None,
).count()
+ info['unbuilt_jobs'] = session.query(Job).filter(
+ Job.check.has(Check.build == True),
+ Job.finished_at == None,
+ ).count()
+ info['failed_jobs'] = session.query(Job).filter(
+ Job.failed == True,
+ ).count()
+
form = SearchPackageForm()
return render_template('index.html', **{
"groups_info": groups_info,
"builders_info": builders_info,
- "pending_jobs": pending_jobs,
+ "info": info,
"prefixes": PREFIXES,
"form": form
})
@@ -135,7 +169,7 @@ def sources(search="", prefix="recent", page=0):
Source.uploaded_at.desc(),
)
elif request.path.startswith("/source/"):
- desc = "Search results for source '%s'" % search
+ desc = "Search results for source package '%s'" % search
query = session.query(Source).filter(
Source.name.contains(search),
).order_by(
@@ -143,18 +177,49 @@ def sources(search="", prefix="recent", page=0):
Source.uploaded_at.desc(),
)
elif prefix == "recent":
- desc = "All recent sources."
+ desc = "All recently uploaded source packages."
query = session.query(Source).order_by(
Source.uploaded_at.desc(),
)
- elif prefix == "incomplete":
- desc = "All incomplete sources."
+ elif prefix == "unfinished":
+ desc = "All source packages with unfinished jobs."
query = session.query(Source).filter(
Source.jobs.any(Job.finished_at == None),
).order_by(
Source.name.asc(),
Source.uploaded_at.desc(),
)
+ elif prefix == "queued":
+ desc = "All source packages with jobs in the queue."
+ query = session.query(Source).filter(
+ Source.jobs.any(
+ ~Job.depedencies.any() &
+ (Job.externally_blocked == False) &
+ (Job.assigned_at == None)
+ ),
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ )
+ elif prefix == "unbuilt":
+ desc = "All source packages with unbuild build jobs."
+ query = session.query(Source).filter(
+ Source.jobs.any(
+ Job.check.has(Check.build == True) &
+ (Job.finished_at == None)
+ ),
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ )
+ elif prefix == "failed":
+ desc = "All source packages with failed jobs."
+ query = session.query(Source).filter(
+ Source.jobs.any(Job.failed == True),
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ )
elif prefix == "l":
desc = "All sources for packages beginning with 'l'"
query = session.query(Source).filter(
@@ -207,14 +272,53 @@ def jobs(prefix="recent", page=0):
session = make_session()
if prefix == "recent":
- desc = "All recent jobs."
- query = session.query(Job).join(Job.source).order_by(
+ desc = "All recently uploaded jobs."
+ query = session.query(Source).join(Job.source).join(Job.check).order_by(
Source.uploaded_at.desc(),
+ Check.build.desc(),
+ Check.id.asc(),
+ Job.id.asc(),
+ )
+ elif prefix == "unfinished":
+ desc = "All unfinished jobs."
+ query = session.query(Job).join(Job.source).join(Job.check).filter(
+ Job.finished_at == None,
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ Check.build.desc(),
+ Check.id.asc(),
+ Job.id.asc(),
+ )
+ elif prefix == "queued":
+ desc = "All jobs in the queue."
+ query = session.query(Job).join(Job.source).join(Job.check).filter(
+ Job.externally_blocked == False,
+ ~Job.depedencies.any(),
+ Job.assigned_at == None,
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ Check.build.desc(),
+ Check.id.asc(),
+ Job.id.asc(),
+ )
+ elif prefix == "unbuilt":
+ desc = "All unbuild build jobs."
+ query = session.query(Job).join(Job.source).join(Job.check).filter(
+ Job.check.has(Check.build == True),
+ Job.finished_at == None,
+ ).order_by(
+ Source.name.asc(),
+ Source.uploaded_at.desc(),
+ Check.build.desc(),
+ Check.id.asc(),
+ Job.id.asc(),
)
- elif prefix == "incomplete":
- desc = "All incomplete jobs."
+ elif prefix == "failed":
+ desc = "All failed jobs."
query = session.query(Job).join(Job.source).join(Job.check).filter(
- Job.finished_at == None
+ Job.failed == True,
).order_by(
Source.name.asc(),
Source.uploaded_at.desc(),
diff --git a/templates/index.html b/templates/index.html
index 911e38e..f717d7f 100644
--- a/templates/index.html
+++ b/templates/index.html
@@ -10,13 +10,18 @@
{% include "builder_list_fragment.html" %}
<h1>Jobs</h1>
-List all <a href='/jobs/incomplete'>incomplete jobs</a><br />
-List all <a href='/jobs/recent'>recent jobs</a><br />
-There are currently {{pending_jobs}} jobs to assign.<br />
+List all <a href='/jobs/recent'>recently uploaded</a> jobs<br />
+List all <a href='/jobs/unfinished'>unfinished</a> jobs ({{info.unfinished_jobs}})<br />
+List all <a href='/jobs/queued'>queued</a> jobs ({{info.queued_jobs}})<br />
+List all <a href='/jobs/unbuilt'>unbuilt</a> jobs ({{info.unbuilt_jobs}})<br />
+List all <a href='/jobs/failed'>failed</a> jobs ({{info.failed_jobs}})<br />
<h1>Sources</h1>
-List all <a href='/sources/incomplete'>incomplete uploads</a><br />
-List all <a href='/sources/recent'>recent uploads</a><br />
+List all <a href='/sources/recent'>recently uploaded</a> source packages<br />
+List all source packages with <a href='/sources/unfinished'>unfinished</a> jobs ({{info.unfinished_sources}})<br />
+List all source packages with <a href='/sources/queued'>queued</a> jobs ({{info.queued_sources}})<br />
+List all source packages with <a href='/sources/unbuilt'>unbuilt</a> jobs ({{info.unbuilt_sources}})<br />
+List all source packages with <a href='/sources/failed'>failed</a> jobs ({{info.failed_sources}})<br />
<h3>Browse Sources by Prefix:</h3>
{% for prefix in prefixes %}
diff --git a/templates/jobs.html b/templates/jobs.html
index e461ec9..1ee8b27 100644
--- a/templates/jobs.html
+++ b/templates/jobs.html
@@ -5,11 +5,11 @@
{% block content %}
<div class='block'>
<h1>Job list</h1>
- {% if info.desc %}{{info.desc}}{% endif %}
-
- {% if info.prev_link %}<a class='left' href='{{info.prev_link}}'>previous page</a>{% endif %}
- {% if info.next_link %}<a class='right' href='{{info.next_link}}'>next page</a>{% endif %}
- <div class = 'clear' ></div>
+ <div style='text-align: center'>
+ {% if info.desc %}{{info.desc}}{% endif %}
+ {% if info.prev_link %}<a class='left' href='{{info.prev_link}}'>previous page</a>{% endif %}
+ {% if info.next_link %}<a class='right' href='{{info.next_link}}'>next page</a>{% endif %}
+ </div>
{% include "job_list_fragment.html" %}
</div>
diff --git a/templates/sources.html b/templates/sources.html
index 04998fc..94f3b80 100644
--- a/templates/sources.html
+++ b/templates/sources.html
@@ -6,11 +6,11 @@
<div class='block'>
<h1>Package list</h1>
- {% if info.desc %}{{info.desc}}{% endif %}
-
- {% if info.prev_link %}<a class='left' href='{{info.prev_link}}'>previous page</a>{% endif %}
- {% if info.next_link %}<a class='right' href='{{info.next_link}}'>next page</a>{% endif %}
- <div class = 'clear' ></div>
+ <div style='text-align: center'>
+ {% if info.desc %}{{info.desc}}{% endif %}
+ {% if info.prev_link %}<a class='left' href='{{info.prev_link}}'>previous page</a>{% endif %}
+ {% if info.next_link %}<a class='right' href='{{info.next_link}}'>next page</a>{% endif %}
+ </div>
{% include "source_list_fragment.html" %}
</div>
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-web.git
More information about the Pkg-debile-commits
mailing list