defmodule MetaWeb.VirtualMachineView do use MetaWeb, :view alias Meta.OpenNebula, as: ONE alias Meta.OpenNebula.VM 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} (#{lcm_state})") else raw("#{state}") end end end