Skip to content

Commit

Permalink
Allow removing Host from selected Host Aggregate
Browse files Browse the repository at this point in the history
  • Loading branch information
hstastna committed Oct 3, 2019
1 parent 9a6e1f5 commit 5641b4c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/controllers/mixins/ems_common.rb
Expand Up @@ -256,7 +256,7 @@ def button
when 'host_aggregate_edit' then javascript_redirect(:action => 'edit', :id => checked_or_params, :controller => 'host_aggregate')
when 'host_aggregate_delete' then delete_host_aggregates
when 'host_aggregate_add_host' then javascript_redirect(:action => 'add_host_select', :id => checked_or_params, :controller => 'host_aggregate')
when 'host_aggregate_remove_host' then javascript_redirect(:action => 'remove_host_select', :id => checked_item_id)
when 'host_aggregate_remove_host' then javascript_redirect(:action => 'remove_host_select', :id => checked_or_params, :controller => 'host_aggregate')
when 'host_aggregate_tag' then tag(HostAggregate)
# Storages
when "storage_delete" then deletestorages
Expand Down Expand Up @@ -302,8 +302,8 @@ def button
"#{pfx}_evacuate"].include?(params[:pressed]) &&
@flash_array.nil?

unless ["host_edit", 'host_aggregate_edit', 'host_aggregate_add_host', "#{pfx}_edit", "#{pfx}_miq_request_new", "#{pfx}_clone",
"#{pfx}_migrate", "#{pfx}_publish", 'vm_rename', 'flavor_create', 'flavor_delete'].include?(params[:pressed])
unless ["host_edit", 'host_aggregate_edit', 'host_aggregate_add_host', 'host_aggregate_remove_host', "#{pfx}_edit", "#{pfx}_miq_request_new",
"#{pfx}_clone", "#{pfx}_migrate", "#{pfx}_publish", 'vm_rename', 'flavor_create', 'flavor_delete'].include?(params[:pressed])
@refresh_div = "main_div"
@refresh_partial = "layouts/gtl"
show # Handle EMS buttons
Expand Down
9 changes: 9 additions & 0 deletions spec/controllers/mixins/ems_common_spec.rb
Expand Up @@ -96,6 +96,15 @@
controller.send(:button)
end
end

context 'removing Host from Host Aggregate' do
let(:pressed) { 'host_aggregate_remove_host' }

it 'calls javascript_redirect to redirect to host_aggregate controller' do
expect(controller).to receive(:javascript_redirect).with(:action => 'remove_host_select', :id => [aggregate.id], :controller => 'host_aggregate')
controller.send(:button)
end
end
end
end
end
Expand Down

0 comments on commit 5641b4c

Please sign in to comment.