Toggle hide elements, artifact download links, etc

Add job script, links to artifacts and a way to hide job script, build
log etc
This commit is contained in:
Reynir Björnsson 2020-12-21 11:22:35 +01:00
parent be1ae9cdab
commit bf1777b7cb

View file

@ -41,9 +41,44 @@ let layout ~title:title_ body_ =
overflow: visible;\ overflow: visible;\
white-space: pre;\ white-space: pre;\
}"; }";
txt ".toggleable {\
display: none;\
}";
txt ".toggleable-descr {\
cursor: pointer;\
text-decoration: underline;\
user-select: none;\
}";
txt ":checked + .toggleable {\
display: block;\
}";
]]) ]])
(body body_) (body body_)
let toggleable ?(hidden=true) id description content =
let checked = if hidden then [] else [a_checked ()] in
div [
label
~a:[
a_label_for id;
a_class ["toggleable-descr"];
]
[txt description];
input
~a:(checked @ [
a_input_type `Checkbox;
a_id id;
a_style "display: none;";
]) ();
div
~a:[
a_class ["toggleable"]
]
content;
]
let builder jobs = let builder jobs =
layout ~title:"Builder Web" layout ~title:"Builder Web"
[ h1 [txt "Builder web"]; [ h1 [txt "Builder web"];
@ -81,7 +116,7 @@ let job name runs =
let job_run let job_run
{ Model.meta = { { Model.meta = {
Model.job_info = { Builder.name; _ }; Model.job_info = { Builder.name; script; _ };
start; finish; uuid = _; result }; start; finish; uuid = _; result };
out; data = _ } out; data = _ }
digests digests
@ -95,15 +130,24 @@ let job_run
h3 [txt "Digests of build artifacts"]; h3 [txt "Digests of build artifacts"];
dl (List.concat_map dl (List.concat_map
(fun (path, { Model.sha256; sha512 }) -> [ (fun (path, { Model.sha256; sha512 }) -> [
dt [code [txtf "%a" Fpath.pp path]; dt [a
~a:[Fmt.kstr a_href "f/%a" Fpath.pp path]
[code [txtf "%a" Fpath.pp path]];
txt "(SHA256)"]; txt "(SHA256)"];
dd [code [txtf "%s" (Base64.encode_string sha256)]]; dd [code [txtf "%s" (Base64.encode_string sha256)]];
dt [code [txtf "%a" Fpath.pp path]; dt [a
~a:[Fmt.kstr a_href "f/%a" Fpath.pp path]
[code [txtf "%a" Fpath.pp path]];
txt "(SHA512)"]; txt "(SHA512)"];
dd [code [txtf "%s" (Base64.encode_string sha512)]]; dd [code [txtf "%s" (Base64.encode_string sha512)]];
]) ])
digests); digests);
h3 [txt "Job script"];
toggleable "job-script" "Show/hide"
[ pre [txt script] ];
h3 [txt "Build log"]; h3 [txt "Build log"];
toggleable ~hidden:false "build-log" "Show/hide build log"
[
table table
(List.mapi (fun idx (ts, line) -> (List.mapi (fun idx (ts, line) ->
let ts_id = "L" ^ string_of_int idx in let ts_id = "L" ^ string_of_int idx in
@ -118,4 +162,5 @@ let job_run
[code [txt line]]; [code [txt line]];
]) ])
(List.rev out)); (List.rev out));
];
] ]