diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index f7e86291dcf..db68e491952 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -880,6 +880,8 @@ def view_to_hash(view) celltext = Dictionary.gettext(row[col], :type => :model, :notfound => :titleize) when 'approval_state' celltext = _(PROV_STATES[row[col]]) + when 'prov_type' + celltext = row[col] ? _(ServiceTemplate::CATALOG_ITEM_TYPES[row[col]]) : '' when "result" new_row[:cells] << {:span => result_span_class(row[col]), :text => row[col].titleize} when "severity" diff --git a/app/controllers/catalog_controller.rb b/app/controllers/catalog_controller.rb index ca5cc91ff70..f8b3669cf59 100644 --- a/app/controllers/catalog_controller.rb +++ b/app/controllers/catalog_controller.rb @@ -111,7 +111,6 @@ def atomic_st_edit @edit[:new] ||= {} @edit[:current] ||= {} @edit[:key] = "prov_edit__new" - @edit[:st_prov_types] = catalog_item_types end @edit[:new][:st_prov_type] = @record.prov_type if @record.prov_type.present? # set name and description for ServiceTemplate record @@ -127,21 +126,6 @@ def atomic_st_edit end end - def catalog_item_types - { - "amazon" => "Amazon", - "azure" => "Azure", - "generic" => "Generic", - "generic_orchestration" => "Orchestration", - "generic_ansible_tower" => "AnsibleTower", - "google" => "Google", - "microsoft" => "SCVMM", - "openstack" => "OpenStack", - "redhat" => "RHEV", - "vmware" => "VMware" - } - end - def atomic_form_field_changed # need to check req_id in session since we are using common code for prov requests and atomic ST screens id = session[:edit][:req_id] || "new" diff --git a/app/views/catalog/_form_basic_info.html.haml b/app/views/catalog/_form_basic_info.html.haml index 64ee242e2ab..83c8a6431fd 100644 --- a/app/views/catalog/_form_basic_info.html.haml +++ b/app/views/catalog/_form_basic_info.html.haml @@ -52,6 +52,13 @@ :class => "selectpicker") :javascript miqSelectPickerEvent('dialog_id', '#{url}') + - if @edit[:new][:st_prov_type] + .form-group + %label.col-md-2.control-label + = _('Item Type') + .col-md-4 + %p.form-control-static + = h(ServiceTemplate::CATALOG_ITEM_TYPES[@edit[:new][:st_prov_type]]) - if @edit[:new][:st_prov_type] == "generic" .form-group %label.col-md-2.control-label diff --git a/app/views/catalog/_sandt_tree_show.html.haml b/app/views/catalog/_sandt_tree_show.html.haml index 86623b935f2..1ed8a48d4c5 100644 --- a/app/views/catalog/_sandt_tree_show.html.haml +++ b/app/views/catalog/_sandt_tree_show.html.haml @@ -40,6 +40,12 @@ = _('Dialog') .col-md-8 = h(@sb[:dialog_label]) + - if @record.prov_type + .form-group + %label.col-md-2.control-label + = _('Item Type') + .col-md-8 + = h(ServiceTemplate::CATALOG_ITEM_TYPES[@record.prov_type]) - if @record.prov_type == "generic" .form-group %label.col-md-2.control-label diff --git a/app/views/catalog/_st_form.html.haml b/app/views/catalog/_st_form.html.haml index 7f4723b9123..7cda7c22a80 100644 --- a/app/views/catalog/_st_form.html.haml +++ b/app/views/catalog/_st_form.html.haml @@ -8,7 +8,7 @@ .form-group %label.col-md-2.control-label= _('Catalog Item Type') .col-md-8 - - array = Array(@edit[:st_prov_types].invert).sort_by { |a| a.first.downcase } + - array = Array(ServiceTemplate::CATALOG_ITEM_TYPES.invert).sort_by { |a| a.first.downcase } = select_tag('st_prov_type', options_for_select(([["<#{_('Choose')}>",nil]]) + array, nil), "data-miq_sparkle_on" => true,