Skip to content

Commit

Permalink
Use model for tagging based on the provider node selected
Browse files Browse the repository at this point in the history
  • Loading branch information
lgalis committed Nov 20, 2017
1 parent 87eee0f commit 71e81cf
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions app/controllers/provider_foreman_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def tagging
case x_active_accord
when :configuration_manager_providers
assert_privileges("configuration_manager_provider_tag")
tagging_edit('ManageIQ::Providers::ConfigurationManager', false)
tagging_edit(class_for_provider_node.to_s, false)
when :configuration_manager_cs_filter
assert_privileges("configured_system_tag")
tagging_edit('ConfiguredSystem', false)
Expand Down Expand Up @@ -141,20 +141,26 @@ def tree_select_unprovisioned_configured_system
end
end

def configuration_manager_providers_tree_rec
def class_for_provider_node
nodes = x_node.split('-')
case nodes.first
when "root" then find_record(ManageIQ::Providers::ConfigurationManager, params[:id])
when "fr" then find_record(ManageIQ::Providers::Foreman::ConfigurationManager::ConfigurationProfile, params[:id])
when "cp" then find_record(ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem, params[:id])
when "root" then ManageIQ::Providers::ConfigurationManager
when "fr" then ManageIQ::Providers::Foreman::ConfigurationManager::ConfigurationProfile
when "cp", "cs" then ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem
when "xx" then
case nodes.second
when "fr" then find_record(ManageIQ::Providers::Foreman::ConfigurationManager, params[:id])
when "csf" then find_record(ConfiguredSystem, params[:id])
when "fr" then ManageIQ::Providers::Foreman::ConfigurationManager
when "csf" then ConfiguredSystem
end
else
nodes.include?("unassigned") ? ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem : ManageIQ::Providers::ConfigurationManager
end
end

def configuration_manager_providers_tree_rec
find_record(class_for_provider_node, params[:id])
end

def configuration_manager_cs_filter_tree_rec
nodes = x_node.split('-')
case nodes.first
Expand Down

0 comments on commit 71e81cf

Please sign in to comment.