Skip to content

Commit

Permalink
Merge pull request #618 from mansam/differentiate-between-snapshots-a…
Browse files Browse the repository at this point in the history
…nd-images-in-preprov

Add a type column to the list of images in the pre-prov flow
  • Loading branch information
Dan Clarizio authored Mar 15, 2017
2 parents 5c26251 + 3481b46 commit 2eb47df
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,10 @@ def build_vm_grid(vms, sort_order = nil, sort_by = nil, filter_by = nil)
}

# add tenant column header to cloud workflows only
headers["cloud_tenant"] = "Tenant" if vms.any? { |vm| vm.respond_to?(:cloud_tenant) }
headers["cloud_tenant"] = _("Tenant") if vms.any? { |vm| vm.respond_to?(:cloud_tenant) }
# add snapshot/image column header to cloud workflows only, since they're
# currently the only ones that support the field.
headers["image?"] = _("Type") if vms.any? { |vm| vm.respond_to?(:image?) }

integer_fields = %w(allocated_disk_storage mem_cpu logical_cpus v_total_snapshots)

Expand Down
27 changes: 17 additions & 10 deletions app/views/miq_request/_pre_prov.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,31 @@
%thead
%tr
- id = @edit[:req_id] || "new"
- @edit[:vm_columns].each_with_index do |h, i|
- ["name", "image?", "operating_system.product_name", "platform",
"logical_cpus", "mem_cpu", "allocated_disk_storage", "deprecated",
"ext_management_system.name", "v_total_snapshots", "cloud_tenant"].each do |column_name|
%th
-# Replaced to exclude non-view table fields from sorting
= link_to(h(@edit[:vm_headers][h]),
{:action => "vm_pre_prov", :sort_choice => h, :id => id.to_s},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-method" => :post,
:remote => true)
- if @edit[:vm_columns][i] == @edit[:vm_sortcol]
%img{:src => image_path("16/sort_#{@edit[:vm_sortdir] == 'ASC' ? 'up' : 'down'}.png")}
- if @edit[:vm_headers].include?(column_name)
-# Replaced to exclude non-view table fields from sorting
= link_to(h(@edit[:vm_headers][column_name]),
{:action => "vm_pre_prov", :sort_choice => column_name, :id => id.to_s},
"data-miq_sparkle_on" => true,
"data-miq_sparkle_off" => true,
"data-method" => :post,
:remote => true)
- if column_name == @edit[:vm_sortcol]
%img{:src => image_path("16/sort_#{@edit[:vm_sortdir] == 'ASC' ? 'up' : 'down'}.png")}
%tbody
- @vms.each do |row|
- @id = row.id
- cls = @edit[:src_vm_id] && @edit[:src_vm_id] == @id ? "selected" : ""
%tr{:class => cls, :onclick => "miqAjax('/miq_request/pre_prov/?sel_id=#{@id}');", :id => "row_#{@id}"}
%td
= h(row.name)
- if @edit[:vm_headers].include?("image?")
%td
- if row.respond_to?(:image?)
= h(row.image? ? _("Image") : _("Snapshot"))
%td
= h(row.operating_system.try(:product_name))
%td
Expand Down

0 comments on commit 2eb47df

Please sign in to comment.