            [:hr]
            (clear-cache-button "source" project-data owner)]]]))))
 
-(defn remove-env-var-button [{:keys [env-var project-id]} owner]
-  (reify
-    om/IInitState
-    (init-state [_]
-      {:show-modal? false})
-    om/IRenderState
-    (render-state [_ {:keys [show-modal?]}]
-      (html
-       [:span
-        (table/action-button
-         "Remove"
-         (icon/delete)
-         #(om/set-state! owner :show-modal? true))
-        (when show-modal?
-          (let [close-fn #(om/set-state! owner :show-modal? false)]
-            (modal/modal-dialog {:title "Are you sure?"
-                                 :body (html
-                                        [:span
-                                         "Are you sure you want to remove the environment variable \""
-                                         (:name env-var)
-                                         "\"?"])
-                                 :actions [(button/button {:on-click close-fn} "Cancel")
-                                           (button/button {:primary? true
-                                                           :on-click #(raise! owner [:deleted-env-var {:project-id project-id
-                                                                                                       :env-var-name (:name env-var)}])}
-                                                          "Remove")]
-                                 :close-fn close-fn})))]))))
-
 (defn env-vars [project-data owner]
   (reify
     om/IInitState

            (om/build common/flashes error-message)
            (om/build body-component body-params)]]]]))))

(defn remove-p12-button [row owner]
  (reify
    om/IInitState
    (init-state [_]
      {:show-modal? false})
    om/IRenderState
    (render-state [_ {:keys [show-modal?]}]
      (html
       [:span
        (table/action-button
         "Remove"
         (icon/delete)
         #(om/set-state! owner :show-modal? true))
        (when show-modal?
          (let [close-fn #(om/set-state! owner :show-modal? false)]
            (modal/modal-dialog {:title "Are you sure?"
                                 :body (html
                                        [:span
                                         "Are you sure you want to remove the \""
                                         (:description row)
                                         "\" Apple Code Signing Key?"])
                                 :actions [(button/button {:on-click close-fn} "Cancel")
                                           (button/button {:primary? true
                                                           :on-click #(raise! owner
                                                                              [:delete-p12
                                                                               (select-keys row [:project-name :vcs-type :id])])}
                                                          "Remove")]
                                 :close-fn close-fn})))]))))

(defn p12-key-table [{:keys [rows]} owner]
  (reify
    om/IRender

            [frontend.components.pieces.button :as button]
            [frontend.components.pieces.card :as card])
  (:require-macros [frontend.utils :refer [html]]))

(defn- remove-action-button
  "Renders a \"Remove\" action button suitable for a settings table row which
  presents a confirmation dialog before actually removing the row.

  :confirmation-question - The content of the dialog. Should ask the user if
                           they're sure they want to remove the row, clearly
                           describing what the user is about to remove.

  :remove-fn             - The function which will actually remove the row once
                           confirmed."
  [{:keys [confirmation-question remove-fn]} owner]
  (reify
    om/IInitState
    (init-state [_]
      {:show-modal? false})
    om/IRenderState
    (render-state [_ {:keys [show-modal?]}]
      (html
       [:span
        (table/action-button
         "Remove"
         (icon/delete)
         #(om/set-state! owner :show-modal? true))
        (when show-modal?
          (let [close-fn #(om/set-state! owner :show-modal? false)]
            (modal/modal-dialog {:title "Are you sure?"
                                 :body confirmation-question
                                 :actions [(button/button {:on-click close-fn} "Cancel")
                                           (button/button {:primary? true
                                                           :on-click remove-fn}
                                                          "Remove")]
                                 :close-fn close-fn})))]))))

(defn branch-names [project-data]
  (map (comp gstring/urlDecode name) (keys (:branches (:project project-data)))))
