ubicloud/views/project/show.erb
Jeremy Evans 5cb5aa0e55 Support registering, updating, and deleting project vm init scripts in the web UI
Currently, the vm init scripts are not yet used for anything. However,
we will support specifying a registered vm init script when creating
a VM.

This is modeled closely on the recently added project SSH public key
support.
2025-10-04 11:53:04 -07:00

100 lines
3.4 KiB
Text

<% @page_title = @project.name
@quotas = ["VmVCpu", "PostgresVCpu"].map {
{
resource_type: it,
current_resource_usage: @project.current_resource_usage(it),
quota: @project.effective_quota_value(it)
}
} %>
<%== part(
"components/page_header",
title: "Project Settings",
back: "/project",
breadcrumbs: [%w[Projects /project], [@project.name, @project.path], %w[Settings #]]
) %>
<div class="grid gap-6">
<!-- Detail Card -->
<% form(action: @project.path, method: :post) do %>
<%== part(
"components/kv_data_card",
data: [
["ID", @project.ubid],
*(
if has_permission?("Project:edit", @project)
[
[
"Name",
part(
"components/form/text",
name: "name",
value: @project.name,
button_title: "Save",
attributes: {
required: true
}
),
{ escape: false }
],
[
"SSH Public Keys",
"<a href=\"#{@project.path}/ssh-public-key\" class=\"font-semibold leading-6 text-orange-500 hover:text-orange-700\">Manage</a>",
{ escape: false }
],
[
"Virtual Machine Init Scripts",
"<a href=\"#{@project.path}/vm-init-script\" class=\"font-semibold leading-6 text-orange-500 hover:text-orange-700\">Manage Virtual Machine Init Scripts</a>",
{ escape: false }
]
]
else
[["Name", @project.name]]
end
)
]
) %>
<% end %>
<!-- Quota Card -->
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
<div class="px-4 py-5 sm:p-6">
<h3 class="text-base font-semibold leading-6 text-gray-900">Quotas</h3>
<div class="mt-2 text-sm text-gray-500">
<p>If you want to increase your quota, please get in touch at
<a href="mailto:support@ubicloud.com" class="font-semibold leading-6 text-orange-500 hover:text-orange-700">support@ubicloud.com</a>.</p>
</div>
</div>
<div class="grid grid-cols-1 md:grid-cols-3 gap-6">
<% @quotas.each do |quota| %>
<div class="p-6">
<%== part(
"components/progress_bar",
title: quota[:resource_type],
numerator: quota[:current_resource_usage],
denominator: quota[:quota]
) %>
</div>
<% end %>
</div>
</div>
<!-- Delete Card -->
<% if has_permission?("Project:delete", @project) %>
<div class="overflow-hidden rounded-lg shadow ring-1 ring-black ring-opacity-5 bg-white divide-y divide-gray-200">
<div class="px-4 py-5 sm:p-6">
<div class="sm:flex sm:items-center sm:justify-between">
<div>
<h3 class="text-base font-semibold leading-6 text-gray-900">Delete project</h3>
<div class="mt-2 text-sm text-gray-500">
<p>This action will permanently delete this project. Deleted data cannot be recovered. Use it carefully.</p>
</div>
</div>
<div class="mt-5 sm:ml-6 sm:mt-0 sm:flex sm:flex-shrink-0 sm:items-center">
<%== part("components/delete_button", confirmation: @project.name, redirect: "/project") %>
</div>
</div>
</div>
</div>
<% end %>
</div>