 
 (defn clean-stream [stream]
   (-> stream
-      (dissoc :schema)
+      (dissoc :schemas)
       (assoc :export :action/export-stream)))
 
 (defn widget-streams [data owner]

          {} (:m schema)))

(defn produce-tree! [data ch ch-click]
  (let [tj (tree->js (schema->tree (:schema (:__unversioned__ (:schemas data)))))
        cd (clj->js {:core {:data tj}})]
    (.jstree ($ :#tree) cd)
    (.on ($ :#tree) "select_node.jstree"

    om/IInitState
    (init-state [_]
      (let [streams (map :stream (:streams data))
            def-schema (first (sort-by #(- (:total-events %))
                                       (:streams data)))
            default (:stream def-schema)]
        {:analyse-stream default
         :analyse-version (first (keys (:schemas def-schema)))
         :streams streams}))
    om/IRenderState
    (render-state [_ state]
      (let [schema (first (filter #(= (:analyse-stream state) (:stream %))
                                  (:streams data)))
            my-schema (get (:schemas schema) (:analyse-version state))
            with-name (merge my-schema (dissoc schema :schemas))]
        (dom/div
         nil
         (dom/h2 nil "Data Analyser")
         (om/build list-streams
                   {:owner owner
                    :analyse-stream (:analyse-stream state)
                    :streams (:streams state)})
         (om/build list-versions {:owner owner :schema schema})
         (om/build stream-schema with-name))))))

(defn full-page [data owner]
  (reify
