Views: Syntax betterings for readability

This commit is contained in:
rand00 2022-02-03 14:32:04 +01:00
parent 13f2f91295
commit f1214e01a3

View file

@ -242,7 +242,8 @@ module Builds = struct
Uuidm.pp latest_build.Builder_db.Build.uuid] Uuidm.pp latest_build.Builder_db.Build.uuid]
[txtf "%a" pp_ptime latest_build.Builder_db.Build.start]; [txtf "%a" pp_ptime latest_build.Builder_db.Build.start];
H.txt " "; H.txt " ";
] @ (match latest_artifact with ]
@ (match latest_artifact with
| Some main_binary -> | Some main_binary ->
artifact artifact
~basename:true ~basename:true
@ -252,11 +253,13 @@ module Builds = struct
| None -> | None ->
[ txtf "Build failure: %a" Builder.pp_execution_result [ txtf "Build failure: %a" Builder.pp_execution_result
latest_build.Builder_db.Build.result ] latest_build.Builder_db.Build.result ]
) @ [ H.br () ] )
@ [ H.br () ]
let make_jobs jobs = let make_jobs jobs =
jobs |> List.map (fun (job_name, synopsis, platform_builds) -> jobs |> List.map (fun (job_name, synopsis, platform_builds) ->
H.li ([ H.li (
[
H.a ~a:H.[a_href ("job/" ^ job_name ^ "/")] H.a ~a:H.[a_href ("job/" ^ job_name ^ "/")]
[H.txt job_name]; [H.txt job_name];
H.br (); H.br ();
@ -279,8 +282,7 @@ module Builds = struct
layout ~title:"Reproducible OPAM builds" layout ~title:"Reproducible OPAM builds"
(make_header (make_header
@ make_body section_job_map @ make_body section_job_map
@ @ [ H.p [
[ H.p [
H.txt "View the latest failed builds "; H.txt "View the latest failed builds ";
H.a ~a:H.[a_href "/failed-builds/"] H.a ~a:H.[a_href "/failed-builds/"]
[H.txt "here"]; [H.txt "here"];
@ -295,7 +297,8 @@ module Job = struct
layout layout
~nav:(`Job (job_name, platform)) ~nav:(`Job (job_name, platform))
~title:(Fmt.str "Job %s %a" job_name pp_platform platform) ~title:(Fmt.str "Job %s %a" job_name pp_platform platform)
((H.h1 [txtf "Job %s %a" job_name pp_platform platform] :: (
(H.h1 [txtf "Job %s %a" job_name pp_platform platform] ::
(match readme with (match readme with
| None -> [] | None -> []
| Some data -> | Some data ->
@ -303,12 +306,15 @@ module Job = struct
H.h2 ~a:H.[a_id "readme"] [H.txt "README"]; H.h2 ~a:H.[a_id "readme"] [H.txt "README"];
H.a ~a:H.[a_href "#builds"] [H.txt "Skip to builds"]; H.a ~a:H.[a_href "#builds"] [H.txt "Skip to builds"];
H.Unsafe.data (Utils.Omd.html_of_string data) H.Unsafe.data (Utils.Omd.html_of_string data)
])) @ ])
[ )
@ [
H.h2 ~a:H.[a_id "builds"] [H.txt "Builds"]; H.h2 ~a:H.[a_id "builds"] [H.txt "Builds"];
H.a ~a:H.[a_href "#readme"] [H.txt "Back to readme"]; H.a ~a:H.[a_href "#readme"] [H.txt "Back to readme"];
H.ul (List.map (fun (build, main_binary) -> H.ul (
H.li ([ builds |> List.map (fun (build, main_binary) ->
H.li (
[
check_icon build.Builder_db.Build.result; check_icon build.Builder_db.Build.result;
txtf " %s " build.platform; txtf " %s " build.platform;
H.a ~a:H.[ H.a ~a:H.[
@ -319,7 +325,8 @@ module Job = struct
txtf "%a" pp_ptime build.Builder_db.Build.start; txtf "%a" pp_ptime build.Builder_db.Build.start;
]; ];
H.txt " "; H.txt " ";
] @ match main_binary with ]
@ match main_binary with
| Some main_binary -> | Some main_binary ->
artifact artifact
~basename:true ~basename:true
@ -329,7 +336,7 @@ module Job = struct
| None -> | None ->
[ txtf "Build failure: %a" Builder.pp_execution_result [ txtf "Build failure: %a" Builder.pp_execution_result
build.Builder_db.Build.result ])) build.Builder_db.Build.result ]))
builds); );
if failed then if failed then
H.p [ H.p [
H.txt "Excluding failed builds " ; H.txt "Excluding failed builds " ;