             [swarmpit.component.message :as message]
             [swarmpit.component.progress :as progress]
             [swarmpit.component.service.create-image :as images]
+            [swarmpit.component.stack.info :as info]
             [swarmpit.ajax :as ajax]
             [swarmpit.routes :as routes]
             [swarmpit.url :refer [dispatch!]]

          :disabled (not previous?)
          :value    2})))])

(rum/defc form-edit [{:keys [name spec]}
                     {:keys [processing? valid? last? previous?]}]
  [:div
   [:div.form-panel
    [:div.form-panel-left
     (panel/info icon/stacks name)]
    [:div.form-panel-right
     (comp/progress-button
       {:label      "Deploy"
        :disabled   (not valid?)

     {:onValid   #(state/update-value [:valid?] true state/form-state-cursor)
      :onInvalid #(state/update-value [:valid?] false state/form-state-cursor)}
     (form-name name)
     (form/comp
       "COMPOSE FILE SOURCE"
       (comp/select-field
         {:name     "cfs"
          :key      "cfs"
          :required true
          :disabled false
          :value    0}
         (comp/menu-item
           {:key           "current"
            :innerDivStyle info/action-menu-item-style
            :disabled      false
            :primaryText   "Current state"})
         (comp/menu-item
           {:key           "last"
            :innerDivStyle info/action-menu-item-style
            :disabled      false
            :primaryText   "Last deployed"})
         (comp/menu-item
           {:key           "previous"
            :innerDivStyle info/action-menu-item-style
            :disabled      true
            :primaryText   "Previously deployed"})))
     (editor (:compose spec)))])

(rum/defc form < rum/reactive
