From b0040ec05d0a6cbba388d26f17ccb0327a81129b Mon Sep 17 00:00:00 2001 From: Greg McCullough Date: Sun, 3 Jun 2018 10:11:30 -0400 Subject: [PATCH] Remove references to host provisioning --- .../miq_request_methods.rb | 40 +++++-------------- app/controllers/miq_request_controller.rb | 3 +- .../miq_event_definition_decorator.rb | 1 - .../button/miq_request_copy.rb | 1 - .../toolbar/hosts_center.rb | 20 ---------- app/presenters/menu/default_menu.rb | 1 - app/views/miq_request/_request.html.haml | 7 ---- .../buttons/miq_request_approval_spec.rb | 2 +- .../buttons/miq_request_copy_spec.rb | 2 +- .../buttons/miq_request_edit_spec.rb | 2 +- 10 files changed, 14 insertions(+), 65 deletions(-) diff --git a/app/controllers/application_controller/miq_request_methods.rb b/app/controllers/application_controller/miq_request_methods.rb index 69b2b38f6cda..334d26236569 100644 --- a/app/controllers/application_controller/miq_request_methods.rb +++ b/app/controllers/application_controller/miq_request_methods.rb @@ -238,7 +238,7 @@ def sort_vm_grid # get the sort column that was clicked on, else use the current one def sort_host_grid return unless load_edit("prov_edit__#{params[:id]}", "show_list") - @edit[:wf].kind_of?(MiqHostProvisionWorkflow) ? sort_grid('host', @edit[:wf].get_field(:src_host_ids, :service)[:values]) : sort_grid('host', @edit[:wf].get_field(:placement_host_name, :environment)[:values]) + sort_grid('host', @edit[:wf].get_field(:placement_host_name, :environment)[:values]) end # get the sort column that was clicked on, else use the current one @@ -430,23 +430,13 @@ def build_host_grid(hosts, sort_order = nil, sort_by = nil) # need to set options from @edit/@option based upon calling screen: show/edit options = @edit || @options - headers = if options[:wf].kind_of?(MiqHostProvisionWorkflow) - # non-editable grid for host prov to display hosts being provisioned - { - "name" => _("Name"), - "mac_address" => _("MAC Address"), - } - else - # editable grid for vm/migrate prov screens - { - "name" => _("Name"), - "v_total_vms" => _("Total VMs"), - "vmm_product" => _("Platform"), - "vmm_version" => _("Version"), - "state" => _("State"), - "maintenance" => _("Maintenance") - } - end + # editable grid for vm/migrate prov screens + headers = { "name" => _("Name"), + "v_total_vms" => _("Total VMs"), + "vmm_product" => _("Platform"), + "vmm_version" => _("Version"), + "state" => _("State"), + "maintenance" => _("Maintenance") } integer_fields = %w(v_total_vms) @@ -519,7 +509,6 @@ def dialog_partial_for_workflow case workflow when MiqProvisionVirtWorkflow then "shared/views/prov_dialog" when ManageIQ::Providers::Foreman::ConfigurationManager::ProvisionWorkflow then "prov_configured_system_foreman_dialog" - when MiqHostProvisionWorkflow then "prov_host_dialog" when VmMigrateWorkflow then "prov_vm_migrate_dialog" when PhysicalServerProvisionWorkflow then "prov_physical_server_dialog" end @@ -769,7 +758,7 @@ def prov_get_form_vars def prov_set_show_vars @showtype = "main" @options = @miq_request.get_options # Get the provision options from the request record - @options[:org_controller] = @miq_request.resource_type == "MiqHostProvisionRequest" ? "host" : "vm" + @options[:org_controller] = "vm" if @options[:schedule_time] @options[:schedule_time] = format_timezone(@options[:schedule_time], Time.zone, "raw") @options[:start_date] = "#{@options[:schedule_time].month}/#{@options[:schedule_time].day}/#{@options[:schedule_time].year}" # Set the start date @@ -794,7 +783,7 @@ def prov_set_show_vars end end @options[tag_symbol_for_workflow] ||= [] # Initialize if came back nil from record - unless ["MiqHostProvisionRequest", "VmMigrateRequest"].include?(@miq_request.resource_type) + unless ["VmMigrateRequest"].include?(@miq_request.resource_type) svm = VmOrTemplate.where(:id => @options[:src_vm_id][0]).first if @options[:src_vm_id] && @options[:src_vm_id][0] @sb[:vm_os] = svm.platform if svm end @@ -946,8 +935,6 @@ def workflow_instance_from_vars(req) MiqProvisionWorkflow.class_for_platform(@edit[:st_prov_type]) elsif @edit[:new][:st_prov_type] MiqProvisionWorkflow.class_for_platform(@edit[:new][:st_prov_type]) - else # handle copy button for host provisioning - MiqHostProvisionWorkflow end pre_prov_values = copy_hash(@edit[:wf].values) if @edit[:wf] @@ -962,13 +949,6 @@ def workflow_instance_from_vars(req) @edit[:prov_type] = "PhysicalServer" @edit[:new][:src_configured_system_ids] = params[:prov_id].kind_of?(Array) ? params[:prov_id] : [params[:prov_id]] wf_type = PhysicalServerProvisionWorkflow - else - @edit[:prov_type] = "Host" - if @edit[:new].empty? - # multiple / single hosts selected, src_host_ids should always be an array - @edit[:new][:src_host_ids] = params[:prov_id].kind_of?(Array) ? params[:prov_id] : [params[:prov_id]] - end - wf_type = MiqHostProvisionWorkflow end [wf_type.new(@edit[:new], current_user, options), pre_prov_values] # Return the new workflow and any pre_prov_values diff --git a/app/controllers/miq_request_controller.rb b/app/controllers/miq_request_controller.rb index 070a3cb15dbe..e6f9222d21b4 100644 --- a/app/controllers/miq_request_controller.rb +++ b/app/controllers/miq_request_controller.rb @@ -214,8 +214,7 @@ def prov_continue def prov_load_tab if @options && @options[:current_tab_key] == :purpose # Need to build again for purpose tab - fld = @options[:wf].kind_of?(MiqHostProvisionWorkflow) ? "tag_ids" : "vm_tags" - build_tags_tree(@options[:wf], @options[fld.to_s.to_sym], false) + build_tags_tree(@options[:wf], @options[:vm_tags], false) end # need to build host list view, to display on show screen @options[:host_sortdir] = "ASC" diff --git a/app/decorators/miq_event_definition_decorator.rb b/app/decorators/miq_event_definition_decorator.rb index 3549106a0d84..23b9907a9eaf 100644 --- a/app/decorators/miq_event_definition_decorator.rb +++ b/app/decorators/miq_event_definition_decorator.rb @@ -97,7 +97,6 @@ def fonticon "host_disconnect" => "pficon pficon-screen", "host_failure" => "pficon pficon-screen", "host_perf_complete" => "pficon pficon-screen", - "host_provisioned" => "pficon pficon-screen", "host_remove_from_cluster" => "pficon pficon-screen", "host_scan_complete" => "pficon pficon-screen", "request_assign_company_tag" => "fa fa-tag", diff --git a/app/helpers/application_helper/button/miq_request_copy.rb b/app/helpers/application_helper/button/miq_request_copy.rb index dc80d288854b..720505709803 100644 --- a/app/helpers/application_helper/button/miq_request_copy.rb +++ b/app/helpers/application_helper/button/miq_request_copy.rb @@ -4,7 +4,6 @@ class ApplicationHelper::Button::MiqRequestCopy < ApplicationHelper::Button::Miq def visible? return false unless super resource_types_for_miq_request_copy = %w(MiqProvisionRequest - MiqHostProvisionRequest MiqProvisionConfiguredSystemRequest) return false if !resource_types_for_miq_request_copy.include?(@record.resource_type) || ((current_user.name != @record.requester_name || diff --git a/app/helpers/application_helper/toolbar/hosts_center.rb b/app/helpers/application_helper/toolbar/hosts_center.rb index 9402307e60ae..ef1ee25b0d7d 100644 --- a/app/helpers/application_helper/toolbar/hosts_center.rb +++ b/app/helpers/application_helper/toolbar/hosts_center.rb @@ -160,26 +160,6 @@ class ApplicationHelper::Toolbar::HostsCenter < ApplicationHelper::Toolbar::Basi ] ), ]) - button_group('host_lifecycle', [ - select( - :host_lifecycle_choice, - 'fa fa-recycle fa-lg', - t = N_('Lifecycle'), - t, - :items => [ - button( - :host_miq_request_new, - 'pficon pficon-add-circle-o fa-lg', - N_('Request to Provision items'), - N_('Provision items'), - :url_parms => "main_div", - :send_checked => true, - :enabled => false, - :onwhen => "1+", - :klass => ApplicationHelper::Button::ButtonNewDiscover), - ] - ), - ]) button_group('host_operations', [ select( :host_power_choice, diff --git a/app/presenters/menu/default_menu.rb b/app/presenters/menu/default_menu.rb index 47ad04306a05..c070f458d88b 100644 --- a/app/presenters/menu/default_menu.rb +++ b/app/presenters/menu/default_menu.rb @@ -81,7 +81,6 @@ def infrastructure_menu_section Menu::Item.new('storage', N_('Datastores'), 'storage', {:feature => 'storage_show_list'}, '/storage/explorer'), Menu::Item.new('pxe', N_('PXE'), 'pxe', {:feature => 'pxe', :any => true}, '/pxe/explorer'), Menu::Item.new('switch', N_('Networking'), 'infra_networking', {:feature => 'infra_networking', :any => true}, '/infra_networking/explorer'), - Menu::Item.new('miq_request_host', N_('Requests'), 'host_miq_request', {:feature => 'host_miq_request_show_list'}, '/miq_request?typ=host'), Menu::Item.new('infra_topology', N_('Topology'), 'infra_topology', {:feature => 'infra_topology', :any => true}, '/infra_topology') ]) end diff --git a/app/views/miq_request/_request.html.haml b/app/views/miq_request/_request.html.haml index e6ef7bbc5f73..b23c80d1f8cb 100644 --- a/app/views/miq_request/_request.html.haml +++ b/app/views/miq_request/_request.html.haml @@ -94,13 +94,6 @@ .col-md-8{:onclick => "DoNav('#{'/miq_request/show/' << @miq_request.id.to_s << '?display=miq_provisions'}');", :title => _("Click to view details")} = h(@miq_request.resource.miq_provisions.length) - - if @miq_request.resource_type == "MiqHostProvisionRequest" && @miq_request.resource.miq_host_provisions.length > 0 - .form-group - %label.control-label.col-md-2 - = _("Provisioned Hosts") - .col-md-8{:title => _("Click to view details"), - :onclick => "DoNav('#{'/miq_request/show/' << @miq_request.id.to_s << '?display=miq_provisions'}');"} - = h(@miq_request.resource.miq_host_provisions.length) - if @edit && @edit[:stamp_typ] %table{:width => "100%"} %tr diff --git a/spec/helpers/application_helper/buttons/miq_request_approval_spec.rb b/spec/helpers/application_helper/buttons/miq_request_approval_spec.rb index 2e3fd1dc17b2..6731945cb0f4 100644 --- a/spec/helpers/application_helper/buttons/miq_request_approval_spec.rb +++ b/spec/helpers/application_helper/buttons/miq_request_approval_spec.rb @@ -14,7 +14,7 @@ let(:request) { "SomeRequest" } let(:username) { user.name } let(:state) { "xx" } - %w(MiqProvisionRequest MiqHostProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest + %w(MiqProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest VmMigrateRequest AutomationRequest ServiceTemplateProvisionRequest).each do |cls| context "id = miq_request_approval" do before do diff --git a/spec/helpers/application_helper/buttons/miq_request_copy_spec.rb b/spec/helpers/application_helper/buttons/miq_request_copy_spec.rb index b18ad02ecf5b..8e33904e7600 100644 --- a/spec/helpers/application_helper/buttons/miq_request_copy_spec.rb +++ b/spec/helpers/application_helper/buttons/miq_request_copy_spec.rb @@ -11,7 +11,7 @@ let(:view_context) { setup_view_context_with_sandbox({}) } let(:user) { FactoryGirl.create(:user) } - %w(MiqProvisionRequest MiqHostProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest + %w(MiqProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest VmMigrateRequest AutomationRequest ServiceTemplateProvisionRequest).each do |cls| let(:request) { "MiqProvisionRequest" } let(:username) { user.name } diff --git a/spec/helpers/application_helper/buttons/miq_request_edit_spec.rb b/spec/helpers/application_helper/buttons/miq_request_edit_spec.rb index a10bbe5b8dec..5ec1d8fc4b7e 100644 --- a/spec/helpers/application_helper/buttons/miq_request_edit_spec.rb +++ b/spec/helpers/application_helper/buttons/miq_request_edit_spec.rb @@ -14,7 +14,7 @@ let(:request) { "SomeRequest" } let(:username) { user.name } let(:state) { "xx" } - %w(MiqProvisionRequest MiqHostProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest + %w(MiqProvisionRequest VmReconfigureRequest VmCloudReconfigureRequest VmMigrateRequest AutomationRequest ServiceTemplateProvisionRequest).each do |cls| context 'miq_request_edit' do before do