[jenkinscat-docs] master: Added renderer for the configuration page. (64ca299)
immanetize at fedoraproject.org
immanetize at fedoraproject.org
Fri Feb 6 07:40:26 UTC 2015
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 64ca299decda8ee580628efde4c563a214bc50c5
Author: Pavel Tisnovsky <ptisnovs at redhat.com>
Date: Fri Dec 12 13:10:15 2014 +0100
Added renderer for the configuration page.
>---------------------------------------------------------------
ChangeLog | 5 +
src/jenkinscat/renderers/configuration_page.clj | 100 +++++++++++++++++++++++
2 files changed, 105 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 16d9e48..fc65b7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-12 Pavel Tisnovsky <ptisnovs at redhat.com>
+
+ * src/jenkinscat/renderers/configuration_page.clj:
+ Added renderer for the configuration page.
+
2014-12-11 Pavel Tisnovsky <ptisnovs at redhat.com>
* src/jenkinscat/renderers/build_page.clj:
diff --git a/src/jenkinscat/renderers/configuration_page.clj b/src/jenkinscat/renderers/configuration_page.clj
new file mode 100644
index 0000000..9bb3c0c
--- /dev/null
+++ b/src/jenkinscat/renderers/configuration_page.clj
@@ -0,0 +1,100 @@
+;;;
+;;; Jenkinscat HTTP server that handles all requests send from clients/browsers.
+;;;
+;;; Copyright (c) 2014 Pavel Tisnovsky, Red Hat
+;;; All rights reserved.
+;;;
+;;; Redistribution and use in source and binary forms, with or without
+;;; modification, are permitted provided that the following conditions are met:
+;;; * Redistributions of source code must retain the above copyright
+;;; notice, this list of conditions and the following disclaimer.
+;;; * Redistributions in binary form must reproduce the above copyright
+;;; notice, this list of conditions and the following disclaimer in the
+;;; documentation and/or other materials provided with the distribution.
+;;; * Neither the name of the Red Hat nor the
+;;; names of its contributors may be used to endorse or promote products
+;;; derived from this software without specific prior written permission.
+;;;
+;;; THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+;;; ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+;;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+;;; DISCLAIMED. IN NO EVENT SHALL Pavel Tisnovsky BE LIABLE FOR ANY
+;;; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+;;; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+;;; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+;;; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+;;; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+;;; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+;;;
+
+
+
+(ns jenkinscat.renderers.configuration-page)
+
+(require '[hiccup.core :as hiccup])
+(require '[hiccup.page :as page])
+(require '[hiccup.form :as form])
+
+(require '[jenkinscat.renderers.page-header :as page-header-renderer])
+(require '[jenkinscat.renderers.navigation-bar :as navigation-bar-renderer])
+
+(defn render-job-configurations-page
+ "Render page with job configurations."
+ [job-list job-configurations jobs-href-prefix]
+ (page/xhtml
+ (page-header-renderer/page-header "job configurations")
+ [:body
+ (navigation-bar-renderer/navigation-bar "Job configurations")
+
+ [:table {:class "table table-striped table-condensed table-hover table-borderer"}
+ [:tr
+ [:th {:style "width:25%"} "Job name"]
+ [:th {:style "width:20%"} "GIT repo"]
+ [:th {:style "width:8%"} "Branch"]
+ [:th {:style "width:4%"} "Artifact<br />2keep"]
+ [:th {:style "width:5%"} "Trigger"]
+ [:th {:style "width:11%"} "Artifacts"]
+ [:th {:style "width:10%"} "Exclude"]
+ [:th {:style "width:10%"} "IRC"]
+ [:th {:style "width:5%"} "Build script"]
+ ]
+ (for [i (range (count job-list))]
+ (let [job-key (nth job-list i)
+ job-configuration (get job-configurations job-key)]
+ [:tr
+ [:td [:a {:href (str jobs-href-prefix (:job-name job-configuration))} job-key]]
+ [:td (:git-repo job-configuration)]
+ [:td (:branch job-configuration)]
+ [:td (:artifacts2keep job-configuration)]
+ [:td (:trigger job-configuration)]
+ [:td (:artifacts job-configuration)]
+ [:td (:exclude job-configuration)]
+ [:td (:irc job-configuration)]
+ [:td [:a {:href "#" :id (str "code-" i ) :class "btn btn-success" :rel "popover" :title "Build script" :data-placement "left" :data-content (str "<pre>" (:build-script job-configuration) "</pre>")} "Show"]]]))]
+ [:script {:src "http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"}]
+ [:script {:src "http://w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/js/bootstrap-tooltip.js"}]
+ [:script {:src "http://w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/js/bootstrap-popover.js"}]
+ "
+ <script>
+ $(function (){
+ $('#example').popover();
+ "
+ (for [i (range (count job-list))]
+ (let [job-key (nth job-list i)
+ job-configuration (get job-configurations job-key)]
+ (str "\n$('#code-" i "').popover();")))
+
+ "
+ });
+ </script>
+ "
+ [:table {:class "table table-striped table-condensed table-hover table-borderer"}
+ [:tr
+ [:th "Jenkinscat administration"]
+ ]
+ [:tr
+ [:td [:a {:href "/reload-book-list"} "Reload book list"]]
+ ]
+ ]
+]))
+
More information about the docs-commits
mailing list