diff --git a/app/helpers/report_helper.rb b/app/helpers/report_helper.rb index 52ed82f8c411..754842fbf6a0 100644 --- a/app/helpers/report_helper.rb +++ b/app/helpers/report_helper.rb @@ -100,4 +100,16 @@ def filter_performance_end_options def chart_mode_values_allowed? @edit[:new][:group] != 'Counts' end + + # Get string with unavailable fields while adding/editing report + def unavailable_fields_for_model(model) + case model + when 'ChargebackVm' + _('Cpu Cores Allocated Metric, Cpu Cores Used Metric, Fixed Compute Metric, Fixed Storage Metric') + when 'ChargebackContainerImage' + _('CPU Allocated Metric, CPU Used Metric, Disk I/O Used Metric, Fixed Compute Metric, Fixed Storage Metric, Storage Allocated Metric, Storage Used Metric') + when 'ChargebackContainerProject' + _('CPU Allocated Metric, CPU Used Metric, CPU Cores Allocated Metric, Disk I/O Used Metric, Fixed Compute Metric, Memory Allocated Metric, Fixed Storage Metric, Storage Allocated Metric, Storage Used Metric') + end + end end diff --git a/app/views/report/_form_columns.html.haml b/app/views/report/_form_columns.html.haml index 0f6c82b0b826..f710fe17fcdb 100644 --- a/app/views/report/_form_columns.html.haml +++ b/app/views/report/_form_columns.html.haml @@ -26,6 +26,13 @@ = render :partial => "column_lists" %strong = _('* Caution: Changing these fields will clear all selected values below them!') + - unavailable_fields = unavailable_fields_for_model(@edit[:new][:model]) + - if unavailable_fields + %br + %p{:style => "max-width: 850px;"} + %strong + = _("* Caution: %{unav_fields} are not supported for %{rep_base}.") % {:unav_fields => unavailable_fields, :rep_base => Dictionary.gettext(@edit[:new][:model], :type => :model, :notfound => :titleize, :plural => true)} + %hr %h3 = _('Report Creation Timeout')