diff --git a/src/lib/Hydra/Controller/Root.pm b/src/lib/Hydra/Controller/Root.pm index 8827d4f0..5070c090 100644 --- a/src/lib/Hydra/Controller/Root.pm +++ b/src/lib/Hydra/Controller/Root.pm @@ -102,6 +102,17 @@ sub queue_GET { } +sub queue_summary :Local :Path('queue-summary') :Args(0) { + my ($self, $c) = @_; + $c->stash->{template} = 'queue-summary.tt'; + + $c->stash->{queued} = $c->model('DB')->schema->storage->dbh->selectall_arrayref( + "select project, jobset, count(*) as queued, min(timestamp) as oldest, max(timestamp) as newest from Builds " . + "where finished = 0 group by project, jobset order by queued desc", + { Slice => {} }); +} + + sub status :Local :Args(0) :ActionClass('REST') { } sub status_GET { diff --git a/src/root/queue-summary.tt b/src/root/queue-summary.tt new file mode 100644 index 00000000..9932cb8f --- /dev/null +++ b/src/root/queue-summary.tt @@ -0,0 +1,33 @@ +[% WRAPPER layout.tt title="Queue summary" %] +[% PROCESS common.tt %] + +[% IF queued.size == 0 %] + +
There are no pending builds.
+ +[% ELSE %] + + + + + + + + + + + + [% FOREACH j IN queued %] + + + + + + + [% END %] + +
Jobset# QueuedOldest queuedNewest queued
[% INCLUDE renderFullJobsetName project=j.project jobset=j.jobset %][% HTML.escape(j.queued) %][% INCLUDE renderRelativeDate timestamp=j.oldest %][% INCLUDE renderRelativeDate timestamp=j.newest %]
+ +[% END %] + +[% END %] diff --git a/src/root/topbar.tt b/src/root/topbar.tt index 14dba82a..54051fa8 100644 --- a/src/root/topbar.tt +++ b/src/root/topbar.tt @@ -17,7 +17,7 @@ [% WRAPPER makeSubMenu title="Status" %] [% INCLUDE menuItem - uri = c.uri_for(c.controller('Root').action_for('queue')) + uri = c.uri_for(c.controller('Root').action_for('queue_summary')) title = "Queue ("_ nrRunningBuilds _"/"_ nrQueuedBuilds _")" %] [% INCLUDE menuItem uri = c.uri_for(c.controller('Root').action_for('status'))