 
 (defmulti properties-table-html (fn [properties owner] (:fetching properties)))
 (defmethod properties-table-html :fetching [properties owner]
-  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "Fetching properties for selected project." ]]])
+  (fetching-row properties))
 
 (defmethod properties-table-html :no-data [properties owner]
-  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "No data available for this selection."]]])
+  (no-data-row properties))
 
 (defmethod properties-table-html :error [properties owner]
-  [:div.row
-   [:div.col-md-12.text-center
-    [:p.lead {:style {:padding-top 30}}
-     "There has been an error. Please contact " [:a {:href "mailto:support@mastodonc.com"} "support@mastodonc.com"]]
-    [:p "Error Code: " (:error-status properties) " Message: " (:error-text properties)]]])
+  (error-row properties))
 
 (defmethod properties-table-html :has-data [properties owner]
   (let [table-id "properties-table"


        ;; get the data if we have a new id
        (if (and new-programme-id
                   (not (= (:programme-id projects) new-programme-id)))
          (GET (str "/4/programmes/" new-programme-id "/projects/")
               {:handler  (fn [x]
                            (println "Fetching projects for programme: " new-programme-id)
                            (om/update! projects :data (mapv slugify-project x))
                            (om/update! projects :selected nil))
                ;; TODO: Add Error Handler
                :headers {"Accept" "application/edn"}
                :response-format :text}))

        ;; update our current id with the new one
        (om/update! projects :programme-id new-programme-id)

(defn title-for-sensor [{:keys [selected]}]
  (let [[type _] (str/split selected #"-")]
    type))

(defn error-row [data]
  [:div.row
   [:div.col-md-12.text-center
    [:p.lead {:style {:padding-top 30}}
     "There has been an error. Please contact " [:a {:href "mailto:support@mastodonc.com"} "support@mastodonc.com"]]
    [:p "Error Code: " (:error-status data) " Message: " (:error-text data)]]])

(defn no-data-row [data]
  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "No data available for this selection."]]])

(defn fetching-row [data]
  [:div.row [:div.col-md-12.text-center [:p.lead {:style {:padding-top 30}} "Fetching properties for selected project." ]]])

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; programmes
