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
fixes #3683 display free and available space in vSphere datastore selection #1039
Conversation
[test] |
@@ -1,5 +1,5 @@ | |||
<div class="fields"> | |||
<%= selectable_f f, :datastore, compute_resource.datastores, { }, :class => "span2", :label => _("Data Store"), :disabled => !new %> | |||
<%= select_f f, :datastore, compute_resource.datastores, :name, :to_label, { }, :class => "span2", :label => _("Data Store"), :disabled => !new %> | |||
<%= text_f f, :name, :class => "input-mini", :label => "Name", :disabled => !new %> |
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.
Why not move the ds_ext to a simple helper? this way you dont need to extend any core object?
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 have submitted a fog pull request: fog/fog#2402 |
Update: fog as accepted my pull request and will support the "uncommitted" attribute from the next version. |
I don't think we need to reimplement the human size bit on Integer here, as Rails already has a
|
extend ActiveSupport::Concern | ||
def to_label | ||
if freespace and capacity | ||
"#{name} (#{freespace.to_human_size} / #{capacity.to_human_size})" |
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.
not sure if it's just me, but I read number / larger number
as used / total
rather than free / total
...
I have updated the diff, now everything is implemented in _volume.html.erb |
{ }, | ||
:class => "span2", | ||
:label => _("Data Store"), | ||
:disabled => !new %> |
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 don't think this is needed since f9a7731
Use span4 instead of span2
<%= selectable_f f, :datastore, compute_resource.datastores, { }, :class => "span2 disable-unsupported", :label => _("Data Store") %> | ||
<%= selectable_f f, :datastore, | ||
compute_resource.datastores.map { | ||
|ds| [ds.freespace && ds.capacity ? "#{ds.name} (#{_('free')}: #{number_to_human_size(ds.freespace)}, #{_('total')}: #{number_to_human_size(ds.capacity)})" : ds.name, ds.name] |
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.
maybe we should use a helper?
No description provided.