This limits line wrapping in the failures list. This adds ValueFormatter::GenerateDateTipTime(). As usual the time is shown as a tooltip.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/lib/ObjectModel/CGI/ValueFormatter.pm | 53 ++++++++++++++++++- testbot/web/FailuresList.pl | 1 + testbot/web/WineTestBot.css | 1 + testbot/web/js/datetime.js | 12 +++++ 4 files changed, 66 insertions(+), 1 deletion(-)
diff --git a/testbot/lib/ObjectModel/CGI/ValueFormatter.pm b/testbot/lib/ObjectModel/CGI/ValueFormatter.pm index 49bf856587..343c61c726 100644 --- a/testbot/lib/ObjectModel/CGI/ValueFormatter.pm +++ b/testbot/lib/ObjectModel/CGI/ValueFormatter.pm @@ -23,7 +23,8 @@ package ObjectModel::CGI::ValueFormatter;
use Exporter 'import'; our @EXPORT = qw(GetDateTimeJSFile GenerateDateTime GenerateTipDateTime - GenerateDayTimeTipDate GenerateTimeTipDate GenerateValueHTML); + GenerateDayTimeTipDate GenerateTimeTipDate GenerateDateTipTime + GenerateValueHTML);
use POSIX qw(strftime);
@@ -238,6 +239,51 @@ sub GenerateTimeTipDate($;$$) } }
+=pod +=over 12 + +=item C<GenerateDateTipTime()> + +Show the timestamp's date with the time as a tooltip. + +The timestamp is shown in the user's timezone if JavaScript is available and +in the server's timezone otherwise. + +The default for TagAttrs is 'a' and it should always be a tag that shows the +content of the title attribute as a tooltip. + +See GenerateDateTime() for more details. + +=back +=cut + +sub GenerateDateTipTime($;$$) +{ + my ($Sec1970, $Class, $TagAttrs) = @_; + + if (defined $Sec1970) + { + my $Tag; + if ($TagAttrs) + { + $Tag = $TagAttrs; + $Tag =~ s/ .*$//; + } + else + { + $TagAttrs = $Tag = "a"; + } + $Class = "$Class " if ($Class); + print "<$TagAttrs class='${Class}datetiptime' timestamp='$Sec1970' ", + strftime("title='%H:%M:%S'>%Y-%m-%d", localtime($Sec1970)), + "</$Tag>"; + } + else + { + print " "; + } +} +
# # Property value formatting @@ -303,6 +349,11 @@ sub GenerateValueHTML($$$;$) GenerateDayTimeTipDate($Value); return; } + if ($Format eq "datetiptime") + { + GenerateDateTipTime($Value); + return; + } } elsif ($PropertyDescriptor->GetClass() eq "Itemref" and defined $Value) { diff --git a/testbot/web/FailuresList.pl b/testbot/web/FailuresList.pl index e271ee1d54..2cb40c482e 100644 --- a/testbot/web/FailuresList.pl +++ b/testbot/web/FailuresList.pl @@ -56,6 +56,7 @@ sub DisplayProperty($$)
my $PropertyName = $PropertyDescriptor->GetName(); return $PropertyName =~ /^(?:Notes|ConfigRegExp|FailureRegExp)$/ ? "" : + $PropertyName =~ /^Last(?:Old|New)$/ ? ("ro", "datetiptime") : $self->SUPER::DisplayProperty($PropertyDescriptor); }
diff --git a/testbot/web/WineTestBot.css b/testbot/web/WineTestBot.css index 5e0c39ff45..78d33f886d 100644 --- a/testbot/web/WineTestBot.css +++ b/testbot/web/WineTestBot.css @@ -414,6 +414,7 @@ a.title { color:inherit; text-decoration: none; } a.tipdatetime { color:inherit; text-decoration: none; } a.timetipdate { color:inherit; text-decoration: none; } a.daytimetipdate { color:inherit; text-decoration: none; } +a.datetiptime { color:inherit; text-decoration: none; }
th.Record { text-align: center; } td.Record { text-align: center; } diff --git a/testbot/web/js/datetime.js b/testbot/web/js/datetime.js index d21bf5c6ea..842a6ec30a 100644 --- a/testbot/web/js/datetime.js +++ b/testbot/web/js/datetime.js @@ -60,6 +60,16 @@ function ShowTimeTipDate(dom) Pad2(dt.getSeconds()); }
+function ShowDateTipTime(dom) +{ + const sec1970 = dom.getAttribute("timestamp"); + const dt = new Date(sec1970 * 1000); + dom.setAttribute('title', Pad2(dt.getHours()) +':'+ Pad2(dt.getMinutes()) + +':'+ Pad2(dt.getSeconds())); + dom.innerHTML = dt.getFullYear() +'-'+ Pad2(dt.getMonth() + 1) +'-'+ + Pad2(dt.getDate()); +} + function init() { document.querySelectorAll(".datetime").forEach(dom => { @@ -73,6 +83,8 @@ function init() }); document.querySelectorAll(".timetipdate").forEach(dom => { ShowTimeTipDate(dom); + document.querySelectorAll(".datetiptime").forEach(dom => { + ShowDateTipTime(dom); }); }