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

Automatically select network if there is only one.

parent 1c2fb032
......@@ -103,7 +103,8 @@
{}
(let [dataset-uuid (get-in data [:data :dataset])
dataset (get-in data [:datasets :elements dataset-uuid])
networks (get-in data [:datasets :elements dataset-uuid :networks])
nics (get-in data [:datasets :elements dataset-uuid :networks])
networks (sort-by :name (vals (get-in data [:networks :elements])))
cnt (count networks)]
(map
(fn [{nic :name :keys [description]}]
......@@ -124,8 +125,8 @@
(om/transact! data [:data :config :networks] #(assoc % nic uuid))
(validate-data! (assoc-in data [:data :config :networks nic] uuid)))))}
(d/td name (if (= free 0) [" " (r/label {:bs-style "danger"} "No free IPs")])))))
(sort-by :name (vals (get-in data [:networks :elements]))))))))
networks)))
networks)))))
nics)))
(g/row
{}
(g/col
......@@ -261,7 +262,15 @@
om/IRenderState
(render-state [_ state]
(let [tab (get-in data [:key] 1)
mkopts (partial mkopts data)]
mkopts (partial mkopts data)
dataset-uuid (get-in data [:data :dataset])
nics (get-in data [:datasets :elements dataset-uuid :networks])
networks (sort-by :name (vals (get-in data [:networks :elements])))
cnt (count networks)]
(if (and dataset-uuid (= (count nics) 1) (= cnt 1))
(let [{nic :name} (first nics)
uuid (:uuid (first networks))]
(om/transact! data [:data :config :networks] #(assoc % nic uuid))))
(g/grid
{:id "vm-create-grid" :class "vms-create"}
(g/row
......
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