Skip to content

Commit

Permalink
Remove references to host provisioning
Browse files Browse the repository at this point in the history
  • Loading branch information
gmcculloug committed Jul 7, 2018
1 parent b9dab27 commit 041dd75
Show file tree
Hide file tree
Showing 18 changed files with 38 additions and 270 deletions.
40 changes: 10 additions & 30 deletions app/controllers/application_controller/miq_request_methods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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]

Expand All @@ -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
Expand Down
9 changes: 4 additions & 5 deletions app/controllers/host_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ def button
assign_policies(Host) if params[:pressed] == "host_protect"
edit_record if params[:pressed] == "host_edit"
custom_buttons if params[:pressed] == "custom_button"
prov_redirect if params[:pressed] == "host_miq_request_new"
toggleservicescheduling if params[:pressed] == "host_cloud_service_scheduling_toggle"
sethoststomanageable if params[:pressed] == "host_manageable"
introspecthosts if params[:pressed] == "host_introspect"
Expand All @@ -352,7 +351,7 @@ def button
"host_protect", "perf_reload"].include?(params[:pressed]) &&
@flash_array.nil? # Another screen showing, so return

if @flash_array.nil? && !@refresh_partial && !["host_miq_request_new"].include?(params[:pressed]) # if no button handler ran, show not implemented msg
if @flash_array.nil? && !@refresh_partial # if no button handler ran, show not implemented msg
add_flash(_("Button not yet implemented"), :error)
@refresh_partial = "layouts/flash_msg"
@refresh_div = "flash_msg_div"
Expand All @@ -363,21 +362,21 @@ def button
end
end

if @lastaction == "show" && ["custom_button", "host_miq_request_new"].include?(params[:pressed])
if @lastaction == "show" && ["custom_button"].include?(params[:pressed])
@host = @record = identify_record(params[:id])
end

if single_delete_test
single_delete_redirect
elsif params[:pressed].ends_with?("_edit") || ["host_miq_request_new", "#{pfx}_miq_request_new",
elsif params[:pressed].ends_with?("_edit") || ["#{pfx}_miq_request_new",
"#{pfx}_clone", "#{pfx}_migrate",
"#{pfx}_publish"].include?(params[:pressed])
if @flash_array
show_list
replace_gtl_main_div
else
if @redirect_controller
if ["host_miq_request_new", "#{pfx}_clone", "#{pfx}_migrate", "#{pfx}_publish"].include?(params[:pressed])
if ["#{pfx}_clone", "#{pfx}_migrate", "#{pfx}_publish"].include?(params[:pressed])
if flash_errors?
javascript_flash
else
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/miq_request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,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"
Expand Down
1 change: 0 additions & 1 deletion app/decorators/miq_event_definition_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 0 additions & 9 deletions app/helpers/application_helper/button/host_miq_request_new.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/helpers/application_helper/button/miq_request_copy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 ||
Expand Down
16 changes: 0 additions & 16 deletions app/helpers/application_helper/toolbar/host_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,22 +100,6 @@ class ApplicationHelper::Toolbar::HostCenter < ApplicationHelper::Toolbar::Basic
]
),
])
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',
t = N_('Provision this item'),
t,
:klass => ApplicationHelper::Button::HostMiqRequestNew),
]
),
])
button_group('host_monitoring', [
select(
:host_monitoring_choice,
Expand Down
20 changes: 0 additions & 20 deletions app/helpers/application_helper/toolbar/hosts_center.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 0 additions & 1 deletion app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
108 changes: 0 additions & 108 deletions app/views/miq_request/_prov_host_dialog.html.haml

This file was deleted.

35 changes: 14 additions & 21 deletions app/views/miq_request/_prov_host_grid.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -21,28 +21,21 @@
- else
= h(options[:host_headers][h])
%tbody
- unless options[:wf].kind_of?(MiqHostProvisionWorkflow)
- cls = @edit[:new][:placement_host_name] && @edit[:new][:placement_host_name][0].nil? ? "selected" : ""
%tr{:class => cls, :onclick => "miqAjax('/miq_request/prov_field_changed/?#{field_id}=__HOST__NONE__&id=#{id}');"}
%td
= "<#{_('None')}>"
%td
%td
%td
%td
%td
- cls = @edit[:new][:placement_host_name] && @edit[:new][:placement_host_name][0].nil? ? "selected" : ""
%tr{:class => cls, :onclick => "miqAjax('/miq_request/prov_field_changed/?#{field_id}=__HOST__NONE__&id=#{id}');"}
%td
= "<#{_('None')}>"
%td
%td
%td
%td
%td
- @hosts.each do |row|
- @id = row.id
- if options[:wf].kind_of?(MiqHostProvisionWorkflow)
%tr
- options[:host_columns].each do |col|
%td
= h(row.send(col))
- else
- cls = @edit[:new][:placement_host_name] && @edit[:new][:placement_host_name][0] == @id ? "selected" : ""
%tr{:class => cls, :onclick => "miqAjax('/miq_request/prov_field_changed/?#{field_id}=#{@id}&id=#{id}');"}
- options[:host_columns].each do |col|
%td
= h(row.send(col))
- cls = @edit[:new][:placement_host_name] && @edit[:new][:placement_host_name][0] == @id ? "selected" : ""
%tr{:class => cls, :onclick => "miqAjax('/miq_request/prov_field_changed/?#{field_id}=#{@id}&id=#{id}');"}
- options[:host_columns].each do |col|
%td
= h(row.send(col))
:javascript
miqScrollToSelected('prov_host_div')
7 changes: 0 additions & 7 deletions app/views/miq_request/_request.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading

0 comments on commit 041dd75

Please sign in to comment.