Show status in job overview
This commit is contained in:
parent
cd1cdcc9bb
commit
355835df5e
2 changed files with 20 additions and 5 deletions
2
lib/dune
2
lib/dune
|
@ -1,3 +1,3 @@
|
|||
(library
|
||||
(name builder_web)
|
||||
(libraries builder opium bos rresult duration))
|
||||
(libraries builder opium tyxml bos rresult duration))
|
||||
|
|
23
lib/views.ml
23
lib/views.ml
|
@ -2,6 +2,15 @@ open Tyxml.Html
|
|||
|
||||
let txtf fmt = Fmt.kstrf txt fmt
|
||||
|
||||
let check_icon check =
|
||||
if check
|
||||
then
|
||||
span ~a:[a_style "color: green;"]
|
||||
[txt "☑"]
|
||||
else
|
||||
span ~a:[a_style "color: red;"]
|
||||
[txt "☒"]
|
||||
|
||||
let layout ~title:title_ body_ =
|
||||
html
|
||||
(head (title (txt title_))
|
||||
|
@ -33,7 +42,10 @@ let job name runs =
|
|||
ul (List.map (fun run ->
|
||||
li [
|
||||
a ~a:[a_href Fpath.(to_string (v "run" / Uuidm.to_string run.Model.uuid) ^ "/")]
|
||||
[txtf "%a" (Ptime.pp_human ()) run.Model.start];
|
||||
[
|
||||
txtf "%a" (Ptime.pp_human ()) run.Model.start;
|
||||
check_icon (match run.result with Builder.Exited 0 -> true | _ -> false);
|
||||
];
|
||||
])
|
||||
runs);
|
||||
|
||||
|
@ -42,12 +54,15 @@ let job name runs =
|
|||
let job_run
|
||||
{ Model.meta = {
|
||||
Model.job_info = { Builder.name; _ };
|
||||
uuid; result; _ };
|
||||
start; finish; uuid; result };
|
||||
out; _ }
|
||||
=
|
||||
let ptime_pp = Ptime.pp_human () in
|
||||
let delta = Ptime.diff finish start in
|
||||
layout ~title:(Printf.sprintf "Job run %s (%s)" name (Uuidm.to_string uuid))
|
||||
[ h1 [txtf "Job build %s (%a)" name Uuidm.pp uuid];
|
||||
p [txtf "Status: %a" Builder.pp_execution_result result];
|
||||
[ h1 [txtf "Job build %s %a (%a)" name ptime_pp start Uuidm.pp uuid];
|
||||
p [txtf "Took %a." Ptime.Span.pp delta ];
|
||||
p [txtf "Status: %a." Builder.pp_execution_result result];
|
||||
div (List.concat_map (fun (ts, line) ->
|
||||
[
|
||||
code [txtf "%d ms %s" (Duration.to_ms (Int64.of_int ts)) line];
|
||||
|
|
Loading…
Reference in a new issue