@@ -222,7 +222,7 @@ def breadcrumb_name(_model)
222
222
def process_cloud_object_storage_buttons ( pressed )
223
223
assert_privileges ( pressed )
224
224
225
- klass = get_rec_cls
225
+ klass = record_class
226
226
task = pressed . sub ( "#{ klass . name . underscore . to_sym } _" , "" )
227
227
228
228
return tag ( klass ) if task == "tag"
@@ -247,33 +247,12 @@ def cloud_object_store_button_operation(klass, task)
247
247
process_objects ( items . ids . sort , method , display_name )
248
248
end
249
249
250
- def get_rec_cls
251
- # FIXME: the specs for ci_processing rely on setting (and testing) request.parameters['controller'].
252
- # That is wrong and needs to be fixed.
253
- case request . parameters [ "controller" ] || controller_name
254
- when "miq_template"
255
- MiqTemplate
256
- when "orchestration_stack"
257
- params [ :display ] == "instances" ? VmOrTemplate : OrchestrationStack
258
- when "service"
259
- Service
260
- when "cloud_object_store_container"
261
- params [ :pressed ] . starts_with? ( "cloud_object_store_object" ) ? CloudObjectStoreObject : CloudObjectStoreContainer
262
- when "cloud_object_store_object"
263
- CloudObjectStoreObject
264
- when "ems_storage"
265
- params [ :pressed ] . starts_with? ( "cloud_object_store_object" ) ? CloudObjectStoreObject : CloudObjectStoreContainer
266
- when "ems_cluster"
267
- %w[ all_vms vms ] . include? ( params [ :display ] ) || params [ :pressed ] . starts_with? ( 'miq_template' ) ? VmOrTemplate : EmsCluster
268
- when "storage"
269
- %w[ all_vms vms ] . include? ( params [ :display ] ) ? VmOrTemplate : Storage
270
- else
271
- VmOrTemplate
272
- end
250
+ def record_class
251
+ VmOrTemplate
273
252
end
274
253
275
254
def process_objects ( objs , task , display_name = nil )
276
- klass = get_rec_cls
255
+ klass = record_class
277
256
klass_str = klass . to_s
278
257
279
258
assert_rbac ( klass , objs )
@@ -608,7 +587,7 @@ def process_resourcepools(rps, task)
608
587
# on a record
609
588
# options - other optional parameters
610
589
def generic_button_operation ( action , action_name , operation , options = { } )
611
- records = find_records_with_rbac ( get_rec_cls , checked_or_params )
590
+ records = find_records_with_rbac ( record_class , checked_or_params )
612
591
if testable_action ( action ) && !records_support_feature? ( records , action_to_feature ( action ) )
613
592
javascript_flash (
614
593
:text => _ ( "%{action_name} action does not apply to selected items" ) % { :action_name => action_name } ,
0 commit comments