   (:use compojure.core)
   (:require [compojure.route :as route]
             [hiccup.core :as hc]
+            [hiccup.page :as page]
             [clojure.data.json :as json :only [write-str]]
             [lambdacd.presentation :as presentation]
             [lambdacd.manualtrigger :as manualtrigger]

        history-column [:div {:class "ui three wide column"} history]
        content-column [:div {:class "ui thirteen wide column"} content]
        columns [:div {:class "ui segment stackable grid"} history-column content-column]
        body (hc/html (list header columns))]
    (str page-start page-end body page-end)))

(defn- pipeline-view [pipeline-def pipeline-state build-number]
  (let [build-history (pipeline-state/history-for pipeline-state)
        pipeline-state-for-build (get pipeline-state (Integer/parseInt build-number))]
    (println "build number" build-number)
    (body (history build-history)
          (pipeline (presentation/display-representation pipeline-def) true pipeline-state-for-build))))

(defn new-ui-routes [pipeline-def pipeline-state]
  (routes

            [ring.util.response :as resp]
            [lambdacd.execution :as execution]
            [lambdacd.pipeline-state :as pipeline-state]))

(defn- refresh-every [seconds]
  [:meta {:http-equiv "refresh" :content (str seconds)}])

(defn page [body]
  (page/html5
         [:head
          [:title "LambdaCD - Pipeline"]
          (refresh-every 5)
          (page/include-css "/ui2/semantic-ui/semantic.css")
          (page/include-css "/ui2/css/main.css")
          (page/include-js "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js")
          (page/include-js "/ui2/semantic-ui/semantic.js")]
          [:body
           body]))

(defn- icon-style-for [{status :status}]
  (case status
