better quota?

This commit is contained in:
24c02 2026-01-30 14:57:55 -05:00
parent afcceddb6a
commit ab6d8377f5

View file

@ -109,10 +109,17 @@ class Components::Admin::Users::Show < Components::Base
input(type: "hidden", name: "_method", value: "patch")
input(type: "hidden", name: "authenticity_token", value: helpers.form_authenticity_token)
render(Primer::Alpha::Select.new(name: "quota_policy", size: :small)) do |select|
select.with_option(label: "Auto-detect (via HCA)", value: "", selected: @user.quota_policy.nil?)
select.with_option(label: "Verified", value: "verified", selected: @user.quota_policy == "verified")
select.with_option(label: "Functionally Unlimited", value: "functionally_unlimited", selected: @user.quota_policy == "functionally_unlimited")
render(Primer::Alpha::SelectPanel.new(
select_variant: :single,
fetch_strategy: :local,
dynamic_label: true,
dynamic_label_prefix: "Quota Policy",
form_arguments: { name: :quota_policy }
)) do |panel|
panel.with_show_button(scheme: :secondary, size: :small) { current_quota_label }
panel.with_item(label: "Auto-detect (via HCA)", content_arguments: { data: { value: "" } }, active: @user.quota_policy.nil?)
panel.with_item(label: "Verified", content_arguments: { data: { value: "verified" } }, active: @user.quota_policy == "verified")
panel.with_item(label: "Functionally Unlimited", content_arguments: { data: { value: "functionally_unlimited" } }, active: @user.quota_policy == "functionally_unlimited")
end
button(type: "submit", class: "btn btn-sm btn-primary") { "Set Policy" }
@ -133,6 +140,17 @@ class Components::Admin::Users::Show < Components::Base
end
end
def current_quota_label
case @user.quota_policy&.to_sym
when :functionally_unlimited
"Functionally Unlimited"
when :verified
"Verified"
else
"Auto-detect (via HCA)"
end
end
def progress_bar_color(percentage)
if percentage >= 100
"var(--bgColor-danger-emphasis)"