forked from lix-project/hydra
Re-add the history tab (store size and build time), now as lazy-loaded tab on build page.
This commit is contained in:
parent
b3c1c57a5b
commit
d4d9896f9f
|
@ -71,7 +71,7 @@ sub build_GET {
|
|||
$c->stash->{cachedBuild} = $cachedBuildStep->build if defined $cachedBuildStep;
|
||||
}
|
||||
|
||||
if ($build->finished && 0) {
|
||||
if ($build->finished) {
|
||||
$c->stash->{prevBuilds} = [$c->model('DB::Builds')->search(
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{build}->jobset->name
|
||||
|
@ -399,6 +399,32 @@ sub runtime_deps : Chained('buildChain') PathPart('runtime-deps') {
|
|||
}
|
||||
|
||||
|
||||
sub history_graphs : Chained('buildChain') PathPart('history-graphs') {
|
||||
my ($self, $c) = @_;
|
||||
my $build = $c->stash->{build};
|
||||
if ($build->finished) {
|
||||
$c->stash->{prevBuilds} = [$c->model('DB::Builds')->search(
|
||||
{ project => $c->stash->{project}->name
|
||||
, jobset => $c->stash->{build}->jobset->name
|
||||
, job => $c->stash->{build}->job->name
|
||||
, 'me.system' => $build->system
|
||||
, finished => 1
|
||||
, buildstatus => 0
|
||||
, 'me.id' => { '<=' => $build->id }
|
||||
}
|
||||
, { join => "actualBuildStep"
|
||||
, "+select" => ["actualBuildStep.stoptime - actualBuildStep.starttime"]
|
||||
, "+as" => ["actualBuildTime"]
|
||||
, order_by => "me.id DESC"
|
||||
, rows => 50
|
||||
}
|
||||
)
|
||||
];
|
||||
}
|
||||
$c->stash->{template} = 'build-history-tab.tt';
|
||||
}
|
||||
|
||||
|
||||
sub nix : Chained('buildChain') PathPart('nix') CaptureArgs(0) {
|
||||
my ($self, $c) = @_;
|
||||
|
||||
|
|
|
@ -550,13 +550,13 @@ __PACKAGE__->has_many(
|
|||
{ "foreign.build" => "self.id" },
|
||||
);
|
||||
|
||||
#__PACKAGE__->has_one(
|
||||
# "actualBuildStep",
|
||||
# "Hydra::Schema::BuildSteps",
|
||||
# { 'foreign.outpath' => 'self.outpath'
|
||||
# , 'foreign.build' => 'self.id'
|
||||
# },
|
||||
#);
|
||||
__PACKAGE__->has_one(
|
||||
"actualBuildStep",
|
||||
"Hydra::Schema::BuildSteps",
|
||||
{ 'foreign.drvpath' => 'self.drvpath'
|
||||
, 'foreign.build' => 'self.id'
|
||||
},
|
||||
);
|
||||
|
||||
__PACKAGE__->many_to_many("jobsetevals", "jobsetevalmembers", "eval");
|
||||
|
||||
|
|
141
src/root/build-history-tab.tt
Normal file
141
src/root/build-history-tab.tt
Normal file
|
@ -0,0 +1,141 @@
|
|||
[% PROCESS common.tt %]
|
||||
[% PROCESS "product-list.tt" %]
|
||||
[% USE HTML %]
|
||||
[% USE Date %]
|
||||
|
||||
<h3>Build time history (in seconds)</h3>
|
||||
|
||||
<div id="placeholder" style="width:800px;height:400px;"></div>
|
||||
<div id="overview" style="margin-left:50px;margin-top:20px;width:600px;height:50px"></div>
|
||||
|
||||
<script src="[% c.uri_for("/static/js/flot/jquery.flot.js") %]" type="text/javascript"></script>
|
||||
<script src="[% c.uri_for("/static/js/flot/jquery.flot.selection.js") %]" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var d = [];
|
||||
var ids = [];
|
||||
[% FOREACH prevbuild IN prevBuilds; IF prevbuild.build.starttime != 0 %]
|
||||
d.push([[% prevbuild.starttime * 1000 %],[% prevbuild.get_column('actualBuildTime') %]]);
|
||||
ids[[% prevbuild.starttime * 1000 %]] = [% prevbuild.id %] ;
|
||||
[% END; END %]
|
||||
|
||||
var options = {
|
||||
xaxis: { mode: "time" },
|
||||
selection: { mode: "x" },
|
||||
points: { show: true },
|
||||
lines: { show: true },
|
||||
grid: {
|
||||
clickable: true,
|
||||
hoverable: true,
|
||||
hoverFill: '#444',
|
||||
hoverRadius: 4,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
var plot = $.plot($("#placeholder"), [d], options);
|
||||
|
||||
var overview = $.plot($("#overview"), [d], {
|
||||
series: {
|
||||
lines: { show: true, lineWidth: 1 },
|
||||
shadowSize: 0
|
||||
},
|
||||
xaxis: { ticks: [], mode: "time" },
|
||||
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
|
||||
selection: { mode: "x" }
|
||||
});
|
||||
|
||||
// now connect the two
|
||||
|
||||
$("#placeholder").bind("plotselected", function (event, ranges) {
|
||||
// do the zooming
|
||||
plot = $.plot($("#placeholder"), [d],
|
||||
$.extend(true, {}, options, {
|
||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
|
||||
}));
|
||||
|
||||
// don't fire event on the overview to prevent eternal loop
|
||||
overview.setSelection(ranges, true);
|
||||
});
|
||||
|
||||
$("#overview").bind("plotselected", function (event, ranges) {
|
||||
plot.setSelection(ranges);
|
||||
});
|
||||
|
||||
$("#placeholder").bind("plotclick", function (e, pos, item) {
|
||||
if (item) {
|
||||
plot.highlight(item.series, item.datapoint);
|
||||
buildid = ids[item.datapoint[0]];
|
||||
window.location = "/build/"+buildid;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<h3>Store path size history (in MB)</h3>
|
||||
|
||||
<div id="placeholder-size" style="width:800px;height:400px;"></div>
|
||||
<div id="overview-size" style="margin-left:50px;margin-top:20px;width:600px;height:50px"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var d = [];
|
||||
var ids = [];
|
||||
[% FOREACH prevbuild IN prevBuilds; IF prevbuild.size != 0 %]
|
||||
d.push([[% prevbuild.starttime * 1000 %],[% prevbuild.size / (1024*1024.0) %]]);
|
||||
ids[[% prevbuild.starttime * 1000 %]] = [% prevbuild.id %] ;
|
||||
[% END; END %]
|
||||
|
||||
var options = {
|
||||
xaxis: { mode: "time" },
|
||||
selection: { mode: "x" },
|
||||
points: { show: true },
|
||||
lines: { show: true },
|
||||
grid: {
|
||||
clickable: true,
|
||||
hoverable: true,
|
||||
hoverFill: '#444',
|
||||
hoverRadius: 4,
|
||||
},
|
||||
};
|
||||
|
||||
var plot = $.plot($("#placeholder-size"), [d], options);
|
||||
|
||||
var overview = $.plot($("#overview-size"), [d], {
|
||||
series: {
|
||||
lines: { show: true, lineWidth: 1 },
|
||||
shadowSize: 0
|
||||
},
|
||||
xaxis: { ticks: [], mode: "time" },
|
||||
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
|
||||
selection: { mode: "x" }
|
||||
});
|
||||
|
||||
// now connect the two
|
||||
|
||||
$("#placeholder-size").bind("plotselected", function (event, ranges) {
|
||||
// do the zooming
|
||||
plot = $.plot($("#placeholder-size"), [d],
|
||||
$.extend(true, {}, options, {
|
||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
|
||||
}));
|
||||
|
||||
// don't fire event on the overview to prevent eternal loop
|
||||
overview.setSelection(ranges, true);
|
||||
});
|
||||
|
||||
$("#overview-size").bind("plotselected", function (event, ranges) {
|
||||
plot.setSelection(ranges);
|
||||
});
|
||||
|
||||
$("#placeholder-size").bind("plotclick", function (e, pos, item) {
|
||||
if (item) {
|
||||
plot.highlight(item.series, item.datapoint);
|
||||
buildid = ids[item.datapoint[0]];
|
||||
window.location = "/build/"+buildid;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
@ -106,7 +106,7 @@
|
|||
<li><a href="#tabs-buildinputs" data-toggle="tab">Inputs</a></li>
|
||||
[% IF build.buildsteps %]<li><a href="#tabs-buildsteps" data-toggle="tab">Build steps</a></li>[% END %]
|
||||
[% IF build.dependents %]<li><a href="#tabs-usedby" data-toggle="tab">Used by</a></li>[% END%]
|
||||
[% IF prevBuilds %]<li><a href="#tabs-history" data-toggle="tab">History chart</a></li>[% END %]
|
||||
<li><a href="#tabs-history" data-toggle="tab">History chart</a></li>
|
||||
[% IF drvAvailable %]<li><a href="#tabs-build-deps" data-toggle="tab">Build dependencies</a></li>[% END %]
|
||||
[% IF available %]<li><a href="#tabs-runtime-deps" data-toggle="tab">Runtime dependencies</a></li>[% END %]
|
||||
</ul>
|
||||
|
@ -407,145 +407,7 @@
|
|||
</div>
|
||||
[% END %]
|
||||
|
||||
[% IF prevBuilds %]
|
||||
<div id="tabs-history" class="tab-pane">
|
||||
<h3>Build time history (in seconds)</h3>
|
||||
|
||||
<div id="placeholder" style="width:800px;height:400px;"></div>
|
||||
<div id="overview" style="margin-left:50px;margin-top:20px;width:600px;height:50px"></div>
|
||||
|
||||
<script src="[% c.uri_for("/static/js/flot/jquery.flot.js") %]" type="text/javascript"></script>
|
||||
<script src="[% c.uri_for("/static/js/flot/jquery.flot.selection.js") %]" type="text/javascript"></script>
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var d = [];
|
||||
var ids = [];
|
||||
[% FOREACH prevbuild IN prevBuilds; IF prevbuild.build.starttime != 0 %]
|
||||
d.push([[% prevbuild.starttime * 1000 %],[% prevbuild.get_column('actualBuildTime') %]]);
|
||||
ids[[% prevbuild.starttime * 1000 %]] = [% prevbuild.id %] ;
|
||||
[% END; END %]
|
||||
|
||||
var options = {
|
||||
xaxis: { mode: "time" },
|
||||
selection: { mode: "x" },
|
||||
points: { show: true },
|
||||
lines: { show: true },
|
||||
grid: {
|
||||
clickable: true,
|
||||
hoverable: true,
|
||||
hoverFill: '#444',
|
||||
hoverRadius: 4,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
var plot = $.plot($("#placeholder"), [d], options);
|
||||
|
||||
var overview = $.plot($("#overview"), [d], {
|
||||
series: {
|
||||
lines: { show: true, lineWidth: 1 },
|
||||
shadowSize: 0
|
||||
},
|
||||
xaxis: { ticks: [], mode: "time" },
|
||||
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
|
||||
selection: { mode: "x" }
|
||||
});
|
||||
|
||||
// now connect the two
|
||||
|
||||
$("#placeholder").bind("plotselected", function (event, ranges) {
|
||||
// do the zooming
|
||||
plot = $.plot($("#placeholder"), [d],
|
||||
$.extend(true, {}, options, {
|
||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
|
||||
}));
|
||||
|
||||
// don't fire event on the overview to prevent eternal loop
|
||||
overview.setSelection(ranges, true);
|
||||
});
|
||||
|
||||
$("#overview").bind("plotselected", function (event, ranges) {
|
||||
plot.setSelection(ranges);
|
||||
});
|
||||
|
||||
$("#placeholder").bind("plotclick", function (e, pos, item) {
|
||||
if (item) {
|
||||
plot.highlight(item.series, item.datapoint);
|
||||
buildid = ids[item.datapoint[0]];
|
||||
window.location = "/build/"+buildid;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<h3>Store path size history (in MB)</h3>
|
||||
|
||||
<div id="placeholder-size" style="width:800px;height:400px;"></div>
|
||||
<div id="overview-size" style="margin-left:50px;margin-top:20px;width:600px;height:50px"></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
$(function() {
|
||||
var d = [];
|
||||
var ids = [];
|
||||
[% FOREACH prevbuild IN prevBuilds; IF prevbuild.size != 0 %]
|
||||
d.push([[% prevbuild.starttime * 1000 %],[% prevbuild.size / (1024*1024.0) %]]);
|
||||
ids[[% prevbuild.starttime * 1000 %]] = [% prevbuild.id %] ;
|
||||
[% END; END %]
|
||||
|
||||
var options = {
|
||||
xaxis: { mode: "time" },
|
||||
selection: { mode: "x" },
|
||||
points: { show: true },
|
||||
lines: { show: true },
|
||||
grid: {
|
||||
clickable: true,
|
||||
hoverable: true,
|
||||
hoverFill: '#444',
|
||||
hoverRadius: 4,
|
||||
},
|
||||
};
|
||||
|
||||
var plot = $.plot($("#placeholder-size"), [d], options);
|
||||
|
||||
var overview = $.plot($("#overview-size"), [d], {
|
||||
series: {
|
||||
lines: { show: true, lineWidth: 1 },
|
||||
shadowSize: 0
|
||||
},
|
||||
xaxis: { ticks: [], mode: "time" },
|
||||
yaxis: { ticks: [], min: 0, autoscaleMargin: 0.1 },
|
||||
selection: { mode: "x" }
|
||||
});
|
||||
|
||||
// now connect the two
|
||||
|
||||
$("#placeholder-size").bind("plotselected", function (event, ranges) {
|
||||
// do the zooming
|
||||
plot = $.plot($("#placeholder-size"), [d],
|
||||
$.extend(true, {}, options, {
|
||||
xaxis: { min: ranges.xaxis.from, max: ranges.xaxis.to }
|
||||
}));
|
||||
|
||||
// don't fire event on the overview to prevent eternal loop
|
||||
overview.setSelection(ranges, true);
|
||||
});
|
||||
|
||||
$("#overview-size").bind("plotselected", function (event, ranges) {
|
||||
plot.setSelection(ranges);
|
||||
});
|
||||
|
||||
$("#placeholder-size").bind("plotclick", function (e, pos, item) {
|
||||
if (item) {
|
||||
plot.highlight(item.series, item.datapoint);
|
||||
buildid = ids[item.datapoint[0]];
|
||||
window.location = "/build/"+buildid;
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
</div>
|
||||
[% END %]
|
||||
[% INCLUDE makeLazyTab tabName="tabs-history" uri=c.uri_for('/build' build.id 'history-graphs') %]
|
||||
|
||||
[% IF drvAvailable %]
|
||||
[% INCLUDE makeLazyTab tabName="tabs-build-deps" uri=c.uri_for('/build' build.id 'build-deps') %]
|
||||
|
|
Loading…
Reference in a new issue