From 36436dc9584e88af764c1add34f621199b54373b Mon Sep 17 00:00:00 2001 From: Harpreet Kataria Date: Tue, 31 Mar 2020 18:37:03 -0400 Subject: [PATCH] Addressed rubocop warnings Also deleted leftover routes for provider_foreman controller --- .../configuration_manager_controller.rb | 2 +- app/views/automation_manager/_form.html.haml | 1 + .../_shared_form.html.haml | 1 + .../configuration_manager/edit.html.haml | 1 + app/views/configuration_manager/new.html.haml | 1 + .../configuration_manager/show.html.haml | 10 +-- .../configuration_manager/show_list.html.haml | 1 + .../configuration_profile/show.html.haml | 12 ++-- app/views/layouts/_searchbar.html.haml | 12 ++-- .../listnav/_configuration_manager.html.haml | 16 ++--- config/routes.rb | 65 ++++--------------- .../toolbar_chooser_spec.rb | 2 +- spec/helpers/application_helper_spec.rb | 2 +- 13 files changed, 45 insertions(+), 81 deletions(-) diff --git a/app/controllers/configuration_manager_controller.rb b/app/controllers/configuration_manager_controller.rb index 7a861263ff2e..93adfd5462be 100644 --- a/app/controllers/configuration_manager_controller.rb +++ b/app/controllers/configuration_manager_controller.rb @@ -69,7 +69,7 @@ def button private - def self.model_to_name(provmodel) + def self.model_to_name(_provmodel) Dictionary.gettext('configuration_manager', :type => :ui_title, :translate => false) end diff --git a/app/views/automation_manager/_form.html.haml b/app/views/automation_manager/_form.html.haml index 1b3155809c2d..bb7271e8b755 100644 --- a/app/views/automation_manager/_form.html.haml +++ b/app/views/automation_manager/_form.html.haml @@ -1 +1,2 @@ = render :partial => 'configuration_manager/shared_form', :locals => {:url => "/automation_manager", :model => "automationManagerModel"} + diff --git a/app/views/configuration_manager/_shared_form.html.haml b/app/views/configuration_manager/_shared_form.html.haml index 6e8c5fa1e354..008202ec744b 100644 --- a/app/views/configuration_manager/_shared_form.html.haml +++ b/app/views/configuration_manager/_shared_form.html.haml @@ -97,3 +97,4 @@ ManageIQ.angular.app.value('url', '#{url}'); ManageIQ.angular.app.value('modelName', '#{model}'); miq_bootstrap('#form_div'); + diff --git a/app/views/configuration_manager/edit.html.haml b/app/views/configuration_manager/edit.html.haml index 476d24d20d1a..c3e2df7a0e84 100644 --- a/app/views/configuration_manager/edit.html.haml +++ b/app/views/configuration_manager/edit.html.haml @@ -1 +1,2 @@ = render :partial => 'configuration_manager/shared_form', :locals => {:url => "/configuration_manager", :model => "configurationManagerModel"} + diff --git a/app/views/configuration_manager/new.html.haml b/app/views/configuration_manager/new.html.haml index 476d24d20d1a..c3e2df7a0e84 100644 --- a/app/views/configuration_manager/new.html.haml +++ b/app/views/configuration_manager/new.html.haml @@ -1 +1,2 @@ = render :partial => 'configuration_manager/shared_form', :locals => {:url => "/configuration_manager", :model => "configurationManagerModel"} + diff --git a/app/views/configuration_manager/show.html.haml b/app/views/configuration_manager/show.html.haml index a9082f371113..241d616dc492 100644 --- a/app/views/configuration_manager/show.html.haml +++ b/app/views/configuration_manager/show.html.haml @@ -1,11 +1,11 @@ -- if %w(configuration_profiles configured_systems).include?(@display) +- if %w[configuration_profiles configured_systems].include?(@display) = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} - elsif @showtype == "main" = render :partial => "layouts/flash_msg" .row .col-md-12.col-lg-6 - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Properties'), textual_group_properties), @record) - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Relationships'), textual_group_relationships), @record) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Properties'), textual_group_properties), @record)) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Relationships'), textual_group_relationships), @record)) .col-md-12.col-lg-6 - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Status'), textual_group_status), @record) - = react 'GenericGroupWrapper', expand_generic_group(TextualTags.new(_('Smart Management'), textual_group_tags), @record) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Status'), textual_group_status), @record)) + = react('GenericGroupWrapper', expand_generic_group(TextualTags.new(_('Smart Management'), textual_group_tags), @record)) diff --git a/app/views/configuration_manager/show_list.html.haml b/app/views/configuration_manager/show_list.html.haml index 039604839f28..cbf632c14189 100644 --- a/app/views/configuration_manager/show_list.html.haml +++ b/app/views/configuration_manager/show_list.html.haml @@ -1,2 +1,3 @@ #main_div = render :partial => 'layouts/gtl' + diff --git a/app/views/configuration_profile/show.html.haml b/app/views/configuration_profile/show.html.haml index 60afec4d1eca..b46d7edacd92 100644 --- a/app/views/configuration_profile/show.html.haml +++ b/app/views/configuration_profile/show.html.haml @@ -1,13 +1,13 @@ -- if %w(configured_systems).include?(@display) +- if %w[configured_systems].include?(@display) = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} - elsif @showtype == "main" = render :partial => "layouts/flash_msg" .row .col-md-12.col-lg-6 - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Properties'), textual_configuration_profile_group_properties), @record) - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Relationships'), textual_configuration_profile_group_relationships), @record) - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Environment'), textual_configuration_profile_group_environment), @record) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Properties'), textual_configuration_profile_group_properties), @record)) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Relationships'), textual_configuration_profile_group_relationships), @record)) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Environment'), textual_configuration_profile_group_environment), @record)) .col-md-12.col-lg-6 - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Operating System'), textual_configuration_profile_group_os), @record) - = react 'GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Tenancy'), textual_configuration_profile_group_tenancy), @record) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Operating System'), textual_configuration_profile_group_os), @record)) + = react('GenericGroupWrapper', expand_generic_group(TextualGroup.new(_('Tenancy'), textual_configuration_profile_group_tenancy), @record)) diff --git a/app/views/layouts/_searchbar.html.haml b/app/views/layouts/_searchbar.html.haml index aa583b86f019..8775d7a9d745 100644 --- a/app/views/layouts/_searchbar.html.haml +++ b/app/views/layouts/_searchbar.html.haml @@ -23,12 +23,12 @@ .form-group %button.btn.btn-default{:type => "submit"} %span.fa.fa-search - %button{"type" => "button", - :class => "btn btn-default", - "data-toggle" => "modal", - "data-target" => "#advsearchModal", - :id => "adv_search", - :title => _("Advanced Search")} + %button{"type" => "button", + :class => "btn btn-default", + "data-toggle" => "modal", + "data-target" => "#advsearchModal", + :id => "adv_search", + :title => _("Advanced Search")} %span.fa.fa-angle-double-down :javascript diff --git a/app/views/layouts/listnav/_configuration_manager.html.haml b/app/views/layouts/listnav/_configuration_manager.html.haml index ff612b69c850..b393c0977130 100644 --- a/app/views/layouts/listnav/_configuration_manager.html.haml +++ b/app/views/layouts/listnav/_configuration_manager.html.haml @@ -14,13 +14,13 @@ %ul.nav.nav-pills.nav-stacked - if role_allows?(:feature => "configuration_profile_show_list") = li_link(:count => @record.number_of(:configuration_profiles), - :record_id => @record.id, - :tables => 'configuration_profiles', - :display => 'configuration_profiles', - :action => 'show') + :record_id => @record.id, + :tables => 'configuration_profiles', + :display => 'configuration_profiles', + :action => 'show') - if role_allows?(:feature => "configured_system_show_list") = li_link(:count => @record.number_of(:configured_systems), - :record_id => @record.id, - :tables => 'configured_systems', - :display => 'configured_systems', - :action => 'show') + :record_id => @record.id, + :tables => 'configured_systems', + :display => 'configured_systems', + :action => 'show') diff --git a/config/routes.rb b/config/routes.rb index b55ec2943494..54d298782e03 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2659,7 +2659,7 @@ }, :configuration_manager => { - :get => %w( + :get => %w[ button download_data download_summary_pdf @@ -2669,8 +2669,8 @@ show show_list tagging_edit - ), - :post => %w( + ], + :post => %w[ authentication_validate button change_tab @@ -2687,37 +2687,37 @@ tagging_edit tag_edit_form_field_changed wait_for_task - ) + + ] + adv_search_post + exp_post + save_post }, :configuration_profile => { - :get => %w( + :get => %w[ download_data download_summary_pdf show show_list - ), - :post => %w( + ], + :post => %w[ button quick_search reload show show_list - ) + ] }, :configured_system => { - :get => %w( + :get => %w[ download_data download_summary_pdf show show_list tagging_edit - ), - :post => %w( + ], + :post => %w[ button new provision @@ -2729,54 +2729,13 @@ tagging_edit tag_edit_form_field_changed wait_for_task - ) + + ] + adv_search_post + dialog_runner_post + exp_post + save_post }, - :provider_foreman => { - :get => %w( - download_data - download_summary_pdf - explorer - form_fields - show - show_list - tagging_edit - ), - :post => %w( - accordion_select - authentication_validate - button - change_tab - delete - edit - explorer - form_field_changed - new - provision - quick_search - refresh - reload - show - show_list - tagging - tagging_edit - tag_edit_form_field_changed - tree_autoload - tree_select - cs_form_field_changed - users - wait_for_task - x_button - ) + - adv_search_post + - exp_post + - x_post - }, - :pxe => { :get => %w( explorer diff --git a/spec/helpers/application_helper/toolbar_chooser_spec.rb b/spec/helpers/application_helper/toolbar_chooser_spec.rb index ea1d0b3cc35a..84ae8da85b5f 100644 --- a/spec/helpers/application_helper/toolbar_chooser_spec.rb +++ b/spec/helpers/application_helper/toolbar_chooser_spec.rb @@ -12,7 +12,7 @@ end it "configuration_manager list screen" do - @view = true + @view = true @lastaction = "show_list" expect(_toolbar_chooser.send(:center_toolbar_filename_classic)).to eq("configuration_managers_center_tb") end diff --git a/spec/helpers/application_helper_spec.rb b/spec/helpers/application_helper_spec.rb index e7b452c10aa1..198f87dc2602 100644 --- a/spec/helpers/application_helper_spec.rb +++ b/spec/helpers/application_helper_spec.rb @@ -976,7 +976,7 @@ subject { helper.display_adv_search? } context 'Advanced search is visible for list views' do - %w(cloud_volume_snapshot cloud_volume_backup configuration_manager).each do |layout| + %w[cloud_volume_snapshot cloud_volume_backup configuration_manager].each do |layout| let(:layout) { layout } it 'returns true' do expect(subject).to be(true)