Skip to content

Commit 6a67826

Browse files
author
Hilda Stastna
committed
Get proper record class for items displayed through various controllers
Issue: #5924 Get proper record class for items displayed through Storage Relationships, also for items displayed through Cluster's Relationships, items in Services Workloads, VMs, Instances, Images displayed through various controllers.
1 parent 83c4af9 commit 6a67826

11 files changed

+60
-0
lines changed

app/controllers/cloud_object_store_container_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,10 @@ def form_params_create
119119

120120
private
121121

122+
def record_class
123+
params[:pressed].starts_with?('cloud_object_store_object') ? CloudObjectStoreObject : CloudObjectStoreContainer
124+
end
125+
122126
def retrieve_provider_regions
123127
managers = ManageIQ::Providers::CloudManager.supported_subclasses.select(&:supports_regions?)
124128
managers.each_with_object({}) do |manager, provider_regions|

app/controllers/cloud_object_store_object_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def title
2929

3030
private
3131

32+
def record_class
33+
CloudObjectStoreObject
34+
end
35+
3236
def textual_group_list
3337
[%i[properties relationships], %i[tags]]
3438
end

app/controllers/ems_cluster_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,10 @@ def button
9595

9696
private
9797

98+
def record_class
99+
%w[all_vms vms].include?(params[:display]) || params[:pressed].starts_with?('miq_template') ? super : EmsCluster
100+
end
101+
98102
def textual_group_list
99103
[
100104
%i[relationships],

app/controllers/ems_infra_controller.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,19 @@ def ems_infra_form_fields
224224

225225
private
226226

227+
def record_class
228+
case params[:pressed].starts_with?
229+
when 'ems_cluster'
230+
EmsCluster
231+
when 'orchestration_stack'
232+
OrchestrationStack
233+
when 'storage'
234+
Storage
235+
else
236+
super
237+
end
238+
end
239+
227240
############################
228241
# Special EmsCloud link builder for restful routes
229242
def show_link(ems, options = {})

app/controllers/ems_storage_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ def breadcrumbs_options
7373

7474
private
7575

76+
def record_class
77+
params[:pressed].starts_with?('cloud_object_store_object') ? CloudObjectStoreObject : CloudObjectStoreContainer
78+
end
79+
7680
def textual_group_list
7781
[
7882
%i[properties status],

app/controllers/host_controller.rb

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,6 +380,17 @@ def host_form_fields
380380

381381
private
382382

383+
def record_class
384+
case params[:display] || @display
385+
when 'storages'
386+
Storage
387+
when 'vms', 'miq_templates'
388+
super
389+
else
390+
Host
391+
end
392+
end
393+
383394
def textual_group_list
384395
[
385396
%i[properties relationships],

app/controllers/miq_template_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ def index
1818

1919
private
2020

21+
def record_class
22+
MiqTemplate
23+
end
24+
2125
def get_session_data
2226
@title = _("Templates")
2327
@layout = session[:miq_template_type] ? session[:miq_template_type] : "miq_template"

app/controllers/orchestration_stack_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,10 @@ def stacks_ot_copy
146146

147147
private
148148

149+
def record_class
150+
params[:display] == 'instances' ? super : OrchestrationStack
151+
end
152+
149153
def textual_group_list
150154
[%i[properties lifecycle relationships], %i[tags]]
151155
end

app/controllers/resource_pool_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ def button
6464

6565
private
6666

67+
def record_class
68+
%w[all_vms vms].include?(params[:display]) ? super : ResourcePool
69+
end
70+
6771
def textual_group_list
6872
[%i[properties relationships], %i[configuration smart_management]]
6973
end

app/controllers/service_controller.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,10 @@ def display_generic_objects
204204

205205
private
206206

207+
def record_class
208+
Service
209+
end
210+
207211
def sanitize_output(stdout)
208212
htm = stdout.gsub('"', '\"')
209213

0 commit comments

Comments
 (0)