Skip to content

Commit

Permalink
Fixed API endpoint for GO object custom button dialogs.
Browse files Browse the repository at this point in the history
Need to pass in correct parent record id and generic_object id to build endpoint url correctly when pressing a GO custom button from list view or details view.

Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1729341
  • Loading branch information
h-kataria committed Aug 16, 2019
1 parent a23b5e2 commit 8b0e5ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion app/controllers/service_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ def generic_object_custom_buttons
display_options = {}
ids = @lastaction == 'generic_object' ? @sb[:rec_id] : 'LIST'
display_options[:display] = @display
display_options[:display_id] = params[:id]
display_options[:record_id] = @sb['trees']['svcs_tree']['active_node'].split('-').last
display_options[:display_id] = params[:id] if @lastaction == 'generic_object'
custom_buttons(ids, display_options)
end

Expand Down
5 changes: 3 additions & 2 deletions app/services/dialog_local_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ def determine_api_endpoints(obj, display_options = {})
cancel_endpoint = display_options[:cancel_endpoint] || "/vm_or_template/explorer"
when /GenericObject/
api_collection_name = "generic_objects"
cancel_endpoint = if !display_options.empty? && display_options[:display_id]
"/service/show/#{display_options[:display_id]}?display=generic_objects"
cancel_endpoint = if !display_options.empty? && display_options[:record_id]
god_url = "/service/show/#{display_options[:record_id]}?display=generic_objects"
display_options[:display_id] ? "#{god_url}&generic_object_id=#{display_options[:display_id]}" : god_url
else
"/service/explorer"
end
Expand Down

0 comments on commit 8b0e5ac

Please sign in to comment.