Skip to content

Commit

Permalink
Fixed quadicon link for automation providers and inventory group model
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalis committed Apr 10, 2017
1 parent 54c2049 commit d8f0b87
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 9 deletions.
8 changes: 4 additions & 4 deletions app/controllers/automation_manager_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,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::InventoryGroup, params[:id])
when "f" then find_record(ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem, params[:id])
when "xx" then
case nodes.second
Expand Down Expand Up @@ -221,8 +221,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"
Expand Down Expand Up @@ -254,7 +254,7 @@ 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"}
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/configuration_job_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,5 +92,5 @@ def textual_group_list
end
helper_method :textual_group_list

menu_section :conf
menu_section :aut
end
6 changes: 4 additions & 2 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ 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::AutomationManager)
"automation_manager"
elsif record.class.respond_to?(:db_name)
record.class.db_name
elsif record.kind_of?(ManageIQ::Providers::EmbeddedAnsible::AutomationManager::Playbook)
Expand Down Expand Up @@ -284,10 +286,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")
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper/toolbar_chooser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,7 @@ 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 "at", "e" then "automation_manager_provider_center_tb"
when "f" then inventory_group_center_tb
when "xx" then "configured_systems_ansible_center_tb"
end
Expand Down
2 changes: 1 addition & 1 deletion app/views/layouts/show_pdf.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
= render_quadicon(@record, :mode => :icon, :size => 72)
- if @record.kind_of?(ConfigurationProfile)
= render :partial => "#{controller}/main_configuration_profile"
- elsif @record.kind_of?(ManageIQ::Providers::AutomationManager::InventoryGroup)
- elsif @record.kind_of?(ManageIQ::Providers::ExternalAutomationManager::InventoryGroup)
= render :partial => "#{controller}/main_inventory_group"
- else
= render :partial => "layouts/textual_groups_generic"
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@
show
show_list
tagging_edit
x_show
),
:post => %w(
accordion_select
Expand Down
5 changes: 5 additions & 0 deletions spec/helpers/application_helper_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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::AutomationManager" do
@record = ManageIQ::Providers::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))
Expand Down

0 comments on commit d8f0b87

Please sign in to comment.