From 5d0bf48aa054005b0a57e8c7044a00813f74da48 Mon Sep 17 00:00:00 2001 From: Rob Vermaas Date: Fri, 19 Mar 2010 08:36:31 +0000 Subject: [PATCH] add some stats to jobsets in project view --- src/lib/Hydra/Controller/Project.pm | 3 ++- src/root/project.tt | 22 ++++++++++++++++++++++ src/root/static/css/hydra.css | 9 +++++++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/src/lib/Hydra/Controller/Project.pm b/src/lib/Hydra/Controller/Project.pm index e46e1e73..741194b4 100644 --- a/src/lib/Hydra/Controller/Project.pm +++ b/src/lib/Hydra/Controller/Project.pm @@ -32,8 +32,9 @@ sub view : Chained('project') PathPart('') Args(0) { "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildSchedulingInfo WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus <> 0 AND a.isCurrent = 1 )" , "(SELECT COUNT(*) FROM Builds AS a NATURAL JOIN BuildResultInfo WHERE me.project = a.project AND me.name = a.jobset AND buildstatus = 0 AND a.isCurrent = 1 )" + , "(SELECT COUNT(*) FROM Builds AS a WHERE me.project = a.project AND me.name = a.jobset AND a.isCurrent = 1 )" ] - , "+as" => ["nrscheduled", "nrfailed", "nrsucceeded"] + , "+as" => ["nrscheduled", "nrfailed", "nrsucceeded", "nrtotal"] })]; } diff --git a/src/root/project.tt b/src/root/project.tt index 867e09bd..8acdddb4 100644 --- a/src/root/project.tt +++ b/src/root/project.tt @@ -34,6 +34,7 @@ Id Description Last evaluated + Success @@ -54,6 +55,27 @@ [% INCLUDE renderJobsetName project = project.name jobset = j.name %] [% HTML.escape(j.description) %] [% INCLUDE renderDateTime timestamp = j.lastcheckedtime %] + [% IF j.get_column('nrtotal') > 0 %] + [% successrate = ( j.get_column('nrsucceeded') / j.get_column('nrtotal') )*100 %] + [% IF j.get_column('nrscheduled') > 0 %] + [% class = '' %] + [% ELSIF successrate < 25 %] + [% class = 'red' %] + [% ELSIF successrate < 75 %] + [% class = 'orange' %] + [% ELSIF successrate <= 100 %]green + [% class = 'green' %] + [% END %] + [% END %] + +
[% successrate FILTER format('%d') %]%
+ [% IF j.get_column('nrscheduled') > 0 %] + [% j.get_column('nrscheduled') %] builds still running + [% END %] + + +
[% j.get_column('nrsucceeded') %]/[% j.get_column('nrtotal') %]
+ [% END %] diff --git a/src/root/static/css/hydra.css b/src/root/static/css/hydra.css index ed825d61..b4e1253c 100644 --- a/src/root/static/css/hydra.css +++ b/src/root/static/css/hydra.css @@ -199,3 +199,12 @@ form.inline { display: inline; } +.red { + color: red; +} +.orange { + color: orange; +} +.green { + color: green; +}