automatic reload of tail log when build is running

This commit is contained in:
Rob Vermaas 2011-02-02 09:00:52 +00:00
parent 9aeaef80fc
commit 559ab9c97a
3 changed files with 16 additions and 4 deletions

View file

@ -127,6 +127,16 @@ sub showLog {
$c->forward('Hydra::View::Plain');
}
elsif ($mode eq "tail-reload") {
my $url = $c->request->uri->as_string;
$url =~ s/tail-reload/tail/g;
$c->stash->{url} = $url;
$c->stash->{reload} = defined $c->stash->{build}->schedulingInfo && $c->stash->{build}->schedulingInfo->busy;
$c->stash->{title} = "";
$c->stash->{contents} = (scalar `$pipestart | tail -n 50`) || " ";
$c->stash->{template} = 'plain-reload.tt';
}
elsif ($mode eq "tail") {
$c->stash->{'plain'} = { data => (scalar `$pipestart | tail -n 50`) || " " };
$c->forward('Hydra::View::Plain');

View file

@ -54,7 +54,7 @@
<span class="error">Failed: [% HTML.escape(step.errormsg) %]</span>
[% END %]
[% IF step.logfile %]
(<a href="[% log %]">log</a>, <a href="[% "$log/raw" %]">raw</a>, <a href="[% "$log/tail" %]">tail</a>)
(<a href="[% log %]">log</a>, <a href="[% "$log/raw" %]">raw</a>, <a href="[% "$log/tail-reload" %]">tail</a>)
[% END %]
</td>
</tr>
@ -143,7 +143,7 @@
<td>
<a href="[% c.uri_for('/build' build.id 'log') %]"><strong>Available</strong></a>
(<a href="[% c.uri_for('/build' build.id 'log' 'raw') %]">raw</a>,
<a href="[% c.uri_for('/build' build.id 'log' 'tail') %]">tail</a>)
<a href="[% c.uri_for('/build' build.id 'log' 'tail-reload') %]">tail</a>)
</td>
</tr>
[% END %]
@ -351,7 +351,7 @@
<td>
<a href="[% c.uri_for('/build' build.id 'log') %]"><strong>Available</strong></a>
(<a href="[% c.uri_for('/build' build.id 'log' 'raw') %]">raw</a>,
<a href="[% c.uri_for('/build' build.id 'log' 'tail') %]">tail</a>)
<a href="[% c.uri_for('/build' build.id 'log' 'tail-reload') %]">tail</a>)
</td>
</tr>
[% END %]

View file

@ -141,9 +141,11 @@ pre {
}
pre.buildlog {
border: 1px solid black;
border: 3px solid darkblue;
padding: 0.3em;
white-space: pre-wrap;
background: black;
color: #ffffff;
}
div.buildlog {