-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/elapsed_time_graph'
- Loading branch information
Showing
9 changed files
with
228 additions
and
43 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
function drawElapsedTimeGraph($drawArea, elapsedTimes, spot) { | ||
var gap = elapsedTimes.length - spot.length; | ||
for (var i = 0; i < gap; i++) { | ||
spot.unshift(undefined); | ||
} | ||
|
||
var excludeHyphenValue = function (arr) { | ||
return $.grep(arr, function (n, i) { | ||
return n !== '-'; | ||
}); | ||
}; | ||
elapsedTimes = excludeHyphenValue(elapsedTimes); | ||
spot = excludeHyphenValue(spot); | ||
|
||
spot.splice(0, spot.length - elapsedTimes.length); | ||
|
||
var data = { | ||
labels: $.map(elapsedTimes, function () { | ||
return ""; | ||
}), | ||
datasets: [ | ||
{ | ||
fillColor: "rgba(151,187,205,0.5)", | ||
strokeColor: "rgba(151,187,205,1)", | ||
pointColor: "rgba(151,187,205,1)", | ||
pointStrokeColor: "#fff", | ||
data: elapsedTimes | ||
}, | ||
{ | ||
pointColor: "rgba(220,122,109,1)", | ||
pointStrokeColor: "#fff", | ||
data: spot | ||
} | ||
] | ||
}; | ||
|
||
var ctx = $drawArea.get(0).getContext("2d"); | ||
var myNewChart = new Chart(ctx).Line(data, { | ||
pointDotRadius: 2.5, | ||
pointDotStrokeWidth: 0.5, | ||
animation: false | ||
}); | ||
} | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +1,77 @@ | ||
: cascade include::layout | ||
: override content -> { | ||
|
||
<link rel="stylesheet" href="<: uri_for('/static/css/jquery.powertip-light.min.css') :>" type="text/css"> | ||
<script src="<: uri_for('/static/js/jquery.powertip.min.js') :>"></script> | ||
<script src="<: uri_for('/static/js/Chart.min.js') :>"></script> | ||
<script src="<: uri_for('/static/js/elapsed-time-chart.js') :>"></script> | ||
|
||
<script> | ||
var elapsedTimes = []; | ||
</script> | ||
|
||
<hr class="space"> | ||
|
||
<section> | ||
<div class="row"> | ||
<div class="span16"> | ||
<h1><: l('Reports for') :> <a href="<: uri_for('/', {project => $project}) :>"><: $project :></a> [<: $branch :>]</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>ID</th> | ||
<th><: l('Revision') :></th> | ||
<th><: l('Status') :></th> | ||
<th><: l('Date') :></th> | ||
<th><: l('Elapsed Time') :></th> | ||
</tr> | ||
: for $reports -> $v { | ||
<tr> | ||
<td><a href="<: uri_for('/report/' ~ $v.report_id) :>"><: $v.report_id :></a></td> | ||
<td><: $v.revision || '-' :></td> | ||
<td style="color: <: $v.status | status_color :>"><: $v.status | status_str :> </td> | ||
<td><: ago($now-$v.ctime, 1) :></td> | ||
<td><: duration($v.elapsed_time_sec) :></td> | ||
</tr> | ||
: } | ||
</table> | ||
|
||
<div class="pager"> | ||
: if $pager.prev_page { | ||
<a href="<: uri_with({page => $pager.prev_page}) :>">←</a> | ||
: } else { | ||
← | ||
: } | ||
|<: $pager.current_page :>| | ||
: if $pager.next_page { | ||
<a href="<: uri_with({page => $pager.next_page}) :>">→</a> | ||
: } else { | ||
→ | ||
: } | ||
</div> | ||
|
||
<a href="<: uri_for('/branch/delete', { branch_id => $branch_id }) :>"><: l('Delete test data for this branch') :></a> | ||
<div class="span16"> | ||
<h1><: l('Reports for') :> <a href="<: uri_for('/', {project => $project}) :>"><: $project :></a> [<: $branch :>]</h1> | ||
|
||
<table> | ||
<tr> | ||
<th>ID</th> | ||
<th><: l('Revision') :></th> | ||
<th><: l('Status') :></th> | ||
<th><: l('Date') :></th> | ||
<th><: l('Elapsed Time') :></th> | ||
</tr> | ||
: for $reports -> $v { | ||
<tr> | ||
<td><a href="<: uri_for('/report/' ~ $v.report_id) :>"><: $v.report_id :></a></td> | ||
<td><: $v.revision || '-' :></td> | ||
<td style="color: <: $v.status | status_color :>"><: $v.status | status_str :> </td> | ||
<td><: ago($now-$v.ctime, 1) :></td> | ||
<td id="elapsed_time_<: $v.report_id :>"> | ||
<: duration($v.elapsed_time_sec) :> | ||
<script> | ||
: if defined $v.elapsed_time_sec { | ||
elapsedTimes.unshift(<: $v.elapsed_time_sec :>); | ||
(function () { | ||
var spot = $.map(elapsedTimes, function () {return '-'}); | ||
spot[0] = elapsedTimes[0]; | ||
$("#elapsed_time_<: $v.report_id :>").powerTip({smartPlacement: true}); | ||
$("#elapsed_time_<: $v.report_id :>").data('powertip', function () { | ||
var tooltip = $('<canvas width="300" height="200"></canvas>'); | ||
drawElapsedTimeGraph(tooltip, elapsedTimes, spot); | ||
return tooltip; | ||
}); | ||
})(); | ||
: } else { | ||
elapsedTimes.unshift("-"); | ||
: } | ||
</script> | ||
</td> | ||
</tr> | ||
: } | ||
</table> | ||
|
||
<div class="pager"> | ||
: if $pager.prev_page { | ||
<a href="<: uri_with({page => $pager.prev_page}) :>">←</a> | ||
: } else { | ||
← | ||
: } | ||
|<: $pager.current_page :>| | ||
: if $pager.next_page { | ||
<a href="<: uri_with({page => $pager.next_page}) :>">→</a> | ||
: } else { | ||
→ | ||
: } | ||
</div> | ||
|
||
<a href="<: uri_for('/branch/delete', { branch_id => $branch_id }) :>"><: l('Delete test data for this branch') :></a> | ||
</div> | ||
</div> | ||
</section> | ||
|
||
: } | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
use Test::Requires 'Text::SimpleTable'; | ||
use File::Basename; | ||
|
||
plan skip_all => 'this test requires "jshint" command' | ||
if system("jshint --version") != 0; | ||
|
||
my @files = (<share/static/*/*.js>); | ||
|
||
my %WHITE_LIST = map { $_ => 1 } qw( | ||
lang-apollo.js | ||
lang-clj.js | ||
lang-css.js | ||
lang-go.js | ||
lang-hs.js | ||
lang-lisp.js | ||
lang-lua.js | ||
lang-ml.js | ||
lang-n.js | ||
lang-proto.js | ||
lang-scala.js | ||
lang-sql.js | ||
lang-tex.js | ||
lang-vb.js | ||
lang-vhdl.js | ||
lang-wiki.js | ||
lang-xq.js | ||
lang-yaml.js | ||
prettify.js | ||
Chart.min.js | ||
jquery.powertip.min.js | ||
less-1.1.3.min.js | ||
); | ||
|
||
my $table = Text::SimpleTable->new( 25, 5 ); | ||
|
||
for my $file (@files) { | ||
next if $WHITE_LIST{basename($file)}; | ||
next if basename($file) =~ /jquery-[0-9.]+.min.js$/; | ||
|
||
my $out = `jshint $file`; | ||
my $err = 0; | ||
if ( $out =~ /(\d+) errors?/ ) { | ||
( $err ) = ( $1 ); | ||
is($err, 0, $file) | ||
or note $out; | ||
} | ||
else { | ||
ok(1); | ||
} | ||
$table->row( basename($file), $err ); | ||
} | ||
|
||
note $table->draw; | ||
|
||
done_testing; |