From 8337c05c79ebfd76790f9e5abf884044f063edc8 Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Mon, 2 Dec 2019 13:33:28 +0100 Subject: WIP include nars on the output page --- guix-data-service/web/controller.scm | 4 ++- guix-data-service/web/view/html.scm | 50 +++++++++++++++++++++++++++++++++++- 2 files changed, 52 insertions(+), 2 deletions(-) diff --git a/guix-data-service/web/controller.scm b/guix-data-service/web/controller.scm index 433e34c..a4c5dfb 100644 --- a/guix-data-service/web/controller.scm +++ b/guix-data-service/web/controller.scm @@ -187,7 +187,9 @@ ((file-name output-id rest ...) (select-derivations-using-output conn output-id)))) - derivations))))))) + derivations) + (select-nars-for-output conn + filename))))))) (define handle-static-assets (if assets-dir-in-store? diff --git a/guix-data-service/web/view/html.scm b/guix-data-service/web/view/html.scm index 84c35b8..753cb24 100644 --- a/guix-data-service/web/view/html.scm +++ b/guix-data-service/web/view/html.scm @@ -435,7 +435,10 @@ ,(string-append "/" (string-join fileparts "/")))))) -(define (view-store-item filename derivations derivations-using-store-item-list) +(define (view-store-item filename + derivations + derivations-using-store-item-list + nars) (layout #:body `(,(header) @@ -446,6 +449,51 @@ (div (@ (class "col-sm-12")) ,(display-store-item-title filename))) + (div + (@ (class "row")) + (div + (@ (class "col-sm-12")) + (h2 "Nars") + (a (@ (class "btn btn-default btn-lg pull-right") + (href ,(string-append filename "/narinfos"))) + "View narinfo details") + ,@(map + (match-lambda + ((hash-algorithm hash size urls signatures) + `(div + (h4 (@ (style "font-family: monospace;")) + ,hash) + (table + (@ (class "table") + (style "table-layout: fixed;")) + (thead + (tr + (th (@ (class "col-sm-1")) "Size") + (th (@ (class "col-sm-4")) "Urls"))) + (tbody + (td ,size) + (td + (ul + ,@(map + (lambda (url-details) + `(li + "Size: " ,(assoc-ref url-details "size") + " Compression: " ,(assoc-ref url-details "compression") + " " + (a (@ (href ,(assoc-ref url-details "url"))) + ,(assoc-ref url-details "url")))) + urls))) + (td + ,@(map + (lambda (signature) + `(dl + (@ (class "dl-horizontal")) + (dt "Version") + (dd ,(assoc-ref signature "version")) + (dt "Host name") + (dd ,(assoc-ref signature "host_name")))) + signatures))))))) + nars))) ,@(map (lambda (derivation derivations-using-store-item) `((div (@ (class "row")) -- cgit v1.2.3