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,17 +253,19 @@ 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.txt job_name]; H.a ~a:H.[a_href ("job/" ^ job_name ^ "/")]
H.br (); [H.txt job_name];
H.txt (Option.value ~default:"" synopsis); H.br ();
H.br () H.txt (Option.value ~default:"" synopsis);
] H.br ()
]
@ List.concat_map (make_platform_builds ~job_name) platform_builds) @ List.concat_map (make_platform_builds ~job_name) platform_builds)
) )
@ -279,13 +282,12 @@ 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"]; H.txt "."
H.txt "." ]])
]])
end end
@ -295,52 +297,57 @@ 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] :: (
(match readme with (H.h1 [txtf "Job %s %a" job_name pp_platform platform] ::
| None -> [] (match readme with
| Some data -> | None -> []
[ | Some data ->
H.h2 ~a:H.[a_id "readme"] [H.txt "README"]; [
H.a ~a:H.[a_href "#builds"] [H.txt "Skip to builds"]; H.h2 ~a:H.[a_id "readme"] [H.txt "README"];
H.Unsafe.data (Utils.Omd.html_of_string data) H.a ~a:H.[a_href "#builds"] [H.txt "Skip to builds"];
])) @ H.Unsafe.data (Utils.Omd.html_of_string data)
[ ])
H.h2 ~a:H.[a_id "builds"] [H.txt "Builds"]; )
H.a ~a:H.[a_href "#readme"] [H.txt "Back to readme"]; @ [
H.ul (List.map (fun (build, main_binary) -> H.h2 ~a:H.[a_id "builds"] [H.txt "Builds"];
H.li ([ H.a ~a:H.[a_href "#readme"] [H.txt "Back to readme"];
check_icon build.Builder_db.Build.result; H.ul (
txtf " %s " build.platform; builds |> List.map (fun (build, main_binary) ->
H.a ~a:H.[ H.li (
Fmt.kstr a_href "/job/%s/build/%a/" [
job_name check_icon build.Builder_db.Build.result;
Uuidm.pp build.Builder_db.Build.uuid ] txtf " %s " build.platform;
[ H.a ~a:H.[
txtf "%a" pp_ptime build.Builder_db.Build.start; Fmt.kstr a_href "/job/%s/build/%a/"
]; job_name
H.txt " "; Uuidm.pp build.Builder_db.Build.uuid ]
] @ match main_binary with [
| Some main_binary -> txtf "%a" pp_ptime build.Builder_db.Build.start;
artifact ];
~basename:true H.txt " ";
~job_name ]
~build @ match main_binary with
~file:main_binary | Some main_binary ->
| None -> artifact
[ txtf "Build failure: %a" Builder.pp_execution_result ~basename:true
build.Builder_db.Build.result ])) ~job_name
builds); ~build
if failed then ~file:main_binary
H.p [ | None ->
H.txt "Excluding failed builds " ; [ txtf "Build failure: %a" Builder.pp_execution_result
H.a ~a:H.[a_href "../"] [H.txt "here"] ; build.Builder_db.Build.result ]))
H.txt "." ] );
else if failed then
H.p [ H.p [
H.txt "Including failed builds " ; H.txt "Excluding failed builds " ;
H.a ~a:H.[a_href "failed/"] [H.txt "here"] ; H.a ~a:H.[a_href "../"] [H.txt "here"] ;
H.txt "." ] H.txt "." ]
]) else
H.p [
H.txt "Including failed builds " ;
H.a ~a:H.[a_href "failed/"] [H.txt "here"] ;
H.txt "." ]
])
end end