[jenkinscat-docs] master: Configuration page handler. (8322027)

immanetize at fedoraproject.org immanetize at fedoraproject.org
Sat Feb 7 00:23:59 UTC 2015


Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git

On branch  : master

>---------------------------------------------------------------

commit 8322027aa42cc626cc17270b8279b3c4994599ea
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date:   Fri Feb 6 09:49:05 2015 +0100

    Configuration page handler.


>---------------------------------------------------------------

 ChangeLog                 |    5 ++++
 src/jenkinscat/server.clj |   49 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 54 insertions(+), 0 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3b36cd4..97c3dad 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2015-02-06  Pavel Tisnovsky  <ptisnovs at redhat.com>
+
+	* src/jenkinscat/server.clj:
+	Configuration page handler.
+
 2015-02-05  Pavel Tisnovsky  <ptisnovs at redhat.com>
 
 	* src/jenkinscat/data_fetcher.clj:
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index fc26ce9..5099a98 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -342,6 +342,41 @@
     [output-data]
     (json/write-str output-data))
 
+(defn render-build-configuration-help-page
+    ""
+    []
+    (page/xhtml
+        (page-header-renderer/page-header "build configurations help")
+        [:body
+            (navigation-bar-renderer/navigation-bar "Book type/build configuration help")
+            [:div {:class "col-md-10"}
+                [:h2 "Book type/build configuration help"]
+                [:table {:class "table table-condensed table-hover table-borderer"}
+                    [:tr
+                        [:td {:style "width:20em"} "Book type:"]
+                        [:td "How this book is build"]
+                    ]
+                    [:tr [:td "&nbsp;"] [:td "&nbsp;"] [:td "&nbsp;"]]
+                    [:tr
+                        [:td [:button {:class "btn btn-info" :onclick "window.close();" :type "button"} "Close"]]
+                        [:td "&nbsp"]
+                    ]
+                ]]
+        ]))
+
+(defn generate-response-html
+    "Generate HTTP response for the given request."
+    [page-content session]
+    (-> (http-response/response page-content)
+        (http-response/content-type "text/html; charset=utf-8")
+        (assoc :session session)))
+
+(defn generate-response-json
+    "Generate HTTP response for the given request."
+    [page-content]
+    (-> (http-response/response page-content)
+        (http-response/content-type "application/json; charset=utf-8")))
+
 (defn update-job-name
     "Update job names - we don't need the postfix string."
     [dirname]
@@ -561,6 +596,20 @@
     (if (not (bound? (find-var  'jenkinscat.books/books)))
         (books/read-books)))
 
+(defn json-data-exporter
+    "Dynamically creates file containing JSON data about books."
+    []
+    ; make sure books are read even in devel mode
+    (read-books-if-not-loaded)
+    (let [;data-json (json/read-str (slurp "www/data.json"))
+          products      (get-products)
+          output-data   (generate-output-data products books/books)
+          json-data     (render-json-data output-data)]
+        (spit "data2.json" json-data)
+        ; rename files atomically (on the same filesystem)
+        (fileutils/mv-file "data2.json" "data.json")
+        ))
+
 (defn json-data-handler
     "Dynamically generate JSON data on demand and send them back to client/browser."
     [uri params session]



More information about the docs-commits mailing list