 ;; Components to start splitting out
 
 (defcomponent clojure-block [data owner]
-  (render-state [_ _] (dom/pre (:input data)))
+  (render-state [_ _] (dom/div (:input data)))
   (did-mount [_]
              (let [editor (.edit js/ace (om/get-node owner))]
                (.setOptions editor


(defcomponent catalog-view [catalog owner]
  (render [_]
          (dom/pre (om/build ankha/collection-view catalog {:opts {:open? true}}))))

(defcomponent job-info [{:keys [deployment visible]} owner]
  (render [_]
          (let [{:keys [selected-job jobs]} deployment] 
            (if-let [job (and selected-job jobs (jobs selected-job))]
              (dom/div
                (dom/pre
                  (om/build section-header {:text "Catalog" 
                                            :visible (:job visible) 
                                            :type :job} {})
                  (if (:job visible)
                    (om/build clojure-block {:input (:pretty-catalog job)})))

                (dom/pre
                  (om/build section-header {:text "Workflow" 
                                            :visible (:workflow visible) 
                                            :type :workflow} {})
                  (if (:workflow visible)
                    (om/build clojure-block {:input (:pretty-workflow job)}))))))))

(defn success-notification [msg]
  (js/noty (clj->js {:text msg


  (render-state [_ {:keys [api-chan]}]
                (dom/div
                 (g/grid {}
                         (r/page-header
                          {}
                          "Onyx Dashboard")
                         (g/row
                          {}
                          (g/col
                           {:xs 6 :md 4}
                           (dom/aside {}
                                      (dom/nav {:class "left-nav-deployment" :style {:width left-bar-width :position "fixed"}} 
                                               (om/build select-deployment app {})
                                               (om/build job-selector deployment {}))))
                          (g/col
                           {:xs 12 :md 11 :md-push 1}
                           (dom/div {:style {:margin-left left-bar-width}}
                                    (om/build job-info {:deployment deployment
                                                        :visible visible} {})
                                    (om/build log-entries-table {:entries (deployment->latest-log-entries deployment)
                                                                 :visible (:log-entries visible)} {}))))))))

(defn main []
  (om/root
