Skip to content

Instantly share code, notes, and snippets.

@kevinmeziere
Created April 19, 2017 23:13
Show Gist options
  • Save kevinmeziere/e7a1d63f8b8e626c3d2f992fc7215de0 to your computer and use it in GitHub Desktop.
Save kevinmeziere/e7a1d63f8b8e626c3d2f992fc7215de0 to your computer and use it in GitHub Desktop.
(d/ul {:class "list-group"}
(let [hchanged? (= (:hostname state) (:hostname conf))]
(group-li "Hostname: "
(g/row
{}
(g/col {:md 10}
(i/input {:type "text"
:on-change (->state owner :hostname)
:value (:hostname state)}))
(g/col {:md 2}
(b/button
{:bs-style "primary"
:class "pull-right"
:bs-size "small"
:disabled? (or hchanged?
(empty? (:hostname state)))
:on-click
#(vms/change-hostname uuid (:hostname state))
} (r/glyphicon {:glyph "pencil"}))))))
(group-li "DNS Domain: " (:dns_domain conf))
(let [global_mr (true? (get-in app [root :elements uuid :config :maintain_resolvers]))
munchanged? (= global_mr (:maintain_resolvers state))
rcurrent (cstr/join ", " (:resolvers conf))
runchanged? (= rcurrent (:resolvers state))]
(group-li
(g/row
{}
(g/col {:md 10}
(i/input
{:type "checkbox"
:checked (:maintain_resolvers state)
:on-change #(om/set-state! owner :maintain_resolvers (.-checked (.-target %1)))
:label "Maintain Resolvers"}))
(g/col {:md 2}
(b/button
{:bs-style "primary"
:bs-size "small"
:disabled? munchanged?
:on-click #(vms/change-maintain-resolvers uuid (:maintain_resolvers state))
} (r/glyphicon {:glyph "pencil"}))))
(group-li "DNS Resolvers: "
(g/row
{}
(g/col {:md 10}
(i/input {:type "text"
:on-change (->state owner :resolvers)
:value (:resolvers state)}))
(g/col {:md 2}
(b/button
{:bs-style "primary"
:class "pull-right"
:bs-size "small"
:disabled? (or runchanged?
(empty? (:resolvers state))
(invalid-resolvers? (:resolvers state))
(false? (:maintain_resolvers conf)))
:on-click
#(vms/change-resolvers uuid (split (:resolvers state) #","))
} (r/glyphicon {:glyph "pencil"})))))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment