[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
05/08: Implement the JSON response for the package derivations page
From: |
Christopher Baines |
Subject: |
05/08: Implement the JSON response for the package derivations page |
Date: |
Fri, 24 Apr 2020 13:54:47 -0400 (EDT) |
cbaines pushed a commit to branch master
in repository data-service.
commit 7a7dedfa1bf0d623d9a7cb8fc509c85caa3b9fdd
Author: Christopher Baines <address@hidden>
AuthorDate: Fri Apr 24 10:28:44 2020 +0100
Implement the JSON response for the package derivations page
---
guix-data-service/web/revision/controller.scm | 21 ++++++++++++++++++++-
guix-data-service/web/revision/html.scm | 13 +++++++++++++
2 files changed, 33 insertions(+), 1 deletion(-)
diff --git a/guix-data-service/web/revision/controller.scm
b/guix-data-service/web/revision/controller.scm
index 25b7604..9f8592a 100644
--- a/guix-data-service/web/revision/controller.scm
+++ b/guix-data-service/web/revision/controller.scm
@@ -767,7 +767,26 @@
mime-types)
((application/json)
(render-json
- `()))
+ `((derivations . ,(list->vector
+ (map (match-lambda
+ ((derivation system target)
+ `((derivation . ,derivation)
+ ,@(if (member "system" fields)
+ `((system . ,system))
+ '())
+ ,@(if (member "target" fields)
+ `((target . ,target))
+ '())))
+ ((derivation system target builds)
+ `((derivation . ,derivation)
+ ,@(if (member "system" fields)
+ `((system . ,system))
+ '())
+ ,@(if (member "target" fields)
+ `((target . ,target))
+ '())
+ (builds . ,builds))))
+ derivations))))))
(else
(render-html
#:sxml (view-revision-package-derivations
diff --git a/guix-data-service/web/revision/html.scm
b/guix-data-service/web/revision/html.scm
index 2d1b706..35b5782 100644
--- a/guix-data-service/web/revision/html.scm
+++ b/guix-data-service/web/revision/html.scm
@@ -1130,6 +1130,19 @@ figure {
(div
(@ (class "row"))
(div
+ (@ (class "col-sm-12"))
+ (a (@ (class "btn btn-default btn-lg pull-right")
+ (href ,(let ((query-parameter-string
+ (query-parameters->string query-parameters)))
+ (string-append
+ path-base ".json"
+ (if (string-null? query-parameter-string)
+ ""
+ (string-append "?" query-parameter-string))))))
+ "View JSON")))
+ (div
+ (@ (class "row"))
+ (div
(@ (class "col-md-12"))
(h1 "Package derivations")
(p "Showing " ,(length derivations) " results")
- branch master updated (c61a8af -> 5af213a), Christopher Baines, 2020/04/24
- 01/08: Support setting a statement timeout, Christopher Baines, 2020/04/24
- 02/08: Set a statement timeout of 60 seconds for web requests, Christopher Baines, 2020/04/24
- 03/08: Make it clearer that some things relate to package derivations, Christopher Baines, 2020/04/24
- 05/08: Implement the JSON response for the package derivations page,
Christopher Baines <=
- 07/08: Add a JSON output for the revision channel instances, Christopher Baines, 2020/04/24
- 06/08: Fix the field names for the JSON representation of a branch, Christopher Baines, 2020/04/24
- 08/08: Include if data is available in the JSON response for a branch, Christopher Baines, 2020/04/24
- 04/08: Support controlling the fields returned for package derivations, Christopher Baines, 2020/04/24