From 774074be6326653f192812f519f2545050f6ca7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Wed, 9 Dec 2020 11:39:39 +0100 Subject: [PATCH] timestamp html and css improvements Each time stamp has an ID that can be linked to. Currently, there's no mechanism for getting the fragment. A solution could be to wrap the timestamp in an anchor. --- lib/views.ml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/lib/views.ml b/lib/views.ml index c0a6f5c..3d37d20 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -23,7 +23,11 @@ let layout ~title:title_ body_ = (head (title (txt title_)) [style ~a:[a_mime_type "text/css"] [ - txt ".output-ts { white-space: nowrap; }"; + txt ".output-ts {\ + white-space: nowrap;\ + cursor: pointer;\ + user-select: none;\ + }"; txt ".output-code { overflow: visible; }" ]]) (body body_) @@ -75,12 +79,16 @@ let job_run [ h1 [txtf "Job build %s %a" name ptime_pp start]; p [txtf "Build took %a." Ptime.Span.pp delta ]; p [txtf "Execution result: %a." Builder.pp_execution_result result]; - table (List.concat_map (fun (ts, line) -> - [tr [ - td ~a:[a_class ["output-ts"]] - [txtf "%d ms" (Duration.to_ms (Int64.of_int ts))]; - td ~a:[a_class ["output-code"]] - [code [txt line]]; - ]]) - (List.rev out)); + table + (List.mapi (fun idx (ts, line) -> + tr [ + td ~a:[ + a_class ["output-ts"]; + a_id ("L" ^ string_of_int idx); + ] + [txtf "%#d ms" (Duration.to_ms (Int64.of_int ts))]; + td ~a:[a_class ["output-code"]] + [code [txt line]]; + ]) + (List.rev out)); ]