From 6658244a186da2ed405bc85d95b3af08cbfdee29 Mon Sep 17 00:00:00 2001 From: rand00 Date: Mon, 20 Dec 2021 15:52:11 +0100 Subject: [PATCH] Views: Only rendering treemap for unikernels with '.debug' artifact --- lib/views.ml | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lib/views.ml b/lib/views.ml index d2223fc..fab8d3a 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -342,6 +342,12 @@ let job ~failed name platform readme builds = p [ txt "Including failed builds " ; a ~a:[a_href "failed/"] [txt "here"] ; txt "." ] ]) +let contains_debug_bin artifacts = + let check f = + Fpath.has_ext "debug" f.Builder_db.filepath + in + List.find_opt check artifacts |> CCOption.is_some + let job_build name ({ Builder_db.Build.uuid; start; finish; result; platform; _ } as build) @@ -350,6 +356,14 @@ let job_build latest next previous = let delta = Ptime.diff finish start in + let analysis_section = if not @@ contains_debug_bin artifacts then [] else [ + h3 [txt "Analysis"]; + p [ + let src = Fmt.str "/job/%s/build/%a/treemap" name Uuidm.pp uuid in + let style = "width: 50em; height: 54.0em" in (*treemap tries to be square*) + iframe ~a:[ a_src src; a_title "Binary dissection"; a_style style ] [] ]; + ] + in let body = h1 [txtf "Job %s" name] :: [ @@ -357,11 +371,7 @@ let job_build p [txtf "Built on platform %s" platform ]; p [txtf "Build took %a." Ptime.Span.pp delta ]; p [txtf "Execution result: %a." Builder.pp_execution_result result]; - h3 [txt "Analysis"]; - p [ - let src = Fmt.str "/job/%s/build/%a/treemap" name Uuidm.pp uuid in - let style = "width: 50em; height: 54.0em" in (*treemap tries to be square*) - iframe ~a:[ a_src src; a_title "Binary dissection"; a_style style ] [] ]; + ] @ analysis_section @ [ h3 [txt "Build info"]; ul [ li [ a ~a:[Fmt.kstr a_href "/job/%s/build/%a/console" name Uuidm.pp uuid]