From 355135b6e8fb34be99f3540c87b81ccb4a33df93 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Thu, 16 Feb 2012 15:31:12 +0100 Subject: [PATCH] add links in admin page to clear queue (all non-running builds, and all non-running old (non-current) builds) --- src/lib/Hydra/Controller/Admin.pm | 12 ++++++++++++ src/root/admin.tt | 7 ++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Controller/Admin.pm b/src/lib/Hydra/Controller/Admin.pm index 0035c4ce..cfec647e 100644 --- a/src/lib/Hydra/Controller/Admin.pm +++ b/src/lib/Hydra/Controller/Admin.pm @@ -294,6 +294,18 @@ sub machine_disable : Chained('machine') PathPart('disable') Args(0) { $c->res->redirect("/admin/machines"); } +sub clear_queue_non_current : Chained('admin') Path('clear-queue-non-current') Args(0) { + my ($self, $c) = @_; + $c->model('DB::Builds')->search({iscurrent => 0, busy => 0}, { join => 'schedulingInfo' })->delete_all; + $c->res->redirect("/admin"); +} + +sub clear_queue : Chained('admin') Path('clear-queue') Args(0) { + my ($self, $c) = @_; + $c->model('DB::Builds')->search({busy => 0}, { join => 'schedulingInfo' })->delete_all; + $c->res->redirect("/admin"); +} + sub clearfailedcache : Chained('admin') Path('clear-failed-cache') Args(0) { my ($self, $c) = @_; diff --git a/src/root/admin.tt b/src/root/admin.tt index 11a9331b..fc61ec0b 100644 --- a/src/root/admin.tt +++ b/src/root/admin.tt @@ -7,7 +7,12 @@
  • [% INCLUDE maybeLink uri = c.uri_for(c.controller('Project').action_for('create')) content = "Create project" %]
  • [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('users')) content = "Manage users" %]
  • [% INCLUDE maybeLink uri = c.uri_for(c.controller('Admin').action_for('news')) content = "Manage news" %]
  • - +
  • Queue + +
  • Caching