ubicloud/views/vm/overview.erb
Jeremy Evans c8f8357f35 Switch vm to use object/show view
Currently, this uses 3 tabs, overview, networking, and settings.

This change exposed that the firewall rule display and restart
action were undertested, so this adds appropriate tests.
2025-08-30 01:25:25 +09:00

36 lines
1.2 KiB
Text

<% if @vm.display_state != "running" %>
<div class="auto-refresh hidden" data-interval="10"></div>
<% end %>
<% data = [
["ID", @vm.ubid],
["Name", @vm.name],
["Location", @vm.display_location],
["Size", @vm.display_size],
["Storage", (@vm.storage_size_gib > 0) ? "#{@vm.storage_size_gib} GB" : nil]
]
if (gpu = @vm.display_gpu)
data << ["GPU", gpu]
end
subnet = @vm.nics.first.private_subnet
data += [
["IPv4", @vm.ip4_enabled ? @vm.ephemeral_net4 : "Not enabled", { copyable: @vm.ip4_enabled }],
["IPv6", @vm.ip6, { copyable: true }],
[
"SSH Command",
"<span class='bg-slate-100 text-rose-500 font-mono px-2 py-1 rounded'>#{h("ssh -i <PRIVATE_KEY_PATH> #{@vm.unix_user}@#{@vm.ephemeral_net4 || @vm.ip6}")}</span>",
{ escape: false }
],
["Private IPv4", @vm.private_ipv4, { copyable: true }],
["Private IPv6", @vm.private_ipv6, { copyable: true }],
[
"Private subnet",
"<a href='#{path(subnet)}' class='text-rose-500 hover:underline'>#{subnet.name}</a>",
{ escape: false }
]
] %>
<%== part(
"components/kv_data_card",
data:
) %>