* hydra: added initial version of build graph
This commit is contained in:
parent
a7d132ff2a
commit
f44128275c
|
@ -30,12 +30,18 @@ let
|
|||
sha256 = "013zgglvifvy0yg0ybjrl823sswy9v1ihf5nmighmcyigfd6nrhb";
|
||||
};
|
||||
|
||||
flot = fetchurl {
|
||||
url = http://flot.googlecode.com/files/flot-0.6.zip;
|
||||
sha256 = "1k2mfijvr1jwga65wcd78lp9ia17v99f1cfm5nlmc0k8glllbj5a";
|
||||
};
|
||||
|
||||
# Since we don't have a `make dist', just tar everything.
|
||||
distPhase = ''
|
||||
ensureDir src/root/static/js/jquery
|
||||
unzip -d src/root/static/js/jquery $jquery
|
||||
rm -rf src/root/static/js/tablesorter
|
||||
unzip -d src/root/static/js $tablesorter
|
||||
unzip -d src/root/static/js $flot
|
||||
|
||||
make -C src/sql
|
||||
|
||||
|
|
|
@ -50,6 +50,20 @@ sub view_build : Chained('build') PathPart('') Args(0) {
|
|||
$c->stash->{logtext} = `tail -n 50 $path`;
|
||||
}
|
||||
|
||||
if($build->finished) {
|
||||
$c->stash->{prevBuilds} = [joinWithResultInfo($c, $c->model('DB::Builds'))->search(
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{build}->jobset->name
|
||||
, job => $c->stash->{build}->job->name
|
||||
, system => $build->system
|
||||
, finished => 1
|
||||
, buildstatus => 0
|
||||
}
|
||||
, { order_by => "id DESC", rows => 20 }
|
||||
)
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -81,17 +81,17 @@
|
|||
<p class="error">[% flashMsg %]</p>
|
||||
[% END %]
|
||||
|
||||
|
||||
|
||||
<div id="generic-tabs">
|
||||
<ul>
|
||||
<li><a href="#tabs-summary">Summary</a></li>
|
||||
<li><a href="#tabs-information">Information</a></li>
|
||||
<li><a href="#tabs-buildinputs">Build Inputs</a></li>
|
||||
[% IF build.buildsteps %]<li><a href="#tabs-buildsteps">Build Steps</a></li>[% END %]
|
||||
[% IF build.dependents %]<li><a href="#tabs-usedby">Used by</a></li>[% END%]
|
||||
[% IF build.dependents %]<li><a href="#tabs-usedby">Used by</a></li>[% END%]
|
||||
<li><a href="#tabs-history">History chart</a></li>
|
||||
</ul>
|
||||
<div id="tabs-summary">
|
||||
|
||||
<table class="statusTable">
|
||||
<tr>
|
||||
<td>
|
||||
|
@ -415,6 +415,67 @@
|
|||
</div>
|
||||
[% END %]
|
||||
|
||||
<div id="tabs-history">
|
||||
|
||||
<div id="placeholder" style="width:600px;height:300px;"></div>
|
||||
<script src="/static/js/flot/jquery.flot.js" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var d = [ null [% FOREACH prevbuild IN prevBuilds %][% IF prevbuild.resultInfo.starttime != 0 && (prevbuild.resultInfo.stoptime - prevbuild.resultInfo.starttime) != 0 %],[[% prevbuild.resultInfo.starttime * 1000 %],[% prevbuild.resultInfo.stoptime - prevbuild.resultInfo.starttime %]] [% END %] [% END %] ] ;
|
||||
|
||||
// helper for returning the weekends in a period
|
||||
function weekendAreas(axes) {
|
||||
var markings = [];
|
||||
var d = new Date(axes.xaxis.min);
|
||||
// go to the first Saturday
|
||||
d.setUTCDate(d.getUTCDate() - ((d.getUTCDay() + 1) % 7))
|
||||
d.setUTCSeconds(0);
|
||||
d.setUTCMinutes(0);
|
||||
d.setUTCHours(0);
|
||||
var i = d.getTime();
|
||||
do {
|
||||
// when we don't set yaxis, the rectangle automatically
|
||||
// extends to infinity upwards and downwards
|
||||
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
|
||||
i += 7 * 24 * 60 * 60 * 1000;
|
||||
} while (i < axes.xaxis.max);
|
||||
|
||||
return markings;
|
||||
}
|
||||
var now = (new Date()).getTime() ;
|
||||
var minimum = now;
|
||||
for (var i = 1; i < d.length; ++i)
|
||||
if ( minimum > d[i][0] )
|
||||
minimum = d[i][0] ;
|
||||
|
||||
var now = (new Date()).getTime() ;
|
||||
var options = {
|
||||
xaxis: { mode: "time", min: minimum, max: now,
|
||||
},
|
||||
points: { show: true },
|
||||
lines: { show: true },
|
||||
selection: { mode: "x" },
|
||||
grid: { markings: weekendAreas }
|
||||
};
|
||||
|
||||
$('#generic-tabs').bind('tabsshow', function(event, ui) {
|
||||
if (ui.panel.id == "tabs-history") {
|
||||
$.plot($("#placeholder"), [
|
||||
{ data: d,
|
||||
clickable : true,
|
||||
hoverable : true,
|
||||
},
|
||||
], options );
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
|
Loading…
Reference in a new issue