Skip to content

Commit

Permalink
Merge pull request #8548 from nasark/iso_datastore_to_storage_support
Browse files Browse the repository at this point in the history
IsoDatastore to Storage support
  • Loading branch information
agrare authored Dec 14, 2022
2 parents 0670437 + 2358dd9 commit 4566cde
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 144 deletions.
37 changes: 6 additions & 31 deletions app/controllers/pxe_controller/iso_datastores.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,6 @@
module PxeController::IsoDatastores
extend ActiveSupport::Concern

def iso_datastore_new
assert_privileges("iso_datastore_new")
@isd = IsoDatastore.new
iso_datastore_set_form_vars
@in_a_form = true
replace_right_cell(:nodetype => "isd")
end

def iso_datastore_edit
unless params[:id]
obj = find_checked_items
@_params[:id] = obj[0] unless obj.empty?
end
@isd = @record = identify_record(params[:id], IsoDatastore) if params[:id]
iso_datastore_set_form_vars
@in_a_form = true
replace_right_cell(:nodetype => "isd")
end

# Refresh the power states for selected or single VMs
def iso_datastore_refresh
assert_privileges("iso_datastore_refresh")
iso_datastore_button_operation('synchronize_advertised_images_queue', 'Refresh Relationships')
end

# Common VM button handler routines
def iso_datastore_button_operation(method, display_name)
isds = []
Expand All @@ -43,7 +18,7 @@ def iso_datastore_button_operation(method, display_name)

get_node_info(x_node)
replace_right_cell(:nodetype => x_node, :replace_trees => [:iso_datastores])
elsif params[:id].nil? || IsoDatastore.find(params[:id]).nil? # showing 1 vm
elsif params[:id].nil? || Storage.supporting(:iso_datastore).find { |storage| storage.id == params[:id].to_i }.nil? # showing 1 vm
add_flash(_("ISO Datastore no longer exists"), :error)
iso_datastore_list
@refresh_partial = "layouts/x_gtl"
Expand Down Expand Up @@ -78,7 +53,7 @@ def iso_datastore_list
@sortcol = session[:iso_sortcol].nil? ? 0 : session[:iso_sortcol].to_i
@sortdir = session[:iso_sortdir].nil? ? "ASC" : session[:iso_sortdir]

@view, @pages = get_view(IsoDatastore) # Get the records (into a view) and the paginator
@view, @pages = get_view(Storage) # Get the records (into a view) and the paginator

@current_page = @pages[:current] unless @pages.nil? # save the current page number
session[:iso_sortcol] = @sortcol
Expand Down Expand Up @@ -119,7 +94,7 @@ def iso_datastore_set_form_vars

# Common Schedule button handler routines
def process_iso_datastores(elements, task, display_name)
process_elements(elements, IsoDatastore, task, display_name, "ems_id")
process_elements(elements, Storage, task, display_name, "ems_id")
end

def iso_datastore_get_node_info(treenodeid)
Expand All @@ -130,10 +105,10 @@ def iso_datastore_get_node_info(treenodeid)
else
@right_cell_div = "iso_datastore_details"
nodes = treenodeid.split("-")
if nodes[0] == "isd" && nodes.length == 2
if nodes[0] == "ds" && nodes.length == 2
# on iso_datastore node OR folder node is selected
@record = @isd = IsoDatastore.find(nodes.last)
@right_cell_text = _("ISO Datastore \"%{name}\"") % {:name => @isd.name}
@record = @isd = Storage.supporting(:iso_datastore).find { |storage| storage.id == nodes.last.to_i }
@right_cell_text = _("ISO Datastore \"%{name}\"") % {:name => @isd.name} unless @isd.nil?
elsif nodes[0] == "isi"
@record = @img = IsoImage.find(nodes.last)
@right_cell_text = _("ISO Image \"%{name}\"") % {:name => @img.name}
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ def view_to_url(view, parent = nil)
MiqSchedule
PxeServer
PxeImageType
IsoDatastore
Storage
CustomizationTemplate].include?(view.db) &&
%w[ops pxe report].include?(params[:controller])
return "/#{params[:controller]}/tree_select/?id=#{TreeBuilder.get_prefix_for_model(view.db)}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ class ApplicationHelper::Toolbar::IsoDatastoresCenter < ApplicationHelper::Toolb
t = N_('Configuration'),
t,
:items => [
button(
:iso_datastore_new,
'pficon pficon-add-circle-o fa-lg',
t = N_('Add a New ISO Datastore'),
t,
:klass => ApplicationHelper::Button::IsoDatastoreNew),
button(
:iso_datastore_delete,
'pficon pficon-delete fa-lg',
Expand Down
8 changes: 4 additions & 4 deletions app/helpers/pxe_helper/textual_summary.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ def textual_sysimg_type_provision_type
end

def textual_iso_datastore_basicinfo
%i[iso_datastore_name iso_datastore_last_refresh_on]
%i[iso_datastore_name iso_datastore_updated_on]
end

def textual_iso_datastore_name
{:label => _('Providers'), :value => @isd.name}
{:label => _('Providers'), :value => @isd.ext_management_system.name}
end

def textual_iso_datastore_last_refresh_on
{:label => _("Last Refreshed On"), :value => @isd.last_refresh_on}
def textual_iso_datastore_updated_on
{:label => _("Updated On"), :value => @isd.updated_on}
end

def textual_iso_img_info
Expand Down
1 change: 0 additions & 1 deletion app/presenters/tree_builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,6 @@ def prefixed_title(prefix, title)
"god" => "GenericObjectDefinition",
"h" => "Host",
"hot" => "ManageIQ::Providers::Openstack::CloudManager::OrchestrationTemplate",
"isd" => "IsoDatastore",
"isi" => "IsoImage",
"l" => "Lan",
"me" => "MiqEnterprise",
Expand Down
4 changes: 2 additions & 2 deletions app/presenters/tree_builder_iso_datastores.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class TreeBuilderIsoDatastores < TreeBuilder
has_kids_for IsoDatastore, %i[x_get_tree_iso_datastore_kids]
has_kids_for Storage, %i[x_get_tree_iso_datastore_kids]

private

Expand All @@ -16,7 +16,7 @@ def root_options

# Get root nodes count/array for explorer tree
def x_get_tree_roots
count_only_or_objects(false, IsoDatastore.all, "name")
count_only_or_objects(false, Storage.supporting(:iso_datastore), "name")
end

def x_get_tree_iso_datastore_kids(object, count_only)
Expand Down
4 changes: 0 additions & 4 deletions app/presenters/tree_node/iso_datastore.rb

This file was deleted.

66 changes: 0 additions & 66 deletions product/views/IsoDatastore.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions spec/helpers/application_helper/buttons/iso_datastore_new_spec.rb

This file was deleted.

7 changes: 0 additions & 7 deletions spec/presenters/tree_node/iso_datastore_spec.rb

This file was deleted.

0 comments on commit 4566cde

Please sign in to comment.