Skip to content

Commit

Permalink
Merge pull request #4879 from mzazrivec/fix_rubocop_warnings_in_resou…
Browse files Browse the repository at this point in the history
…rce_pool_controller

Fix rubocop warningsin ResourcePoolController
  • Loading branch information
martinpovolny authored Nov 13, 2018
2 parents c602651 + 3c50f06 commit 42cd639
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions app/controllers/resource_pool_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ def self.display_methods

# handle buttons pressed on the button bar
def button
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if ["all_vms", "vms", "resource_pools"].include?(@display) # Were we displaying sub-items
if ["all_vms", "vms", "resource_pools"].include?(@display) # Need to check, since RPs contain RPs
@edit = session[:edit] # Restore @edit for adv search box
params[:display] = @display if %w(all_vms vms resource_pools).include?(@display) # Were we displaying sub-items
if %w(all_vms vms resource_pools).include?(@display) # Need to check, since RPs contain RPs

if params[:pressed].starts_with?("vm_", # Handle buttons from sub-items screen
"miq_template_",
Expand All @@ -28,7 +28,7 @@ def button
return if ["#{pfx}_policy_sim", "#{pfx}_compare", "#{pfx}_tag", "#{pfx}_protect",
"#{pfx}_retire", "#{pfx}_right_size", "#{pfx}_ownership",
"#{pfx}_reconfigure"].include?(params[:pressed]) &&
@flash_array.nil? # Some other screen is showing, so return
@flash_array.nil? # Some other screen is showing, so return

unless ["#{pfx}_edit", "#{pfx}_miq_request_new", "#{pfx}_clone",
"#{pfx}_migrate", "#{pfx}_publish", 'vm_rename'].include?(params[:pressed])
Expand All @@ -44,7 +44,7 @@ def button
assign_policies(ResourcePool) if params[:pressed] == "resource_pool_protect"
end

return if ["resource_pool_tag", "resource_pool_protect"].include?(params[:pressed]) && @flash_array.nil? # Tag screen showing, so return
return if %w(resource_pool_tag resource_pool_protect).include?(params[:pressed]) && @flash_array.nil? # Tag screen showing, so return

check_if_button_is_implemented

Expand All @@ -54,12 +54,10 @@ def button
"#{pfx}_migrate", "#{pfx}_publish"].include?(params[:pressed]) ||
params[:pressed] == 'vm_rename' && @flash_array.nil?
render_or_redirect_partial(pfx)
elsif @refresh_div == "main_div" && @lastaction == "show_list"
replace_gtl_main_div
else
if @refresh_div == "main_div" && @lastaction == "show_list"
replace_gtl_main_div
else
render_flash
end
render_flash
end
end

Expand Down

0 comments on commit 42cd639

Please sign in to comment.