Skip to content

Commit

Permalink
Fix for custom button action events
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffibm committed Nov 13, 2023
1 parent cf29c3a commit b518fbc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/application_controller/buttons.rb
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ def feature_by_action
@sb[:action] if features_in_action.include?(@sb[:action])
end

BASE_MODEL_EXPLORER_CLASSES = [MiqGroup, MiqTemplate, Service, Tenant, User, Vm].freeze
BASE_MODEL_EXPLORER_CLASSES = [MiqGroup, MiqTemplate, Tenant, User, Vm].freeze

def custom_button_done
external_url = ExternalUrl.find_by(
Expand Down
14 changes: 14 additions & 0 deletions app/controllers/service_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,23 @@ def button
service_retire
when 'service_retire_now'
service_retire_now
when "custom_button"
@display == 'generic_objects' ? generic_object_custom_buttons : custom_buttons
else
add_flash("Invalid button action", :error)
render_flash
end
end

def generic_object_custom_buttons
display_options = {}
ids = @lastaction == 'generic_object' ? @sb[:rec_id] : 'LIST'
display_options[:display] = @display
display_options[:record_id] = parse_nodetype_and_id(x_node).last
display_options[:display_id] = params[:id] if @lastaction == 'generic_object'
custom_buttons(ids, display_options)
end

def title
_("My Services")
end
Expand Down
2 changes: 1 addition & 1 deletion spec/controllers/application_controller/buttons_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@

controller.send(:custom_buttons)
expect(assigns(:right_cell_text)).to include(service.name)
expect(controller.instance_variable_get(:@explorer)).to be_truthy
expect(controller.instance_variable_get(:@explorer)).to be_falsy
end
end

Expand Down

0 comments on commit b518fbc

Please sign in to comment.