diff --git a/app/controllers/miq_request_controller.rb b/app/controllers/miq_request_controller.rb index 5b417f5049e..1e096328531 100644 --- a/app/controllers/miq_request_controller.rb +++ b/app/controllers/miq_request_controller.rb @@ -406,17 +406,13 @@ def prov_scope(opts) scope << [:with_requester, opts[:user_choice]] if opts[:user_choice] && opts[:user_choice] != "all" scope << [:with_approval_state, opts[:applied_states]] if opts[:applied_states].present? - scope << [:with_type, request_types_for_model.keys] + scope << [:with_type, MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].keys] scope << [:with_request_type, opts[:type_choice]] if opts[:type_choice] && opts[:type_choice] != "all" scope << [:with_reason_like, opts[:reason_text]] if opts[:reason_text].present? scope end - def request_types_for_model # FIXME - MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].map { |k, v| [k, v.map { |x, y| [x, _(y)] }.to_h] }.to_h - end - def model_request_type_from_layout case @layout when "miq_request_ae" then :Automate @@ -426,7 +422,9 @@ def model_request_type_from_layout end def request_types_for_dropdown - request_types_for_model.values.each_with_object({}) { |t, h| t.each { |k, v| h[k] = v } } + MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].values.reduce({}) do |hash, item| + hash.merge(item) { |key, val| _(val) } + end end # Set all task options to default @@ -438,7 +436,7 @@ def prov_set_default_options opts[:types] = request_types_for_dropdown opts[:users] = Rbac::Filterer.filtered(MiqRequest.where( - :type => request_types_for_model.keys, + :type => MiqRequest::MODEL_REQUEST_TYPES[model_request_type_from_layout].keys, :created_on => (30.days.ago.utc)..(Time.now.utc) )).each_with_object({}) do |r, h| h[r.requester_id] = if r.requester.nil?