2021-04-12 15:53:49 +02:00
|
|
|
defmodule MetaWeb.VirtualMachineView do
|
2021-04-12 15:44:12 +02:00
|
|
|
use MetaWeb, :view
|
2021-04-07 17:23:48 +02:00
|
|
|
|
2021-04-12 15:44:12 +02:00
|
|
|
alias Meta.OpenNebula, as: ONE
|
|
|
|
alias Meta.OpenNebula.VM
|
2021-04-09 11:36:33 +02:00
|
|
|
|
|
|
|
def render_state(vm) do
|
|
|
|
state = Map.get(vm, :STATE) |> VM.state_for
|
|
|
|
if state == :active do
|
|
|
|
lcm_state = Map.get(vm, :LCM_STATE) |> VM.lcm_state_for
|
|
|
|
raw("#{state} (<b>#{lcm_state}</b>)")
|
|
|
|
else
|
|
|
|
raw("#{state}")
|
|
|
|
end
|
|
|
|
end
|
2021-04-07 17:23:48 +02:00
|
|
|
end
|