Skip to content

Commit a791d15

Browse files
authored
Merge pull request #8887 from kbrock/add-provider-information
Add icons and provider name to a few screens
2 parents 6a54750 + bd8398e commit a791d15

File tree

10 files changed

+49
-5
lines changed

10 files changed

+49
-5
lines changed

app/helpers/auth_key_pair_cloud_helper/textual_summary.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,17 @@ module AuthKeyPairCloudHelper::TextualSummary
55
# Groups
66
#
77
def textual_group_relationships
8-
TextualGroup.new(_("Relationships"), %i[vms])
8+
TextualGroup.new(_("Relationships"), %i[provider vms])
99
end
1010

1111
def textual_group_properties
1212
TextualGroup.new(_("Properties"), %i[name fingerprint])
1313
end
1414

15+
def textual_provider
16+
textual_link(@record.ext_management_system)
17+
end
18+
1519
#
1620
# Items
1721
#

app/helpers/resource_pool_helper/textual_summary.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ module ResourcePoolHelper::TextualSummary
33
# Groups
44
#
55

6+
def textual_ext_management_system
7+
textual_link(@record.ext_management_system)
8+
end
9+
610
def textual_group_properties
711
TextualGroup.new(
812
_("Properties"),
@@ -16,7 +20,7 @@ def textual_group_properties
1620
def textual_group_relationships
1721
TextualGroup.new(
1822
_("Relationships"),
19-
%i[parent_datacenter parent_cluster parent_host direct_vms allvms_size resource_pools]
23+
%i[ext_management_system parent_datacenter parent_cluster parent_host direct_vms allvms_size resource_pools]
2024
)
2125
end
2226

lib/gtl_formatter.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,9 @@ def self.format_cols(view, row, controller, options)
9191
"prov_type" => :service_template_format,
9292
},
9393
}
94+
# all tables get a first column for icons.
9495
cols.push(format_icon_column(view, row, controller, options[:clickable])) if VIEW_WITH_CUSTOM_ICON.include?(view.db)
96+
# row is a ruport object, so we use listicon_item to look up the original record for the row.
9597
record = controller.listicon_item(view, row['id'])
9698
view.col_order.each_with_index do |col, col_idx|
9799
next if view.column_is_hidden?(col, controller)
@@ -104,7 +106,12 @@ def self.format_cols(view, row, controller, options)
104106
celltext, span = send(special_cases[view.extras[:filename]][view.col_order[col_idx]], row[col])
105107
elsif COLUMN_WITH_IMAGE.key?(col)
106108
# Generate html for the list icon
107-
icon, icon2, image = send(COLUMN_WITH_IMAGE[col], record)
109+
# NOTE: COLUMN_WITH_IMAGE basically whitelists these associations
110+
associations = col.split('.')[0..-2] # drop the last value - the column name
111+
# follow associations so we can pass the approperiate record to be decorated / displayed
112+
col_record = associations.inject(record) { |r, association_name| r.send(association_name) }
113+
# NOTE: currently this only calls fonticon_or_fileicon
114+
icon, icon2, image = send(COLUMN_WITH_IMAGE[col], col_record)
108115
text = format_col_for_display(view, row, col)
109116
item = {:title => text,
110117
:image => ActionController::Base.helpers.image_path(image.to_s),
@@ -162,6 +169,8 @@ def self.textual_power_state_whitelisted(state)
162169
quad_icon[:background]
163170
end
164171

172+
# NOTE: this is for the icon column
173+
# so unlike the others, there is no text here
165174
def self.format_icon_column(view, row, controller, clickable)
166175
item = controller.listicon_item(view, row['id'])
167176
icon, icon2, image = fonticon_or_fileicon(item)

product/views/Container.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,20 +30,25 @@ include:
3030
container_image:
3131
columns:
3232
- name
33+
ext_management_system:
34+
columns:
35+
- name
3336

3437
# Included tables and columns for query performance
3538
include_for_find:
3639

3740
# Order of columns (from all tables)
3841
col_order:
3942
- name
43+
- ext_management_system.name
4044
- container_group.name
4145
- container_image.name
4246
- state
4347

4448
# Column titles, in order
4549
headers:
4650
- Name
51+
- Provider
4752
- Pod Name
4853
- Image
4954
- State

product/views/ManageIQ_Providers_CloudManager_AuthKeyPair.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,13 @@ db: ManageIQ::Providers::CloudManager::AuthKeyPair
2121
cols:
2222
- name
2323
- fingerprint
24+
- type
2425

2526
# Included tables (joined, has_one, has_many) and columns
2627
include:
28+
ext_management_system:
29+
columns:
30+
- name
2731

2832
# Included tables and columns for query performance
2933
include_for_find:
@@ -32,11 +36,13 @@ include_for_find:
3236
col_order:
3337
- name
3438
- fingerprint
39+
- ext_management_system.name
3540

3641
# Column titles, in order
3742
headers:
3843
- Name
3944
- Fingerprint
45+
- Provider
4046

4147
# Condition(s) string for the SQL query
4248
conditions:

product/views/PlacementGroup.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@ include_for_find:
3939
col_order:
4040
- name
4141
- id
42+
- ext_management_system.name
4243
- total_vms
4344

4445
# Column titles, in order
4546
headers:
4647
- Name
4748
- ID
49+
- Provider
4850
- Total VMs
4951

5052
# Condition(s) string for the SQL query

product/views/ResourcePool.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,14 @@ cols:
3030

3131
# Included tables (joined, has_one, has_many) and columns
3232
include:
33+
ext_management_system:
34+
columns:
35+
- name
3336

3437
# Order of columns (from all tables)
3538
col_order:
3639
- name
40+
- ext_management_system.name
3741
- v_direct_vms
3842
- v_total_vms
3943
- v_total_miq_templates
@@ -45,6 +49,7 @@ col_order:
4549
# Column titles, in order
4650
headers:
4751
- Name
52+
- Provider
4853
- Direct VMs
4954
- Total VMs
5055
- Total Templates

product/views/Switch.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,23 @@ cols:
2323
- ports
2424
- switch_uuid
2525

26+
# Included tables (joined, has_one, has_many) and columns
27+
include:
28+
ext_management_system:
29+
columns:
30+
- name
31+
2632
# Order of columns (from all tables)
2733
col_order:
2834
- name
35+
- ext_management_system.name
2936
- ports
3037
- switch_uuid
3138

3239
# Column titles, in order
3340
headers:
3441
- Name
42+
- Provider
3543
- Ports
3644
- UUID
3745

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
describe AuthKeyPairCloudHelper::TextualSummary do
2-
include_examples "textual_group", "Relationships", %i(vms)
3-
include_examples "textual_group", "Properties", %i(name fingerprint)
2+
include_examples "textual_group", "Relationships", %i[provider vms]
3+
include_examples "textual_group", "Properties", %i[name fingerprint]
44
end

spec/helpers/resource_pool_helper/textual_summary_spec.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
)
1111

1212
include_examples "textual_group", "Relationships", %i(
13+
ext_management_system
1314
parent_datacenter
1415
parent_cluster
1516
parent_host

0 commit comments

Comments
 (0)