Skip to content

Commit

Permalink
Merge pull request #4795 from eclarizio/BZ1640592
Browse files Browse the repository at this point in the history
Fix vm_cloud image custom button return and cancel endpoints
  • Loading branch information
mzazrivec authored Oct 24, 2018
2 parents ec520f4 + 7148718 commit ff14ca6
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion app/services/dialog_local_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def determine_api_endpoints(obj, display_options = {})
# ^ is necessary otherwise we match on ContainerTemplates
when /^Template/
api_collection_name = "templates"
cancel_endpoint = "/vm_or_template/explorer"
cancel_endpoint = display_options[:cancel_endpoint] || "/vm_or_template/explorer"

# ^ is necessary otherwise we match CloudTenant
when /^Tenant/
Expand Down
16 changes: 13 additions & 3 deletions spec/services/dialog_local_service_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -260,10 +260,20 @@
end

context "when the object is a Template" do
let(:obj) { double(:class => ManageIQ::Providers::Vmware::InfraManager::Template, :id => 123) }
context "when there is a cancel endpoint in the display options" do
let(:obj) { double(:class => ManageIQ::Providers::Vmware::InfraManager::Template, :id => 123) }
let(:display_options) { {:cancel_endpoint => "/vm_cloud/explorer"} }

include_examples "DialogLocalService#determine_dialog_locals_for_custom_button return value",
"miq_template", "templates", "/vm_or_template/explorer"
include_examples "DialogLocalService#determine_dialog_locals_for_custom_button return value",
"miq_template", "templates", "/vm_cloud/explorer"
end

context "when there is not a cancel endpoint in the display options" do
let(:obj) { double(:class => ManageIQ::Providers::Vmware::InfraManager::Template, :id => 123) }

include_examples "DialogLocalService#determine_dialog_locals_for_custom_button return value",
"miq_template", "templates", "/vm_or_template/explorer"
end
end

context "when the object is a Vm" do
Expand Down

0 comments on commit ff14ca6

Please sign in to comment.