mirror of
https://github.com/System-End/cdn.git
synced 2026-04-19 15:18:15 +00:00
better quota?
This commit is contained in:
parent
afcceddb6a
commit
ab6d8377f5
1 changed files with 22 additions and 4 deletions
|
|
@ -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)"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue