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 %] + +
Jobset | +# Queued | +Oldest queued | +Newest queued | +
---|---|---|---|
[% INCLUDE renderFullJobsetName project=j.project jobset=j.jobset %] | +[% HTML.escape(j.queued) %] | +[% INCLUDE renderRelativeDate timestamp=j.oldest %] | +[% INCLUDE renderRelativeDate timestamp=j.newest %] | +