From e9f6e1d577fa462ec78f8d5ae92afa1c784ab7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Reynir=20Bj=C3=B6rnsson?= Date: Wed, 9 Nov 2022 12:12:54 +0100 Subject: [PATCH] /failed-builds: special case no failed builds MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 🥳 --- lib/views.ml | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/lib/views.ml b/lib/views.ml index 116e149..8eccd4d 100644 --- a/lib/views.ml +++ b/lib/views.ml @@ -943,15 +943,22 @@ let failed_builds ~start ~count builds = ] in layout ~title:"Failed builds" - ([ - H.h1 [H.txt "Failed builds"]; - H.ul (List.map build builds); - H.p [ txtf "View the next %d failed builds " count; - H.a ~a:H.[ - a_href @@ Link.Failed_builds.make - ~count ~start:(start + count) () ] - [ H.txt "here"]; - H.txt "."; - ] - ]) + (match builds with + | [] -> + [ + H.h1 [H.txt "No failed builds to list"]; + H.p [H.txt "🥳"]; + ] + | _ :: _ -> + [ + H.h1 [H.txt "Failed builds"]; + H.ul (List.map build builds); + H.p [ txtf "View the next %d failed builds " count; + H.a ~a:H.[ + a_href @@ Link.Failed_builds.make + ~count ~start:(start + count) () ] + [ H.txt "here"]; + H.txt "."; + ] + ])