Skip to content

Commit

Permalink
fixes #3683 - display free and available space in vSphere datastore s…
Browse files Browse the repository at this point in the history
…election
  • Loading branch information
mmatuska authored and Dominic Cleal committed Nov 22, 2013
1 parent 611fd58 commit 5257110
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
11 changes: 11 additions & 0 deletions app/helpers/compute_resources_vms_helper.rb
Expand Up @@ -56,6 +56,17 @@ def libvirt_networks(compute)
select
end

def vsphere_datastores(compute)
compute.datastores.map do |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
]
end
end

def available_actions(vm)
case vm
when Fog::Compute::OpenStack::Server
Expand Down
@@ -1,5 +1,5 @@
<div class="fields">
<%= selectable_f f, :datastore, compute_resource.datastores, { }, :class => "span2 disable-unsupported", :label => _("Data Store") %>
<%= selectable_f f, :datastore, vsphere_datastores(compute_resource), { }, :class => "span4 disable-unsupported", :label => _("Data Store") %>
<%= text_f f, :name, :class => "input-mini disable-unsupported", :label => "Name" %>
<%= text_f f, :size_gb,
:class => "input-mini disable-unsupported",
Expand Down

0 comments on commit 5257110

Please sign in to comment.