forked from lix-project/hydra
Show evaluation time in the evaluations overview
Parts of this code have been authored by @grahamc
This commit is contained in:
parent
b9fb66401b
commit
94b88b34ae
|
@ -3,13 +3,14 @@ package Hydra::View::TT;
|
||||||
use strict;
|
use strict;
|
||||||
use base 'Catalyst::View::TT';
|
use base 'Catalyst::View::TT';
|
||||||
use Hydra::Helper::Nix;
|
use Hydra::Helper::Nix;
|
||||||
|
use Time::Seconds;
|
||||||
|
|
||||||
__PACKAGE__->config(
|
__PACKAGE__->config(
|
||||||
TEMPLATE_EXTENSION => '.tt',
|
TEMPLATE_EXTENSION => '.tt',
|
||||||
ENCODING => 'utf-8',
|
ENCODING => 'utf-8',
|
||||||
PRE_CHOMP => 1,
|
PRE_CHOMP => 1,
|
||||||
POST_CHOMP => 1,
|
POST_CHOMP => 1,
|
||||||
expose_methods => [qw/buildLogExists buildStepLogExists jobExists stripSSHUser/]);
|
expose_methods => [qw/buildLogExists buildStepLogExists jobExists relativeDuration stripSSHUser/]);
|
||||||
|
|
||||||
sub buildLogExists {
|
sub buildLogExists {
|
||||||
my ($self, $c, $build) = @_;
|
my ($self, $c, $build) = @_;
|
||||||
|
@ -25,6 +26,27 @@ sub buildStepLogExists {
|
||||||
return defined findLog($c, $step->drvpath, @outPaths);
|
return defined findLog($c, $step->drvpath, @outPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
=head2 relativeDuration
|
||||||
|
|
||||||
|
Given an integer of seconds, return an English representation of the
|
||||||
|
duration as a string.
|
||||||
|
|
||||||
|
Arguments:
|
||||||
|
|
||||||
|
=over 1
|
||||||
|
|
||||||
|
=item C<$seconds>
|
||||||
|
|
||||||
|
An integer number of seconds
|
||||||
|
|
||||||
|
=back
|
||||||
|
|
||||||
|
=cut
|
||||||
|
sub relativeDuration {
|
||||||
|
my ($self, $c, $seconds) = @_;
|
||||||
|
return Time::Seconds->new($seconds)->pretty();
|
||||||
|
}
|
||||||
|
|
||||||
sub stripSSHUser {
|
sub stripSSHUser {
|
||||||
my ($self, $c, $name) = @_;
|
my ($self, $c, $name) = @_;
|
||||||
if ($name =~ /^.*@(.*)$/) {
|
if ($name =~ /^.*@(.*)$/) {
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
<td>
|
<td>
|
||||||
[% IF latestEval %]
|
[% IF latestEval %]
|
||||||
[% INCLUDE renderDateTime timestamp = latestEval.timestamp %]
|
[% INCLUDE renderDateTime timestamp = latestEval.timestamp %]
|
||||||
|
(took [% relativeDuration (latestEval.checkouttime + latestEval.evaltime) %])
|
||||||
[% ELSE %]
|
[% ELSE %]
|
||||||
<em>never</em>
|
<em>never</em>
|
||||||
[% END %]
|
[% END %]
|
||||||
|
|
Loading…
Reference in a new issue