Skip to content

Commit

Permalink
Merge pull request #7577 from Autosde/implement_show_list_for_storage…
Browse files Browse the repository at this point in the history
…_consumers

Implement show list for Host initiators
  • Loading branch information
h-kataria authored Jan 15, 2021
2 parents a0f069b + 19d10d9 commit 9523db2
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 6 deletions.
47 changes: 47 additions & 0 deletions app/controllers/host_initiator_controller.rb
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions app/controllers/mixins/ems_common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def display_methods
flavors
floating_ips
host_aggregates
host_initiators
hosts
images
instances
Expand Down
2 changes: 2 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1095,6 +1096,7 @@ def pdf_page_size_style
container_service
container_template
storage_resource
host_initiator
container_topology
ems_block_storage
ems_cloud
Expand Down
1 change: 1 addition & 0 deletions app/helpers/application_helper/page_layouts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ def show_adv_search?
security_policy_rule
service
storage_resource
host_initiator
templates
vm
]
Expand Down
3 changes: 3 additions & 0 deletions app/helpers/host_initiator_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module HostInitiatorHelper
include_concern 'TextualSummary'
end
46 changes: 46 additions & 0 deletions app/helpers/host_initiator_helper/textual_summary.rb
Original file line number Diff line number Diff line change
@@ -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
15 changes: 10 additions & 5 deletions app/presenters/menu/default_menu.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
7 changes: 7 additions & 0 deletions app/views/host_initiator/show.html.haml
Original file line number Diff line number Diff line change
@@ -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"
2 changes: 2 additions & 0 deletions app/views/host_initiator/show_list.html.haml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#main_div
= render :partial => 'layouts/gtl'
18 changes: 18 additions & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
80 changes: 80 additions & 0 deletions product/views/HostInitiator.yaml
Original file line number Diff line number Diff line change
@@ -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:
2 changes: 2 additions & 0 deletions spec/config/routes.pending.yml
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,8 @@ HostController:
- timeline_data
- tree_autoload
- wait_for_task
HostInitiatorController:
- index
InfraNetworkingController:
- dialog_field_changed
- dialog_form_button_pressed
Expand Down
2 changes: 1 addition & 1 deletion spec/presenters/menu/default_menu_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 9523db2

Please sign in to comment.