-
Notifications
You must be signed in to change notification settings - Fork 897
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Convert Container quotas to numeric values #15639
Conversation
@miq-bot add_label providers/containers, enhancement |
app/models/container_quota_item.rb
Outdated
@@ -1,3 +1,15 @@ | |||
class ContainerQuotaItem < ApplicationRecord | |||
belongs_to :container_quota | |||
|
|||
def quota_desired | |||
quota_desired_int || quota_desired_float |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zakiva if these columns are always equal do we really need two columns?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one of them is always nil while the other contains the actual quota value (which can be either int or float)
@miq-bot assign @blomquisg |
dcfcbd8
to
ffebce3
Compare
@miq-bot rm_label wip |
ffebce3
to
0a17802
Compare
app/models/container_quota_item.rb
Outdated
private | ||
|
||
def quota_display(quota) | ||
val = quota == quota.to_i ? quota.to_i : quota |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zakiva why do we need this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to get rid of the .0
when displaying integers values in the UI, especially for counts of objects it will be strange to see a count of say 5.0 pods
instead of just 5 pods
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zakiva I suppose this is can be achieved in a cleaner way with:
def quota_display(quota)
(quota % 1 == 0) ? quota.to_i.to_s : quota.to_s
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice, I will change that
@simon3z you good with this? If so, I got a green button here. |
@blomquisg I think there's some code that can be simplified (see comment above). |
Heh, good thing you remembered! I'm going to wip this until the schema is merged just so I don't get trigger happy. |
0a17802
to
83898ec
Compare
@zakiva I think |
841fdd6
to
140cddc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
cc @blomquisg
Merged the schema, so bouncing this PR. |
@miq-bot remove_label wip |
140cddc
to
22f10df
Compare
Checked commit zakiva@22f10df with ruby 2.2.6, rubocop 0.47.1, and haml-lint 0.20.0 |
Depends on ManageIQ/manageiq-schema#44