This can potentially make it easier to select a GPU instance. With the feature flag set, instead of one button link to the create page, there are two: * The "Create Virtual Machine" link does not show any GPU options * The "Create GPU Virtual Machine" only shows valid options for a GPU configuration If users have a direct link to the old page, it works the same as before, showing both GPU and non GPU options. For this to work, you need to check for available GPUs earlier, and use it to filter the families and locations.
53 lines
1.9 KiB
Plaintext
53 lines
1.9 KiB
Plaintext
<% @page_title = "Virtual Machines" %>
|
|
<div class="auto-refresh hidden" data-interval="10"></div>
|
|
|
|
<%== part(
|
|
"components/page_header",
|
|
breadcrumbs: [%w[Projects /project], [@project_data[:name], @project_data[:path]], ["Virtual Machines", "#"]],
|
|
right_items: (!@vms.empty? && has_project_permission("Vm:create")) ?
|
|
(if @project.get_ff_gpu_vm
|
|
[
|
|
part("components/button", text: "Create Virtual Machine", link: "vm/create?show_gpu=f", extra_class: "mr-2"),
|
|
part("components/button", text: "Create GPU Virtual Machine", link: "vm/create?show_gpu=t"),
|
|
]
|
|
else
|
|
[part("components/button", text: "Create Virtual Machine", link: "vm/create")]
|
|
end) : []
|
|
) %>
|
|
|
|
<div class="grid gap-6">
|
|
<%== part(
|
|
"components/table_card",
|
|
headers: ["Name", "Location", "Size", "Storage Size", "State", "IP Address"],
|
|
rows: @vms.map do |vm|
|
|
[
|
|
[
|
|
[vm[:name], {link: @project_data[:path] + vm[:path]}],
|
|
vm[:location],
|
|
vm[:size],
|
|
(vm[:storage_size_gib] > 0) ? "#{vm[:storage_size_gib]} GB" : "-",
|
|
["vm_state_label", {component: { state: vm[:state] }}],
|
|
[vm[:ip4] || vm[:ip6] || "Not assigned yet", {copyable: true}]
|
|
],
|
|
{id: "vm-#{vm[:id]}"}
|
|
]
|
|
end,
|
|
empty_state: {
|
|
icon: "hero-server-stack",
|
|
title: "No virtual machines",
|
|
description: "You don't have permission to create virtual machines."
|
|
}.merge(has_project_permission("Vm:create") ? {
|
|
description: "Get started by creating a new virtual machine.",
|
|
buttons: (
|
|
if @project.get_ff_gpu_vm
|
|
{
|
|
"Create Virtual Machine" => "#{@project_data[:path]}/vm/create?show_gpu=f",
|
|
"Create GPU Virtual Machine" => "#{@project_data[:path]}/vm/create?show_gpu=t",
|
|
}
|
|
else
|
|
{"Create Virtual Machine" => "#{@project_data[:path]}/vm/create"}
|
|
end)
|
|
} : {})
|
|
) %>
|
|
</div>
|