Commit da539289 authored by Heinz N. Gies's avatar Heinz N. Gies

Allow for handing of delegate datasets and locked zroot/delegate

parent 9f21cbbf
......@@ -36,6 +36,7 @@
:integer (if (not-set? val)
nil
(str->int val))
:bool (true? val)
(strip-ws val)))
(defn from-dt [data-type val]
......
......@@ -4,6 +4,7 @@
(:require-macros [cljs.core.async.macros :refer [go]])
(:require
[cljs.core.async :refer [<! timeout]]
[cerberus.api :as api]
[cerberus.http :as http]
[cerberus.howl :as howl]
......@@ -134,11 +135,20 @@
(defn change-config [uuid config]
(api/put root [uuid :config] config
(a-get uuid "Changing VM configuration." "Failed to change the VM configuration.")))
(a-get uuid "Changing VM configuration." "Failed to change the VM configuration."))
(go
(<! (timeout 5000))
(get uuid)))
(defn change-alias [uuid alias]
(change-config uuid {:alias alias}))
(defn indestructible-delegated [uuid locked]
(change-config uuid {:indestructible_delegated locked}))
(defn indestructible-zoneroot [uuid locked]
(change-config uuid {:indestructible_zoneroot locked}))
(defn change-resolvers [uuid resolvers]
(change-config uuid {:resolvers resolvers}))
......
......@@ -149,17 +149,48 @@
(let [groupings (get-in data [:groupings :elements])]
(g/grid
{:md 10}
(g/col
{:xs 10}
(let [checked (boolean (get-in data [:data :config :delegate_dataset]))]
(pr (get-in data [:data :config]))
(i/input
{:type "checkbox"
:checked checked
:label "Delegate Dataset"
:on-click
(fn []
(om/update! data [:data :config :delegate_dataset] (not checked)))})))
(g/row
{}
(g/col
{:xs 12}
(d/h4 "Dataset")))
(g/row
{}
(g/col
{:xs 6}
(let [checked (boolean (get-in data [:data :config :delegate_dataset]))]
(pr (get-in data [:data :config]))
(i/input
{:type "checkbox"
:checked checked
:label "Delegate Dataset"
:on-click
(fn []
(om/update! data [:data :config :delegate_dataset] (not checked)))})))
(g/col
{:xs 6}
(let [checked (boolean (get-in data [:data :config :indestructible_delegated]))]
(pr (get-in data [:data :config]))
(i/input
{:type "checkbox"
:checked checked
:label "Protect Delegate"
:on-click
(fn []
(om/update! data [:data :config :indestructible_delegated] (not checked)))}))))
(g/row
{}
(g/col
{:xs 10}
(let [checked (boolean (get-in data [:data :config :indestructible_zoneroot]))]
(pr (get-in data [:data :config]))
(i/input
{:type "checkbox"
:checked checked
:label "Protect Zoonroot"
:on-click
(fn []
(om/update! data [:data :config :indestructible_zoneroot] (not checked)))}))))
(g/row
{}
(g/col
......
......@@ -16,6 +16,7 @@
[om-bootstrap.input :as i]
[om-bootstrap.button :as b]
[cerberus.utils :refer [lg goto grid-row row ->state val-by-id str->int]]
[cerberus.debug :as debug]
[cerberus.http :as http]
[cerberus.api :as api]
[cerberus.orgs.api :as orgs]
......@@ -173,14 +174,21 @@
(g/col
{:sm 6 :md 4}
(p/panel
{:header (d/h3 "Disk " (if (:indestructible_zoneroot conf)
(r/glyphicon {:glyph "lock"})))
{:header (d/h3 "Disk "
(if (:indestructible_zoneroot conf)
(r/glyphicon {:glyph "lock"
:on-click (make-event #(vms/indestructible-zoneroot uuid false))})
(r/glyphicon {:glyph "hdd"
:on-click (make-event #(vms/indestructible-zoneroot uuid true))})))
:list-group
(lg
"Delegate" (if (has-delegates? element)
(d/span "Yes "
(if (:indestructible_delegated conf)
(r/glyphicon {:glyph "lock"})))
(r/glyphicon {:glyph "lock"
:on-click (make-event #(vms/indestructible-delegated uuid false))})
(r/glyphicon {:glyph "hdd"
:on-click (make-event #(vms/indestructible-delegated uuid true))})))
"No")
"Quota" (->> (:quota conf) (fmt-bytes :gb))
"I/O Priority" (:zfs_io_priority conf)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment