From cacc3764bcba1a2a0fabc3f3823dbcd41bfdb1b1 Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Wed, 11 Mar 2020 22:48:20 -0400 Subject: [PATCH] More changes to get tree_select and gtl links working - renamed more methods and occurrences of foreman related class name checks. - changes to get tree_select transaction working and gtl links working to load correct data in the right cell --- app/controllers/application_controller.rb | 2 +- .../miq_request_methods.rb | 6 +++--- .../configuration_manager_controller.rb | 20 +++++++++---------- .../mixins/manager_controller_mixin.rb | 2 +- app/helpers/application_helper.rb | 6 +++--- .../configuration_manager_providers_center.rb | 2 +- .../lifecycle_mixin.rb | 2 +- .../policy_mixin.rb | 2 +- .../toolbar/configured_systems_center.rb | 4 ++-- .../unassigned_profiles_group_center.rb | 4 ++-- app/presenters/tree_builder.rb | 4 ++-- ...onfiguration_manager_configured_systems.rb | 2 +- app/presenters/tree_node/node.rb | 2 +- 13 files changed, 29 insertions(+), 29 deletions(-) rename app/helpers/application_helper/toolbar/configured_system/{foreman => configuration_manager}/lifecycle_mixin.rb (89%) rename app/helpers/application_helper/toolbar/configured_system/{foreman => configuration_manager}/policy_mixin.rb (88%) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 4f3463a6feed..c03f25a4262b 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -431,7 +431,7 @@ def report_data @view.table = filter_parent_name_tenant(@view.table) end - # Foreman has some unassigned rows which needs to be added after view is fetched + # Configuration Manager has some unassigned rows which needs to be added after view is fetched if options && options[:unassigned_profile_row] && options[:unassigned_configuration_profile] options[:unassigned_profile_row][:id] ||= options[:unassigned_profile_row]['manager_id'] @view.table.data.push(options[:unassigned_profile_row]) diff --git a/app/controllers/application_controller/miq_request_methods.rb b/app/controllers/application_controller/miq_request_methods.rb index 1a0ac3de7a88..706ec11a7eb0 100644 --- a/app/controllers/application_controller/miq_request_methods.rb +++ b/app/controllers/application_controller/miq_request_methods.rb @@ -538,7 +538,7 @@ def dialog_partial_for_workflow workflow = @edit.try(:[], :wf) && !@edit[:stamp_typ] ? @edit[:wf] : @options[:wf] case workflow when MiqProvisionVirtWorkflow then "shared/views/prov_dialog" - when ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionWorkflow then "prov_configured_system_foreman_dialog" + when ManageIQ::Providers::ConfigurationManager::ProvisionWorkflow then "prov_configured_system_foreman_dialog" when VmMigrateWorkflow then "prov_vm_migrate_dialog" when PhysicalServerProvisionWorkflow then "prov_physical_server_dialog" end @@ -887,7 +887,7 @@ def prov_set_form_vars(req = nil) @edit[:new] = @edit[:new].merge(pre_prov_values.reject { |k| @edit[:new].key?(k) }) end - if @edit[:wf].kind_of?(ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionWorkflow) || + if @edit[:wf].kind_of?(ManageIQ::Providers::ConfigurationManager::ProvisionWorkflow) || @edit[:wf].kind_of?(PhysicalServerProvisionWorkflow) # BD TODO else @@ -984,7 +984,7 @@ def workflow_instance_from_vars(req) elsif @edit[:org_controller] == "configured_system" @edit[:prov_type] = "ConfiguredSystem" @edit[:new][:src_configured_system_ids] = params[:prov_id].kind_of?(Array) ? params[:prov_id] : [params[:prov_id]] - wf_type = ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionWorkflow + wf_type = ManageIQ::Providers::ConfigurationManager::ProvisionWorkflow elsif @edit[:org_controller] == "physical_server" @edit[:prov_type] = "PhysicalServer" @edit[:new][:src_configured_system_ids] = params[:prov_id].kind_of?(Array) ? params[:prov_id] : [params[:prov_id]] diff --git a/app/controllers/configuration_manager_controller.rb b/app/controllers/configuration_manager_controller.rb index ce1aec47fa34..1e4053bbbfa8 100644 --- a/app/controllers/configuration_manager_controller.rb +++ b/app/controllers/configuration_manager_controller.rb @@ -21,8 +21,8 @@ def self.table_name end def self.model_to_name(provmodel) - if provmodel.include?("ManageIQ::Providers::Foreman") - Dictionary.gettext('foreman', :type => :ui_title, :translate => false) + if provmodel.include?("ManageIQ::Providers::ConfigurationManager") + Dictionary.gettext('ConfigurationManager', :type => :ui_title, :translate => false) end end @@ -220,7 +220,7 @@ def textual_group_list helper_method :textual_group_list def provider_class - ManageIQ::Providers::Foreman::Provider + ManageIQ::Providers::ConfigurationManager end def features @@ -252,11 +252,11 @@ def get_node_info(treenodeid, show_list = true) end options = case model - when "ManageIQ::Providers::Foreman::ConfigurationManager" + when "ManageIQ::Providers::ConfigurationManager" provider_list(id, model) when "ConfigurationProfile" configuration_profile_node(id, model) - when "ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem", "ConfiguredSystem" + when "ManageIQ::Providers::ConfigurationManager::ConfiguredSystem", "ConfiguredSystem" configured_system_list(id, model) when "MiqSearch" miq_search_node @@ -285,8 +285,8 @@ def provider_node(id, model) else @no_checkboxes = true case @record.type - when "ManageIQ::Providers::Foreman::ConfigurationManager" - options = {:model => "ConfigurationProfile", :match_via_descendants => 'ConfiguredSystem', :named_scope => [[:with_manager, provider.id]]} + when "ManageIQ::Providers::Foreman::ConfigurationManager", "ManageIQ::Providers::CloudAutomationManager::ConfigurationManager" + options = {:model => "ConfigurationProfile", :named_scope => [[:with_manager, provider.id]]} @show_list ? process_show_list(options) : options.merge!(update_options) unassigned_profiles = add_unassigned_configuration_profile_record(provider.id) options.merge!(unassigned_profiles) unless unassigned_profiles.nil? @@ -355,14 +355,14 @@ def configuration_profile_record?(node = x_node) type && %w[ConfigurationProfile].include?(TreeBuilder.get_model_for_prefix(type)) end - def foreman_provider_record?(node = x_node) + def configuration_manager_record?(node = x_node) node = node.split("-").last if node.split("-").first == 'xx' type, _id = node.split("-") - type && ["ManageIQ::Providers::Foreman::ConfigurationManager"].include?(TreeBuilder.get_model_for_prefix(type)) + type && ["ManageIQ::Providers::ConfigurationManager"].include?(TreeBuilder.get_model_for_prefix(type)) end def provider_record?(node = x_node) - foreman_provider_record?(node) + configuration_manager_record?(node) end def search_text_type(node) diff --git a/app/controllers/mixins/manager_controller_mixin.rb b/app/controllers/mixins/manager_controller_mixin.rb index 0cece83e898e..6604e899ca25 100644 --- a/app/controllers/mixins/manager_controller_mixin.rb +++ b/app/controllers/mixins/manager_controller_mixin.rb @@ -501,7 +501,7 @@ def construct_edit_for_audit end def breadcrumb_name(_model) - "#{ui_lookup(:ui_title => 'foreman')} #{_('Provider')}" + "#{ui_lookup(:ui_title => 'ConfigurationManager')} #{_('Provider')}" end def tagging_explorer_controller? diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index f2b7d9e2d441..92d0ff8c95d9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -912,9 +912,9 @@ def model_from_active_tree(tree) when :automation_manager_cs_filter_tree "ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem" when :configuration_manager_cs_filter_tree - "ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem" + "ManageIQ::Providers::ConfigurationManager::ConfiguredSystem" when :configuration_manager_providers_tree - "ManageIQ::Providers::Foreman::ConfigurationManager" if x_node.include?("fr") + "ManageIQ::Providers::ConfigurationManager" if x_node.include?("fr") "ManageIQ::Providers::ConfigurationManager" if x_node == "root" when :instances_filter_tree "ManageIQ::Providers::CloudManager::Vm" @@ -938,7 +938,7 @@ def configuration_manager_scripts_tree(tree) when :automation_manager_cs_filter_tree, :automation_manager_providers_tree "ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem" when :configuration_manager_cs_filter_tree - "ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem" + "ManageIQ::Providers::ConfigurationManager::ConfiguredSystem" when :configuration_scripts_tree "ConfigurationScript" end diff --git a/app/helpers/application_helper/toolbar/configuration_manager_providers_center.rb b/app/helpers/application_helper/toolbar/configuration_manager_providers_center.rb index 3f2534d1c1ba..5ffe8375038c 100644 --- a/app/helpers/application_helper/toolbar/configuration_manager_providers_center.rb +++ b/app/helpers/application_helper/toolbar/configuration_manager_providers_center.rb @@ -63,7 +63,7 @@ class ApplicationHelper::Toolbar::ConfigurationManagerProvidersCenter < Applicat button( :configuration_manager_provider_tag, 'pficon pficon-edit fa-lg', - N_('Edit Tags for this Foreman Provider'), + N_('Edit Tags for this Configuration Manager Provider'), N_('Edit Tags'), :url_parms => "main_div", :send_checked => true, diff --git a/app/helpers/application_helper/toolbar/configured_system/foreman/lifecycle_mixin.rb b/app/helpers/application_helper/toolbar/configured_system/configuration_manager/lifecycle_mixin.rb similarity index 89% rename from app/helpers/application_helper/toolbar/configured_system/foreman/lifecycle_mixin.rb rename to app/helpers/application_helper/toolbar/configured_system/configuration_manager/lifecycle_mixin.rb index 7ff31fdc01b8..51a641ea4b8c 100644 --- a/app/helpers/application_helper/toolbar/configured_system/foreman/lifecycle_mixin.rb +++ b/app/helpers/application_helper/toolbar/configured_system/configuration_manager/lifecycle_mixin.rb @@ -1,4 +1,4 @@ -module ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::LifecycleMixin +module ApplicationHelper::Toolbar::ConfiguredSystem::ConfigurationManager::LifecycleMixin def self.included(included_class) included_class.button_group('configuration_manager_lifecycle', [ included_class.select( diff --git a/app/helpers/application_helper/toolbar/configured_system/foreman/policy_mixin.rb b/app/helpers/application_helper/toolbar/configured_system/configuration_manager/policy_mixin.rb similarity index 88% rename from app/helpers/application_helper/toolbar/configured_system/foreman/policy_mixin.rb rename to app/helpers/application_helper/toolbar/configured_system/configuration_manager/policy_mixin.rb index 8add35a600b7..555fb43e9ebb 100644 --- a/app/helpers/application_helper/toolbar/configured_system/foreman/policy_mixin.rb +++ b/app/helpers/application_helper/toolbar/configured_system/configuration_manager/policy_mixin.rb @@ -1,4 +1,4 @@ -module ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::PolicyMixin +module ApplicationHelper::Toolbar::ConfiguredSystem::ConfigurationManager::PolicyMixin def self.included(included_class) included_class.button_group('configuration_manager_policy', [ included_class.select( diff --git a/app/helpers/application_helper/toolbar/configured_systems_center.rb b/app/helpers/application_helper/toolbar/configured_systems_center.rb index 7c004171f5a0..b1f7ec55406b 100644 --- a/app/helpers/application_helper/toolbar/configured_systems_center.rb +++ b/app/helpers/application_helper/toolbar/configured_systems_center.rb @@ -1,4 +1,4 @@ class ApplicationHelper::Toolbar::ConfiguredSystemsCenter < ApplicationHelper::Toolbar::Basic - include ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::LifecycleMixin - include ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::PolicyMixin + include ApplicationHelper::Toolbar::ConfiguredSystem::LifecycleMixin + include ApplicationHelper::Toolbar::ConfiguredSystem::PolicyMixin end diff --git a/app/helpers/application_helper/toolbar/unassigned_profiles_group_center.rb b/app/helpers/application_helper/toolbar/unassigned_profiles_group_center.rb index 01c721096509..a93b3055761d 100644 --- a/app/helpers/application_helper/toolbar/unassigned_profiles_group_center.rb +++ b/app/helpers/application_helper/toolbar/unassigned_profiles_group_center.rb @@ -1,4 +1,4 @@ class ApplicationHelper::Toolbar::UnassignedProfilesGroupCenter < ApplicationHelper::Toolbar::Basic - include ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::LifecycleMixin - include ApplicationHelper::Toolbar::ConfiguredSystem::Foreman::PolicyMixin + include ApplicationHelper::Toolbar::ConfiguredSystem::ConfigurationManager::LifecycleMixin + include ApplicationHelper::Toolbar::ConfiguredSystem::ConfigurationManager::PolicyMixin end diff --git a/app/presenters/tree_builder.rb b/app/presenters/tree_builder.rb index 9cceef0c3b12..50e198acf588 100644 --- a/app/presenters/tree_builder.rb +++ b/app/presenters/tree_builder.rb @@ -442,10 +442,10 @@ def prefixed_title(prefix, title) "e" => "ExtManagementSystem", "ev" => "MiqEventDefinition", "c" => "EmsCluster", - "csf" => "ManageIQ::Providers::Foreman::ConfigurationManager::ConfiguredSystem", + "csf" => "ManageIQ::Providers::ConfigurationManager::ConfiguredSystem", "csa" => "ManageIQ::Providers::AnsibleTower::AutomationManager::ConfiguredSystem", "f" => "EmsFolder", - "fr" => "ManageIQ::Providers::Foreman::ConfigurationManager", + "fr" => "ManageIQ::Providers::ConfigurationManager", "g" => "MiqGroup", "gd" => "GuestDevice", "god" => "GenericObjectDefinition", diff --git a/app/presenters/tree_builder_configuration_manager_configured_systems.rb b/app/presenters/tree_builder_configuration_manager_configured_systems.rb index 57e75f4ea724..322edf2c04a3 100644 --- a/app/presenters/tree_builder_configuration_manager_configured_systems.rb +++ b/app/presenters/tree_builder_configuration_manager_configured_systems.rb @@ -16,7 +16,7 @@ def root_options def configured_systems { :id => "csf", - :text => t = _("%{name} Configured Systems") % {:name => ui_lookup(:ui_title => 'foreman')}, + :text => t = _("%{name} Configured Systems") % {:name => ui_lookup(:ui_title => 'ConfigurationManager')}, :icon => "pficon pficon-folder-close", :tip => t } diff --git a/app/presenters/tree_node/node.rb b/app/presenters/tree_node/node.rb index 1fcef50a66f1..bead1d4f71b5 100644 --- a/app/presenters/tree_node/node.rb +++ b/app/presenters/tree_node/node.rb @@ -31,7 +31,7 @@ def key else base_class = @object.class.base_model.name # i.e. Vm or MiqTemplate base_class = "Datacenter" if base_class == "EmsFolder" && @object.kind_of?(::Datacenter) - base_class = "ManageIQ::Providers::Foreman::ConfigurationManager" if @object.kind_of?(ManageIQ::Providers::Foreman::ConfigurationManager) + base_class = "ManageIQ::Providers::ConfigurationManager" if @object.kind_of?(ManageIQ::Providers::ConfigurationManager) base_class = "ManageIQ::Providers::AnsibleTower::AutomationManager" if @object.kind_of?(ManageIQ::Providers::AnsibleTower::AutomationManager) prefix = TreeBuilder.get_prefix_for_model(base_class) cid = @object.id