diff --git a/app/controllers/automation_manager_controller.rb b/app/controllers/automation_manager_controller.rb index a3d91300434..e726ea92fa1 100644 --- a/app/controllers/automation_manager_controller.rb +++ b/app/controllers/automation_manager_controller.rb @@ -33,7 +33,7 @@ def concrete_model end def managed_group_kls - ManageIQ::Providers::AutomationManager::InventoryGroup + ManageIQ::Providers::AutomationManager::InventoryRootGroup end def manager_prefix @@ -113,7 +113,7 @@ def automation_manager_providers_tree_rec nodes = x_node.split('-') case nodes.first when "root" then find_record(ManageIQ::Providers::AnsibleTower::AutomationManager, params[:id]) - when "at" then find_record(ManageIQ::Providers::AutomationManager::InventoryGroup, params[:id]) + when "at", "e" then find_record(ManageIQ::Providers::AutomationManager::InventoryRootGroup, params[:id]) when "f" then find_record(ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem, params[:id]) when "xx" then case nodes.second @@ -228,8 +228,8 @@ def get_node_info(treenodeid) end case model - when "ManageIQ::Providers::AnsibleTower::AutomationManager" - provider_list(id, model) + when "ManageIQ::Providers::AnsibleTower::AutomationManager", "ExtManagementSystem" + provider_list(id, "ManageIQ::Providers::AnsibleTower::AutomationManager") when "EmsFolder" inventory_group_node(id, model) when "ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem", "ConfiguredSystem" @@ -261,10 +261,10 @@ def provider_node(id, model) cs_provider_node(provider) else @no_checkboxes = true - options = {:model => "ManageIQ::Providers::AutomationManager::InventoryGroup", + options = {:model => "ManageIQ::Providers::AutomationManager::InventoryRootGroup", :match_via_descendants => ConfiguredSystem, :where_clause => ["ems_id IN (?)", provider.id], - :gtl_dbname => "automation_manager_groups"} + :gtl_dbname => "automation_manager_providers"} process_show_list(options) record_model = ui_lookup(:model => self.class.model_to_name(model || TreeBuilder.get_model_for_prefix(@nodetype))) @right_cell_text = _("%{model} \"%{name}\"") % {:name => provider.name, @@ -283,7 +283,7 @@ def cs_provider_node(provider) end def inventory_group_node(id, model) - @record = @inventory_group_record = find_record(ManageIQ::Providers::AutomationManager::InventoryGroup, id) if model + @record = @inventory_group_record = find_record(ManageIQ::Providers::AutomationManager::InventoryRootGroup, id) if model if @inventory_group_record.nil? self.x_node = "root" diff --git a/app/controllers/configuration_job_controller.rb b/app/controllers/configuration_job_controller.rb index d77f5fa4680..4d1d991af86 100644 --- a/app/controllers/configuration_job_controller.rb +++ b/app/controllers/configuration_job_controller.rb @@ -92,5 +92,5 @@ def textual_group_list end helper_method :textual_group_list - menu_section :conf + menu_section :aut end diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index ad8a30476af..d64448b7d57 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -208,6 +208,9 @@ def url_for_record(record, action = "show") # Default action is show "vm_or_template" elsif record.kind_of?(VmOrTemplate) controller_for_vm(model_for_vm(record)) + elsif record.kind_of?(ManageIQ::Providers::AnsibleTower::AutomationManager) || + record.kind_of?(ManageIQ::Providers::ExternalAutomationManager::InventoryRootGroup) + "automation_manager" elsif record.kind_of?(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook) "ansible_playbook" elsif record.kind_of?(ManageIQ::Providers::EmbeddedAutomationManager::Authentication) @@ -235,7 +238,7 @@ def url_for_db(db, action = "show", item = nil) # Default action is show ) elsif @host && ["Patch", "GuestApplication"].include?(db) return url_for_only_path(:controller => "host", :action => @lastaction, :id => @host, :show => @id) - elsif %w(ConfiguredSystem ConfigurationProfile EmsFolder).include?(db) + elsif %w(ConfiguredSystem ConfigurationProfile).include?(db) return url_for_only_path(:controller => "provider_foreman", :action => @lastaction, :id => @record, :show => @id) else controller, action = db_to_controller(db, action) @@ -284,10 +287,10 @@ def view_to_url(view, parent = nil) elsif ["Vm"].include?(view.db) && parent && request.parameters[:controller] != "vm" # this is to handle link to a vm in vm explorer from service explorer return url_for_only_path(:controller => "vm_or_template", :action => "show") + "/" - elsif %w(ConfigurationProfile EmsFolder).include?(view.db) && + elsif %w(ConfigurationProfile).include?(view.db) && request.parameters[:controller] == "provider_foreman" return url_for_only_path(:action => action, :id => nil) + "/" - elsif %w(ManageIQ::Providers::AutomationManager::InventoryGroup EmsFolder).include?(view.db) && + elsif %w(ManageIQ::Providers::AutomationManager::InventoryRootGroup EmsFolder).include?(view.db) && request.parameters[:controller] == "automation_manager" return url_for_only_path(:action => action, :id => nil) + "/" elsif %w(ConfiguredSystem).include?(view.db) && (request.parameters[:controller] == "provider_foreman" || request.parameters[:controller] == "automation_manager") diff --git a/app/helpers/application_helper/toolbar_chooser.rb b/app/helpers/application_helper/toolbar_chooser.rb index 7f52b1aa82f..a3b6afcf2e4 100644 --- a/app/helpers/application_helper/toolbar_chooser.rb +++ b/app/helpers/application_helper/toolbar_chooser.rb @@ -618,10 +618,10 @@ def configuration_scripts_tree_center_tb(nodes) def automation_manager_providers_tree_center_tb(nodes) case nodes.first - when "root" then "automation_manager_providers_center_tb" - when "at" then "automation_manager_provider_center_tb" - when "f" then inventory_group_center_tb - when "xx" then "configured_systems_ansible_center_tb" + when "root" then "automation_manager_providers_center_tb" + when "at", "e" then "automation_manager_provider_center_tb" + when "f" then inventory_group_center_tb + when "xx" then "configured_systems_ansible_center_tb" end end diff --git a/config/routes.rb b/config/routes.rb index 193cdbd7c5e..c0d0043be04 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -162,6 +162,7 @@ explorer form_fields show + x_show show_list tagging_edit ), diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index 945a5a6375a..9a9519cc087 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -225,6 +225,11 @@ expect(subject).to eq(helper.url_for_db(helper.controller_for_vm(helper.model_for_vm(@record)), @action)) end + it "when record is ManageIQ::Providers::AnsibleTower::AutomationManager" do + @record = ManageIQ::Providers::AnsibleTower::AutomationManager.new + expect(subject).to eq("/automation_manager/#{@action}") + end + it "when record is not VmOrTemplate" do @record = FactoryGirl.create(:host) expect(subject).to eq(helper.url_for_db(@record.class.base_class.to_s, @action))