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:
Eelco Dolstra
2015-02-26 13:01:01 +01:00
parent fa1e043526
commit c04c8c2bf1
4 changed files with 24 additions and 6 deletions

View File

@ -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;