forked from lix-project/hydra
Jobset job tab: Show eval date rather than eval ID
Eval IDs carry no useful information, so it's better to show the date of the eval. If the date is recent, a relative date is given (e.g. "3h ago").
This commit is contained in:
parent
fa1e043526
commit
c04c8c2bf1
|
@ -120,7 +120,8 @@ sub jobs_tab : Chained('jobsetChain') PathPart('jobs-tab') Args(0) {
|
|||
{ columns => ['id', 'job', 'finished', 'buildstatus'] });
|
||||
foreach my $b (@builds) {
|
||||
my $jobName = $b->get_column('job');
|
||||
$evals->{$eval->id}->{$jobName} =
|
||||
$evals->{$eval->id}->{timestamp} = $eval->timestamp;
|
||||
$evals->{$eval->id}->{jobs}->{$jobName} =
|
||||
{ id => $b->id, finished => $b->finished, buildstatus => $b->buildstatus };
|
||||
$jobs{$jobName} = 1;
|
||||
$nrBuilds++;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
USE date;
|
||||
USE String;
|
||||
USE HTML;
|
||||
USE Math;
|
||||
|
||||
|
||||
USE mibs=format("%.2f");
|
||||
|
@ -12,6 +13,22 @@ date.format(timestamp, '%Y-%m-%d %H:%M:%S');
|
|||
END;
|
||||
|
||||
|
||||
BLOCK renderRelativeDate;
|
||||
ago = date.now - timestamp;
|
||||
IF ago >= 0 && ago < 60; THEN;
|
||||
ago _ 's ago';
|
||||
ELSIF ago >= 0 && ago < 60 * 60; THEN;
|
||||
Math.int(ago / 60) _ 'm ago';
|
||||
ELSIF ago >= 0 && ago < 24 * 60 * 60; THEN;
|
||||
Math.int(ago / (60 * 60)) _ 'h ago';
|
||||
ELSIF ago >= 0 && ago < 7 * 24 * 60 * 60; THEN;
|
||||
Math.int(ago / (24 * 60 * 60)) _ 'd ago';
|
||||
ELSE;
|
||||
date.format(timestamp, '%Y-%m-%d');
|
||||
END;
|
||||
END;
|
||||
|
||||
|
||||
BLOCK renderProjectName %]
|
||||
<a [% IF inRow %]class="row-link"[% END %] href="[% c.uri_for('/project' project) %]"><tt>[% project %]</tt></a>
|
||||
[% END;
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
});
|
||||
};
|
||||
|
||||
$('#filter-jobs').submit(function() {
|
||||
$('#filter-jobs').submit(function() {
|
||||
setFilter($('#filter-jobs').serialize());
|
||||
return false;
|
||||
});
|
||||
|
@ -49,7 +49,7 @@
|
|||
[% FOREACH eval IN evalIds %]
|
||||
<th class="rotate-45">
|
||||
<div><span>
|
||||
<a href="[% c.uri_for('/eval' eval) %]">[% eval %]</a>
|
||||
<a href="[% c.uri_for('/eval' eval) %]">[% INCLUDE renderRelativeDate timestamp=evals.$eval.timestamp %]</a>
|
||||
</span></div></th>
|
||||
[% END %]
|
||||
</tr>
|
||||
|
@ -59,11 +59,11 @@
|
|||
<tr>
|
||||
<th><span [% IF inactiveJobs.$j %]class="muted override-link"[% END %]>[% INCLUDE renderJobName project=project.name jobset=jobset.name job=j %]</span></th>
|
||||
[% FOREACH eval IN evalIds %]
|
||||
<td>[% r = evals.$eval.$j; IF r.id %]<a href="[% c.uri_for('/build' r.id) %]">[% INCLUDE renderBuildStatusIcon size=16 build=r %]</a>[% END %]</td>
|
||||
<td>[% r = evals.$eval.jobs.$j; IF r.id %]<a href="[% c.uri_for('/build' r.id) %]">[% INCLUDE renderBuildStatusIcon size=16 build=r %]</a>[% END %]</td>
|
||||
[% END %]
|
||||
</tr>
|
||||
[% END %]
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
[% END %]
|
||||
|
|
|
@ -9,7 +9,7 @@ td.centered {
|
|||
text-align: center;
|
||||
}
|
||||
|
||||
.table-header-rotated th.rotate-45{
|
||||
.table-header-rotated th.rotate-45 {
|
||||
height: 80px;
|
||||
width: 40px;
|
||||
min-width: 40px;
|
||||
|
|
Loading…
Reference in a new issue