diff --git a/app/controllers/host_initiator_controller.rb b/app/controllers/host_initiator_controller.rb new file mode 100644 index 00000000000..150d12351f9 --- /dev/null +++ b/app/controllers/host_initiator_controller.rb @@ -0,0 +1,47 @@ +class HostInitiatorController < ApplicationController + include Mixins::GenericListMixin + include Mixins::GenericShowMixin + include Mixins::GenericSessionMixin + include Mixins::BreadcrumbsMixin + include Mixins::GenericFormMixin + include Mixins::GenericButtonMixin + + before_action :check_privileges + before_action :get_session_data + after_action :cleanup_action + after_action :set_session_data + + def show + if params[:id].nil? + @breadcrumbs.clear + end + super + end + + private + + def textual_group_list + [%i[properties san_addresses], %i[tags]] + end + helper_method :textual_group_list + + def set_session_data + session[:layout] = @layout + end + + def breadcrumbs_options + { + :breadcrumbs => [ + {:title => _("Storage")}, + {:title => _("Block Storage")}, + {:title => _("Host Initiators"), :url => controller_url}, + ], + } + end + + menu_section " host_initiator" + + feature_for_actions "#{controller_name}_show_list", *ADV_SEARCH_ACTIONS + feature_for_actions "#{controller_name}_show_list", :download_data + feature_for_actions "#{controller_name}_show", :download_summary_pdf +end diff --git a/app/controllers/mixins/ems_common.rb b/app/controllers/mixins/ems_common.rb index dad5580e7c3..900f104d61b 100644 --- a/app/controllers/mixins/ems_common.rb +++ b/app/controllers/mixins/ems_common.rb @@ -98,6 +98,7 @@ def display_methods flavors floating_ips host_aggregates + host_initiators hosts images instances diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 15b470909d7..df0580731c9 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -755,6 +755,7 @@ def display_back_button? def display_adv_search? %w[auth_key_pair_cloud storage_resource + host_initiator physical_storage availability_zone automation_manager @@ -1095,6 +1096,7 @@ def pdf_page_size_style container_service container_template storage_resource + host_initiator container_topology ems_block_storage ems_cloud diff --git a/app/helpers/application_helper/page_layouts.rb b/app/helpers/application_helper/page_layouts.rb index 6316999e7f7..f957d61e42e 100644 --- a/app/helpers/application_helper/page_layouts.rb +++ b/app/helpers/application_helper/page_layouts.rb @@ -236,6 +236,7 @@ def show_adv_search? security_policy_rule service storage_resource + host_initiator templates vm ] diff --git a/app/helpers/host_initiator_helper.rb b/app/helpers/host_initiator_helper.rb new file mode 100644 index 00000000000..967c79ee960 --- /dev/null +++ b/app/helpers/host_initiator_helper.rb @@ -0,0 +1,3 @@ +module HostInitiatorHelper + include_concern 'TextualSummary' +end diff --git a/app/helpers/host_initiator_helper/textual_summary.rb b/app/helpers/host_initiator_helper/textual_summary.rb new file mode 100644 index 00000000000..369e7620e23 --- /dev/null +++ b/app/helpers/host_initiator_helper/textual_summary.rb @@ -0,0 +1,46 @@ +module HostInitiatorHelper::TextualSummary + include TextualMixins::TextualGroupTags + + # + # Groups + # + + def textual_group_properties + TextualGroup.new( + _("Properties"), + %i[ + name + ems + physical_storage + ] + ) + end + + def textual_group_san_addresses + san_addresses_values = @record.san_addresses.map do |san_address| + [san_address.class.display_name, san_address.address_value] + end + + TextualMultilabel.new( + _("SAN Addresses"), + :labels => [_("Type"), _("Value")], + :values => san_addresses_values + ) + end + + # + # Items + # + + def textual_name + {:label => _("Name"), :value => @record.name} + end + + def textual_ems + textual_link(@record.ext_management_system) + end + + def textual_physical_storage + textual_link(@record.physical_storage) + end +end diff --git a/app/presenters/menu/default_menu.rb b/app/presenters/menu/default_menu.rb index fd5b134a2f0..95c713e15f2 100644 --- a/app/presenters/menu/default_menu.rb +++ b/app/presenters/menu/default_menu.rb @@ -186,16 +186,21 @@ def block_storage_menu_section 'cloud_volume_type', {:feature => 'cloud_volume_type_show_list'}, '/cloud_volume_type/show_list'), - Menu::Item.new('storage_resource', - N_('Storage Resources'), - 'storage_resource', - {:feature => 'storage_resource_show_list'}, - '/storage_resource/show_list'), + Menu::Item.new('host_initiator', + N_('Host Initiators'), + 'host_initiator', + {:feature => 'host_initiator_show_list'}, + '/host_initiator/show_list'), Menu::Item.new('physical_storage', N_('Storages'), 'physical_storage', {:feature => 'physical_storage_show_list'}, '/physical_storage/show_list'), + Menu::Item.new('storage_resource', + N_('Storage Resources'), + 'storage_resource', + {:feature => 'storage_resource_show_list'}, + '/storage_resource/show_list'), ]) end diff --git a/app/views/host_initiator/show.html.haml b/app/views/host_initiator/show.html.haml new file mode 100644 index 00000000000..7ff9a3b9b04 --- /dev/null +++ b/app/views/host_initiator/show.html.haml @@ -0,0 +1,7 @@ +- if %w(host_initiator).include?(@display) + = render :partial => "layouts/gtl", :locals => {:action_url => "show/#{@record.id}"} +- else + - if @showtype == "item" + = render :partial => "layouts/item" + - else + = render :partial => "layouts/textual_groups_generic" diff --git a/app/views/host_initiator/show_list.html.haml b/app/views/host_initiator/show_list.html.haml new file mode 100644 index 00000000000..039604839f2 --- /dev/null +++ b/app/views/host_initiator/show_list.html.haml @@ -0,0 +1,2 @@ +#main_div + = render :partial => 'layouts/gtl' diff --git a/config/routes.rb b/config/routes.rb index c8d817b47a5..6960c2b2705 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -2391,6 +2391,24 @@ save_post }, + :host_initiator => { + :get => %w[ + download_data + download_summary_pdf + index + show + show_list + ], + :post => %w[ + listnav_search_selected + quick_search + show_list + ] + + adv_search_post + + exp_post + + save_post + }, + :storage_resource => { :get => %w[ download_data diff --git a/product/views/HostInitiator.yaml b/product/views/HostInitiator.yaml new file mode 100644 index 00000000000..c64ddf83c12 --- /dev/null +++ b/product/views/HostInitiator.yaml @@ -0,0 +1,80 @@ +# +# This is an MIQ Report configuration file +# Single value parameters are specified as: +# single_value_parm: value +# Multiple value parameters are specified as: +# multi_value_parm: +# - value 1 +# - value 2 +# + +# Report title +title: Host Initiators + +# Menu name +name: HostInitiator + +# Main DB table report is based on +db: HostInitiator +include: + ext_management_system: + columns: + - name + physical_storage: + columns: + - name + +# Columns to fetch from the main table +cols: +- name +- v_total_addresses + + +# Included tables and columns for query performance +#include_for_find: +# :tags: {} + +# Order of columns (from all tables) +col_order: +- name +- ext_management_system.name +- physical_storage.name +- v_total_addresses + + +# Column titles, in order +headers: +- Name +- EMS Name +- Storage System Name +- Total addresses + +# Condition(s) string for the SQL query +conditions: + +# Order string for the SQL query +order: Ascending + +# Columns to sort the report on, in order +sortby: +- name + +# Group rows (y=yes,n=no,c=count) +group: n + +# Graph type +# Bar +# Column +# ColumnThreed +# ParallelThreedColumn +# Pie +# PieThreed +# StackedBar +# StackedColumn +# StackedThreedColumn + +graph: + +# Dimensions of graph (1 or 2) +# Note: specifying 2 for a single dimension graph may not return expected results +dims: diff --git a/spec/config/routes.pending.yml b/spec/config/routes.pending.yml index 39f66288bcf..5b27b9dd4f3 100644 --- a/spec/config/routes.pending.yml +++ b/spec/config/routes.pending.yml @@ -716,6 +716,8 @@ HostController: - timeline_data - tree_autoload - wait_for_task +HostInitiatorController: +- index InfraNetworkingController: - dialog_field_changed - dialog_form_button_pressed diff --git a/spec/presenters/menu/default_menu_spec.rb b/spec/presenters/menu/default_menu_spec.rb index 112a4984f5c..80e745e03f1 100644 --- a/spec/presenters/menu/default_menu_spec.rb +++ b/spec/presenters/menu/default_menu_spec.rb @@ -58,7 +58,7 @@ it "shows correct content for Block Storage submenu" do menu = Menu::DefaultMenu.block_storage_menu_section.items.map(&:name) - result = ["Managers", "Volumes", "Volume Snapshots", "Volume Backups", "Volume Types", "Storage Resources", "Storages"] + result = ["Managers", "Volumes", "Volume Snapshots", "Volume Backups", "Volume Types", "Host Initiators", "Storages", "Storage Resources"] expect(menu).to eq(result) end end