[jenkinscat-docs] master: Change logic used to read info about middleware books. (af9fa04)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit af9fa040fb128edd9b30e0e5b6349f54bed288a7
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Dec 19 16:37:13 2014 +0100
Change logic used to read info about middleware books.
>---------------------------------------------------------------
ChangeLog | 5 +++++
src/jenkinscat/server.clj | 29 ++++++++++++++++-------------
2 files changed, 21 insertions(+), 13 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b2ab836..707f7b9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * src/jenkinscat/server.clj:
+ Change logic used to read info about middleware books.
+
+2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/fileutils.clj:
* src/jenkinscat/server.clj:
Updated to call functions from proper modules.
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index 10377d6..58e3836 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -113,17 +113,17 @@
:else (str config/jobs-href-prefix job-name "%20(html-single)/lastStableBuild/artifact/tmp/en-US/html-single/index.html")))
;(str "<a href='" config/jobs-href-prefix job-name "%20(html-single)/lastStableBuild/artifact/tmp/en-US/html-single/index.html'>link</a>"))
-(defn href-to-file-middleware
- [job-name-prefix job-name-postfix extension]
- (str config/jobs-href-prefix job-name-prefix "/lastStableBuild/artifact/output/" job-name-postfix "/" job-name-postfix "." extension))
-
(defn href-to-pdf-middleware
- [job-name-prefix job-name-postfix]
- (href-to-file-middleware job-name-prefix job-name-postfix "pdf"))
+ [job-name job-name-postfix]
+ (let [directory (fileutils/new-file (str config/jobs-dir-prefix job-name "/lastStable/archive/publican/" job-name-postfix "/tmp/en-US/pdf/"))
+ filelist (.listFiles directory)]
+ (if (<= 1 (count filelist))
+ (str config/jobs-href-prefix job-name "/lastStableBuild/artifact/publican/" job-name-postfix "/tmp/en-US/pdf/" (.getName (first filelist)))
+ nil)))
(defn href-to-single-html-middleware
[job-name-prefix job-name-postfix]
- (href-to-file-middleware job-name-prefix job-name-postfix "html"))
+ (str config/jobs-href-prefix job-name-prefix "/lastStableBuild/artifact/publican/" job-name-postfix "/tmp/en-US/html-single/index.html"))
(defn pdf-exists?
"Test for existence of PDF file(s) generated by Jenkins."
@@ -201,7 +201,9 @@
[job-name extension]
(let [job-name-prefix (get-job-name-prefix job-name)
job-name-postfix (get-job-name-postfix job-name)
- path-to-file (str config/jobs-dir-prefix job-name-prefix "/lastStable/archive/output/" job-name-postfix "/" job-name-postfix "." extension)]
+ path-to-file (if (= extension "html")
+ (str config/jobs-dir-prefix job-name-prefix "/lastStable/archive/publican/" job-name-postfix "/tmp/en-US/html-single/index.html")
+ (str config/jobs-dir-prefix job-name-prefix "/lastStable/archive/publican/" job-name-postfix "/tmp/en-US/pdf/" name ".pdf"))]
path-to-file))
(defn get-path-to-middleware-job-html
@@ -213,16 +215,17 @@
(get-path-to-middleware-job job-name "pdf"))
(defn pdf-exists-middleware-job?
- [job-name]
- (let [path-to-html (get-path-to-middleware-job-pdf job-name)
- file (fileutils/new-file path-to-html)]
- (.isFile file)))
+ "Test for existence of PDF file(s) generated by Jenkins."
+ [job-name job-name-postfix]
+ (let [directory (fileutils/new-file (str config/jobs-dir-prefix job-name "/lastStable/archive/publican/" job-name-postfix "/tmp/en-US/pdf/"))
+ filelist (.listFiles directory)]
+ (>= 1 (count filelist))))
(defn get-path-to-pdf-middleware-book
[job-name]
(let [job-name-prefix (get-job-name-prefix job-name)
job-name-postfix (get-job-name-postfix job-name)]
- (if (pdf-exists-middleware-job? job-name)
+ (if (pdf-exists-middleware-job? job-name job-name-postfix)
(href-to-pdf-middleware job-name-prefix job-name-postfix)
nil)))
9 years, 4 months
[jenkinscat-docs] master: Updated to call functions from proper modules. (4feca7d)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 4feca7da1c5af7d972ee50904905511955f12053
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Dec 19 16:35:44 2014 +0100
Updated to call functions from proper modules.
>---------------------------------------------------------------
ChangeLog | 6 ++++++
src/jenkinscat/fileutils.clj | 1 +
src/jenkinscat/server.clj | 16 ++++++++++++++--
3 files changed, 21 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 9ed24eb..b2ab836 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-19 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/fileutils.clj:
+ * src/jenkinscat/server.clj:
+ Updated to call functions from proper modules.
+
2014-12-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* make-jar.sh:
diff --git a/src/jenkinscat/fileutils.clj b/src/jenkinscat/fileutils.clj
index cd9d4a1..f3abef7 100644
--- a/src/jenkinscat/fileutils.clj
+++ b/src/jenkinscat/fileutils.clj
@@ -25,6 +25,7 @@
;;; 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.
+;;;
diff --git a/src/jenkinscat/server.clj b/src/jenkinscat/server.clj
index f061139..10377d6 100644
--- a/src/jenkinscat/server.clj
+++ b/src/jenkinscat/server.clj
@@ -45,6 +45,18 @@
(require '[jenkinscat.exec :as exec])
(require '[jenkinscat.file-handlers :as file-handlers])
+(require '[jenkinscat.renderers.page-header :as page-header-renderer])
+(require '[jenkinscat.renderers.navigation-bar :as navigation-bar-renderer])
+(require '[jenkinscat.renderers.build-page :as build-page-renderer])
+(require '[jenkinscat.renderers.error-page :as error-page-renderer])
+(require '[jenkinscat.renderers.configuration-page :as configuration-page-renderer])
+(require '[jenkinscat.renderers.statistics-page :as statistics-page-renderer])
+
+(require '[jenkinscat.renderers.add-book-step-1-page :as add-book-step-1-renderer])
+(require '[jenkinscat.renderers.add-book-step-1-error-pages :as add-book-step-1-error-pages-renderer])
+(require '[jenkinscat.renderers.add-book-step-2-page :as add-book-step-2-renderer])
+(require '[jenkinscat.renderers.add-book-step-2-error-pages :as add-book-step-2-error-pages-renderer])
+(require '[jenkinscat.renderers.add-book-step-3-page :as add-book-step-3-renderer])
(require '[clojure.xml :as xml])
@@ -767,7 +779,7 @@
"Handler for a user request to start a new build."
[uri params session]
(let [job-name (get params "job-name")
- page-content (render-build-page job-name)]
+ page-content (build-page-renderer/render-build-page config/hostname job-name)]
(start-build job-name)
(generate-response-html page-content session)
))
@@ -866,7 +878,7 @@
(read-books-if-not-loaded)
(let [job-list (sort (get-job-list books/books))
job-configurations (read-job-configurations job-list)
- page-content (render-job-configurations-page job-list job-configurations)]
+ page-content (configuration-page-renderer/render-job-configurations-page job-list job-configurations config/jobs-href-prefix)]
(generate-response-html page-content session)))
(defn reload-books-list-handler
9 years, 4 months
[jenkinscat-docs] master: Added license text into two other scripts. (1b0657b)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 1b0657b1a491b7d86b22b60f38348abfb74dd09e
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Tue Dec 16 11:28:22 2014 +0100
Added license text into two other scripts.
>---------------------------------------------------------------
ChangeLog | 6 ++++++
make-jar.sh | 30 ++++++++++++++++++++++++++++++
make-tarball.sh | 30 ++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 8c2f8a4..9ed24eb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
2014-12-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * make-jar.sh:
+ * make-tarball.sh:
+ Added license text into two other scripts.
+
+2014-12-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* devel-start-headless.sh:
* devel-start.sh:
Added license text into those two scripts.
diff --git a/make-jar.sh b/make-jar.sh
index 5697f95..c3b5e03 100755
--- a/make-jar.sh
+++ b/make-jar.sh
@@ -1,2 +1,32 @@
+#!/usr/bin/env bash
+
+#
+# Generator of a page containing all books built by Jenkins.
+#
+# Copyright (c) 2014 Pavel Tisnovsky <ptisnovs(a)redhat.com>, 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.
+
lein uberjar
diff --git a/make-tarball.sh b/make-tarball.sh
index 5583fd0..3e7cef1 100755
--- a/make-tarball.sh
+++ b/make-tarball.sh
@@ -1,3 +1,33 @@
+#!/usr/bin/env bash
+
+#
+# Generator of a page containing all books built by Jenkins.
+#
+# Copyright (c) 2014 Pavel Tisnovsky <ptisnovs(a)redhat.com>, 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.
+
./make-jar.sh
version=`grep "SNAPSHOT" project.clj | sed 's/.*\"\(.*\)\-SNAPSHOT"/\1/'`
9 years, 4 months
[jenkinscat-docs] master: Added license text into those two scripts. (90ed603)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 90ed60372e156a409ec63b6e243dd3e3e2a2b054
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Tue Dec 16 11:26:31 2014 +0100
Added license text into those two scripts.
>---------------------------------------------------------------
ChangeLog | 6 ++++++
devel-start-headless.sh | 30 ++++++++++++++++++++++++++++++
devel-start.sh | 30 ++++++++++++++++++++++++++++++
3 files changed, 66 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f946d61..8c2f8a4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-16 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * devel-start-headless.sh:
+ * devel-start.sh:
+ Added license text into those two scripts.
+
2014-12-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/renderers/add_book_step_1_page.clj:
diff --git a/devel-start-headless.sh b/devel-start-headless.sh
index 17dee4e..4c61499 100755
--- a/devel-start-headless.sh
+++ b/devel-start-headless.sh
@@ -1,2 +1,32 @@
+#!/usr/bin/env bash
+
+#
+# Generator of a page containing all books built by Jenkins.
+#
+# Copyright (c) 2014 Pavel Tisnovsky <ptisnovs(a)redhat.com>, 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.
+
lein ring server-headless 6502
diff --git a/devel-start.sh b/devel-start.sh
index 10d67cb..c91f5d7 100755
--- a/devel-start.sh
+++ b/devel-start.sh
@@ -1,2 +1,32 @@
+#!/usr/bin/env bash
+
+#
+# Generator of a page containing all books built by Jenkins.
+#
+# Copyright (c) 2014 Pavel Tisnovsky <ptisnovs(a)redhat.com>, 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.
+
lein ring server 6502
9 years, 4 months
[jenkinscat-docs] master: Updated. (6079b2b)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 6079b2b0fdd04547d4ac83de2ec4e59360bff953
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Mon Dec 15 10:42:51 2014 +0100
Updated.
>---------------------------------------------------------------
ChangeLog | 5 ++
src/jenkinscat/renderers/add_book_step_1_page.clj | 75 ++++++++++++++++++---
2 files changed, 71 insertions(+), 9 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index b7a6a28..f946d61 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-12-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * src/jenkinscat/renderers/add_book_step_1_page.clj:
+ Updated.
+
+2014-12-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/renderers/navigation_bar.clj:
Added common renderer for the navigation bar.
diff --git a/src/jenkinscat/renderers/add_book_step_1_page.clj b/src/jenkinscat/renderers/add_book_step_1_page.clj
index 10f2a3a..084036a 100644
--- a/src/jenkinscat/renderers/add_book_step_1_page.clj
+++ b/src/jenkinscat/renderers/add_book_step_1_page.clj
@@ -45,20 +45,77 @@
(page-header-renderer/page-header "add book")
[:body
[:script "
+ function changeSubmitButtonState()
+ {
+ var submitButton = document.getElementById('submit');
+ var repoUrlValue = document.getElementById('repository-url').value;
+ var repoPrefixValue = document.getElementById('repo-prefix').innerText;
+
+ if (repoUrlValue == '' || repoPrefixValue == '')
+ {
+ submitButton.disabled = 'disabled';
+ }
+ else
+ {
+ submitButton.disabled = '';
+ }
+ }
function updateRepositoryPrefix()
{
var repoPrefixElement = document.getElementById('repo-prefix');
var repoType = document.getElementById('repository-type').value;
var repoPrefix = ''
- if (repoType == 'GitHub')
+ var submitButton = document.getElementById('submit');
+
+ var repositoryTdElement = document.getElementById('repository-type-td');
+ var repositoryTd2Element = document.getElementById('repository-type-2-td');
+
+ if (repoType == 'GitHub') {
repoPrefix = 'https://github.com/';
- if (repoType == 'SVN (internal)')
+ repositoryTdElement.className = '';
+ repositoryTd2Element.className = '';
+ }
+ else if (repoType == 'SVN (internal)') {
repoPrefix = 'https://svn.devel.redhat.com/repos/'
- if (repoType == 'Gerrit (internal GIT)')
+ repositoryTdElement.className = '';
+ repositoryTd2Element.className = '';
+ }
+ else if (repoType == 'Gerrit (internal GIT)') {
repoPrefix = 'git://git.app.eng.bos.redhat.com/';
- if (repoType == 'Fedora GIT')
+ repositoryTdElement.className = '';
+ repositoryTd2Element.className = '';
+ }
+ else if (repoType == 'Fedora GIT') {
repoPrefix = 'git://git.fedorahosted.org/git/docs/';
+ repositoryTdElement.className = '';
+ repositoryTd2Element.className = '';
+ }
+ else {
+ repoPrefix = '';
+ repositoryTdElement.className = 'danger';
+ repositoryTd2Element.className = 'danger';
+ }
repoPrefixElement.innerText = repoPrefix;
+ changeSubmitButtonState();
+ }
+ function updateRepositoryUrl()
+ {
+ var repoUrlTd1Element = document.getElementById('repository-url-td');
+ var repoUrlTd2Element = document.getElementById('repository-prefix-td');
+ var submitButton = document.getElementById('submit');
+
+ var repoUrlValue = document.getElementById('repository-url').value;
+ if (repoUrlValue == '')
+ {
+ repoUrlTd1Element.className = 'danger';
+ repoUrlTd2Element.className = 'danger';
+ }
+ else
+ {
+ repoUrlTd1Element.className = '';
+ repoUrlTd2Element.className = '';
+ }
+ changeSubmitButtonState();
}
"]
(navigation-bar-renderer/navigation-bar "Add book")
@@ -68,13 +125,13 @@
[:table {:class "table table-condensed table-hover table-borderer"}
[:tr
[:td {:style "width:20%"} "Repository type:"]
- [:td {:style "width:20%"} (form/drop-down {:onChange "updateRepositoryPrefix()"} "repository-type" ["Please select repository type" "Gerrit (internal GIT)" "GitHub" "Fedora GIT" "SVN (internal)",])]
- [:td " "]
+ [:td {:style "width:20%" :id "repository-type-td" :class "danger"} (form/drop-down {:onChange "updateRepositoryPrefix()"} "repository-type" ["Please select repository type" "Gerrit (internal GIT)" "GitHub" "Fedora GIT" "SVN (internal)",])]
+ [:td {:id "repository-type-2-td" :class "danger"} " "]
]
[:tr
[:td "Repository name"]
- [:td [:div {:id "repo-prefix"} " "]]
- [:td (form/text-field {:size "60" :class "-form-control"} "repository-url")]
+ [:td {:id "repository-prefix-td" :class "danger"} [:div {:id "repo-prefix"} " "]]
+ [:td {:id "repository-url-td" :class "danger"} (form/text-field {:size "60" :class "-form-control" :onKeyup "updateRepositoryUrl()"} "repository-url")]
]
; [:tr
; [:td "Book type/build configuration:"]
@@ -89,7 +146,7 @@
; [:tr [:td " "] [:td " "] [:td " "]]
[:tr
[:td " "]
- [:td (form/submit-button {:class "btn btn-primary"} "Continue")]
+ [:td (form/submit-button {:class "btn btn-primary" :id "submit" :disabled "disabled"} "Continue")]
[:td " "]
]
]]
9 years, 4 months
[jenkinscat-docs] master: Added common renderer for the navigation bar. (6a3cfb9)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 6a3cfb9f56ac16cd39882869f8bcc965c1e9414d
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Mon Dec 15 10:41:09 2014 +0100
Added common renderer for the navigation bar.
>---------------------------------------------------------------
ChangeLog | 5 ++
src/jenkinscat/renderers/navigation_bar.clj | 71 +++++++++++++++++++++++++++
2 files changed, 76 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 21170fb..b7a6a28 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-15 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/renderers/navigation_bar.clj:
+ Added common renderer for the navigation bar.
+
2014-12-12 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/renderers/error_page.clj:
diff --git a/src/jenkinscat/renderers/navigation_bar.clj b/src/jenkinscat/renderers/navigation_bar.clj
new file mode 100644
index 0000000..9ee1638
--- /dev/null
+++ b/src/jenkinscat/renderers/navigation_bar.clj
@@ -0,0 +1,71 @@
+;;;
+;;; 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.navigation-bar)
+
+(require '[hiccup.core :as hiccup])
+(require '[hiccup.page :as page])
+(require '[hiccup.form :as form])
+
+(defn navigation-bar
+ [title]
+ [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
+ [:div {:class "container-fluid"}
+ [:div {:class "navbar-header"}
+ [:button {:type "button" :class "navbar-toggle" :data-toggle "collapse"}
+ [:span {:class "sr-only"} "Toggle navigation"]
+ [:span {:class "icon-bar"}]
+ [:span {:class "icon-bar"}]
+ [:span {:class "icon-bar"}]
+ ]
+ [:img {:class "navbar-brand-" :style "float:left" :src "jenkinscat.png"}]
+ [:a {:href "/" :class "navbar-brand"} " Jenkinscat"]
+ ] ; ./navbar-header
+ [:div {:class "col-md-4"}
+ [:form {:class "navbar-form navbar-left"}
+ [:div {:class "form-group"}
+ "<input disabled='disabled' autofocus='autofocus' size='40' type='text' class='form-control' ng-model='search' placeholder='' id='searchinput'>"
+ ]
+ ]
+ ] ; col ends
+ [:div {:class "col-md"}
+ [:a {:href "/job-configurations" :class "navbar-brand"} "Job configurations"]
+ ] ; col ends
+ [:div {:class "col-md"}
+ [:a {:href "/statistics" :class "navbar-brand"} "Statistics"]
+ ] ; col ends
+ [:div {:class "col-md"}
+ [:a {:href "/add-book-step-1" :class "navbar-brand"} "Add book"]
+ ] ; col ends
+ ] ; /.container-fluid
+ ]
+)
+
9 years, 4 months
[jenkinscat-docs] master: Added renderer for the error pages. (b9b4b4a)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit b9b4b4aeba6c80278484fe55408bfaf0b71c7995
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Fri Dec 12 13:11:18 2014 +0100
Added renderer for the error pages.
>---------------------------------------------------------------
ChangeLog | 5 ++
.../{config.clj => renderers/error_page.clj} | 50 ++++++++-----------
2 files changed, 26 insertions(+), 29 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index fc65b7c..21170fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-12-12 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * src/jenkinscat/renderers/error_page.clj:
+ Added renderer for the error pages.
+
+2014-12-12 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/renderers/configuration_page.clj:
Added renderer for the configuration page.
diff --git a/src/jenkinscat/config.clj b/src/jenkinscat/renderers/error_page.clj
similarity index 68%
copy from src/jenkinscat/config.clj
copy to src/jenkinscat/renderers/error_page.clj
index eced421..d0821b9 100644
--- a/src/jenkinscat/config.clj
+++ b/src/jenkinscat/renderers/error_page.clj
@@ -29,33 +29,25 @@
-(ns jenkinscat.config)
-
-(def hostname
- "Hostname of this computer"
- (.getHostName (java.net.InetAddress/getLocalHost)))
-
-(def jobs-dir-prefix
- "Path to the directory where are stored all Jenkins jobs."
- "/var/lib/jenkins/jobs/")
-
-(def jobs-href-prefix
- "URL prefix for all Jenkins jobs."
- (str "http://" hostname ":8080/job/"))
-
-(def json-url
- "URL prefix for all requests based on JSON."
- (str "http://" hostname ":8080/"))
-
-(def test-results-url-prefix
- "URL prefix for all tests (ie.test jobs)."
- (str "http://" hostname "/tests/"))
-
-(def test-results-prefix
- "Path where test results will be stored."
- "/var/www/html/tests/")
-
-(def devel-version
- "Whether devel mode should be on."
- true)
+(ns jenkinscat.renderers.error-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-error-page
+ "Render error page with a 'back' button."
+ [page-title header-title message]
+ (page/xhtml
+ (page-header-renderer/page-header page-title)
+ [:body
+ (navigation-bar-renderer/navigation-bar "")
+ [:div {:class "col-md-10"}
+ [:h2 header-title]
+ [:p message]
+ [:button {:class "btn btn-primary" :onclick "window.history.back()" :type "button"} "Back"]
+ ]]))
9 years, 4 months
[jenkinscat-docs] master: Added renderer for the configuration page. (64ca299)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 64ca299decda8ee580628efde4c563a214bc50c5
Author: Pavel Tisnovsky <ptisnovs(a)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(a)redhat.com>
+
+ * src/jenkinscat/renderers/configuration_page.clj:
+ Added renderer for the configuration page.
+
2014-12-11 Pavel Tisnovsky <ptisnovs(a)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..."}]
+ [:script {:src "http://w3resource.com/twitter-bootstrap/twitter-bootstrap-v2/js/bootstrap..."}]
+ "
+ <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"]]
+ ]
+ ]
+]))
+
9 years, 4 months
[jenkinscat-docs] master: Build page renderer. (4f79242)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit 4f79242ecd21072fa500fea03363b97ab5e09f70
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Dec 11 14:14:56 2014 +0100
Build page renderer.
>---------------------------------------------------------------
ChangeLog | 5 ++
src/jenkinscat/renderers/build_page.clj | 78 +++++++++++++++++++++++++++++++
2 files changed, 83 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 05d8b3f..16d9e48 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2014-12-11 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+ * src/jenkinscat/renderers/build_page.clj:
+ Build page renderer.
+
+2014-12-11 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
* src/jenkinscat/renderers/add_book_step_3_page.clj:
Added 4th renderer: dialog to add new book/job.
diff --git a/src/jenkinscat/renderers/build_page.clj b/src/jenkinscat/renderers/build_page.clj
new file mode 100644
index 0000000..d1f94fb
--- /dev/null
+++ b/src/jenkinscat/renderers/build_page.clj
@@ -0,0 +1,78 @@
+;;;
+;;; 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.build-page)
+
+(defn render-build-page
+ "Render page with info about build."
+ [hostname job-name]
+ (str "
+<html>
+ <head>
+ <title>Job build started</title>
+ <link rel='stylesheet' href='css/bootstrap.min.css'>
+
+ <!-- Optional theme -->
+ <link rel='stylesheet' href='css/bootstrap-theme.min.css'>
+ <link href='css/Jenkinscat.css' rel='stylesheet' type='text/css'>
+ </head>
+ <body ng-app='jenkinscat' ng-controller='jenkinscatApp'><div class='container-fluid'>
+ <nav class='navbar navbar-inverse navbar-fixed-top' role='navigation'>
+ <div class='container-fluid'>
+ <!-- Brand and toggle get grouped for better mobile display -->
+ <div class='navbar-header'>
+ <button type='button' class='navbar-toggle' data-toggle='collapse' data-target='#bs-example-navbar-collapse-1'>
+ <span class='sr-only'>Toggle navigation</span>
+ <span class='icon-bar'></span>
+ <span class='icon-bar'></span>
+ <span class='icon-bar'></span>
+ </button>
+ <img class='navbar-brand-' style='float:left' src='jenkinscat.png' />
+ <a class='navbar-brand' href='#'> Jenkinscat</a>
+ </div>
+
+ </div><!-- /.container-fluid -->
+ </nav>
+ <h3>Build for the job '" job-name "' has been added into job queue.</h3>
+ <table class='table table-condensed table-hover table-bordered'>
+ <tr>
+ <td><a href='http://" hostname ":8080/job/" job-name "%20(html-single)'>Build details for the HTML-single book</a></td>
+ </tr>
+ <tr>
+ <td><a href='http://" hostname ":8080/job/" job-name "%20(PDF)'>Build details for the PDF book</a></td>
+ </tr>
+ <tr>
+ <td><a href='/'>Back to Jenkinscat front page</a></td>
+ </tr>
+ </table>
+ </body>
+</html>"))
+
9 years, 4 months
[jenkinscat-docs] master: Added 4th renderer: dialog to add new book/job. (d6194ca)
by Pete Travis
Repository : http://git.fedorahosted.org/cgit/jenkinscat-docs.git
On branch : master
>---------------------------------------------------------------
commit d6194ca26bbdb9fdb0f35fe7a63235c65e0c5267
Author: Pavel Tisnovsky <ptisnovs(a)redhat.com>
Date: Thu Dec 11 14:13:46 2014 +0100
Added 4th renderer: dialog to add new book/job.
>---------------------------------------------------------------
ChangeLog | 5 +
src/jenkinscat/renderers/add_book_step_3_page.clj | 141 +++++++++++++++++++++
2 files changed, 146 insertions(+), 0 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0b56904..05d8b3f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-11 Pavel Tisnovsky <ptisnovs(a)redhat.com>
+
+ * src/jenkinscat/renderers/add_book_step_3_page.clj:
+ Added 4th renderer: dialog to add new book/job.
+
2014-12-09 Pavel Tisnovsky <ptisnovs(a)redhat.com>
* src/jenkinscat/renderers/page_header.clj:
diff --git a/src/jenkinscat/renderers/add_book_step_3_page.clj b/src/jenkinscat/renderers/add_book_step_3_page.clj
new file mode 100644
index 0000000..2d1f413
--- /dev/null
+++ b/src/jenkinscat/renderers/add_book_step_3_page.clj
@@ -0,0 +1,141 @@
+;;;
+;;; 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.add-book-step-3-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-add-book-step-3
+ "Render page with a question how to build the book."
+ [document-title product-name product-number component-name component-product repository-type repository-name repository-url]
+ (page/xhtml
+ (page-header-renderer/page-header "add book, step 2")
+ [:body
+ [:script "
+ function updateScriptText()
+ {
+ var scriptTextElement = document.getElementById('script-text');
+ var selectedScript = document.getElementById('build-script').value;
+ var buildScript = ''
+ var submitButton = document.getElementById('submit');
+
+ submitButton.disabled = 'disabled';
+
+ if (selectedScript == 'DocBook') {
+ buildScript = 'publican build --langs en-US --format %';
+ submitButton.disabled = '';
+ }
+ if (selectedScript == 'AsciiDoctor') {
+ buildScript = 'asciidoctor -d book -b docbook -a nolang -a docinfo -a noxmlns %';
+ submitButton.disabled = '';
+ }
+ if (selectedScript == 'Markdown to HTML') {
+ buildScript = 'pandoc -f markdown -t html -c kultiad-serif.css -o index.html %';
+ submitButton.disabled = '';
+ }
+ scriptTextElement.innerText = buildScript;
+ }
+ "]
+ (navigation-bar-renderer/navigation-bar "Add book")
+ (form/form-to [:post "/add-book-step-4"]
+ [:div {:class "col-md-10"}
+ [:h2 "Add book, step 3/3"]
+ [:table {:class "table table-condensed table-hover table-borderer"}
+ [:tr {:class "danger"}
+ [:td "Please select method used to build this book:"]
+ [:td (form/drop-down {:onChange "updateScriptText()"} "build-script" ["Select..." "DocBook" "AsciiDoctor" "Markdown to HTML"])]
+ [:td " "]
+ ]
+ [:tr [:td " "] [:td {:colspan 2} [:div {:id "script-text"} " "]]]
+ [:tr [:td " "] [:td " "] [:td " "]]
+ [:tr
+ [:td {:width "30%"} "Book name:"]
+ [:td (form/text-field {:size "40" :class "-form-control" :style "border-width:1px;border-color:red" :readonly "readonly"} "document-title" document-title)]
+ [:td " "]
+ ]
+ [:tr [:td " "] [:td " "] [:td " "]]
+ [:tr
+ [:td "Product name:"]
+ [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "product-name" product-name)]
+ [:td " "]
+ ]
+ [:tr
+ [:td "Product number"]
+ [:td (form/text-field {:size "20" :class "-form-control" :readonly "readonly"} "product-number" product-number)]
+ [:td " "]
+ ]
+ [:tr [:td " "] [:td " "] [:td " "]]
+ [:tr
+ [:td "Bugzilla component name:"]
+ [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "component-name" component-name)]
+ [:td " "]
+ ]
+ [:tr
+ [:td "Bugzilla product name for given component:"]
+ [:td (form/text-field {:size "40" :class "-form-control" :readonly "readonly"} "component-product" component-product)]
+ [:td " "]
+ ]
+ [:tr [:td " "] [:td " "] [:td " "]]
+ [:tr
+ [:td "Repository: (not editable)"]
+ [:td " "]
+ [:td " "]
+ ]
+ [:tr
+ [:td "Repository type:"]
+ [:td (form/text-field {:size "20" :class "-form-control" :readonly "readonly"} "repository-type" repository-type)]
+ [:td " "]
+ ]
+ [:tr
+ [:td "Repository name:"]
+ [:td (form/text-field {:size "70" :class "-form-control" :readonly "readonly"} "repository-name" repository-name)]
+ [:td " "]
+ ]
+ [:tr
+ [:td "Repository URL"]
+ [:td (form/text-field {:size "100" :class "-form-control" :readonly "readonly"} "repository-url" repository-url)]
+ [:td " "]
+ ]
+ [:tr [:td " "] [:td " "] [:td " "]]
+ [:tr
+ [:td " "]
+ [:td (form/submit-button {:class "btn btn-primary" :id "submit" :disabled "disabled"} "Finish")]
+ [:td " "]
+ ]
+ ]]
+ )
+ ]))
+
9 years, 4 months