Skip to content

Commit

Permalink
Display info about unavailable fields while editing report
Browse files Browse the repository at this point in the history
  • Loading branch information
Hilda Stastna committed Apr 2, 2019
1 parent aff6aaa commit 91d3037
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/helpers/report_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
7 changes: 7 additions & 0 deletions app/views/report/_form_columns.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down

0 comments on commit 91d3037

Please sign in to comment.