Skip to content

Commit

Permalink
Make Metering reports like a Chargeback reports in views
Browse files Browse the repository at this point in the history
  • Loading branch information
lpichler committed Oct 30, 2017
1 parent c8411c3 commit edd7a30
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
4 changes: 2 additions & 2 deletions app/controllers/report_controller/reports/editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ def build_edit_screen
build_tabs

get_time_profiles # Get time profiles list (global and user specific)
cb_entities_by_provider if Chargeback.db_is_chargeback?(@edit[:new][:model]) && [ChargebackContainerImage, ChargebackContainerProject].include?(@edit[:new][:model].safe_constantize)
cb_entities_by_provider if Chargeback.db_is_chargeback?(@edit[:new][:model]) && [ChargebackContainerImage, ChargebackContainerProject, MeteringContainerImage, MeteringContainerProject].include?(@edit[:new][:model].safe_constantize)
case @sb[:miq_tab].split("_")[1]
when "1" # Select columns
@edit[:models] ||= reportable_models
Expand Down Expand Up @@ -1328,7 +1328,7 @@ def set_form_vars
@edit[:new][:cb_interval_size] = options[:interval_size]
@edit[:new][:cb_end_interval_offset] = options[:end_interval_offset]
@edit[:new][:cb_groupby] = options[:groupby]
cb_entities_by_provider if [ChargebackContainerImage, ChargebackContainerProject].include?(@rpt.db.safe_constantize)
cb_entities_by_provider if [ChargebackContainerImage, ChargebackContainerProject, MeteringContainerImage, MeteringContainerProject].include?(@rpt.db.safe_constantize)
end

# Only show chargeback users choice if an admin
Expand Down
12 changes: 6 additions & 6 deletions app/views/report/_form_filter_chargeback.html.haml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
- url = url_for_only_path(:action => 'form_field_changed', :id => (@edit[:rpt_id] || 'new'))
- if @edit[:new][:model] == "ChargebackVm"
- if @edit[:new][:model] == "ChargebackVm" || @edit[:new][:model] == "MeteringVm"
%h3
= _('Chargeback Resources')
.form-horizontal
Expand Down Expand Up @@ -32,11 +32,11 @@
= _('Show Costs by')
.col-md-8
- opts = [["<#{_('Choose')}>", nil]]
- if @edit[:new][:model] == "ChargebackContainerProject"
- if @edit[:new][:model] == "ChargebackContainerProject" || @edit[:new][:model] == "MeteringContainerProject"
- opts += [[ui_lookup(:model => @edit[:new][:cb_model]), "entity"], ["%s Tag" % current_tenant.name, "tag"]]
- elsif @edit[:new][:model] == "ChargebackVm"
- elsif @edit[:new][:model] == "ChargebackVm" || @edit[:new][:model] == "MeteringVm"
- opts += [[_('Owner'), "owner"], ["%{tenant_name} Tag" % {:tenant_name => current_tenant.name}, "tag"], [_('Tenant'), "tenant"]]
- elsif @edit[:new][:model] == "ChargebackContainerImage"
- elsif @edit[:new][:model] == "ChargebackContainerImage" || @edit[:new][:model] == "MeteringContainerImage"
- opts += [[ui_lookup(:model => @edit[:new][:cb_model]), "entity"]]
- else
- opts += [[_('Owner'), "owner"], ["%{tenant_name} Tag" % {:tenant_name => current_tenant.name}, "tag"], [_(@edit[:new][:cb_model].to_s), "entity"]]
Expand Down Expand Up @@ -134,8 +134,8 @@
= _('Group by')
.col-md-8
- opts = [["#{_('Date')}", "date"], ["#{_(@edit[:new][:cb_model])}", "vm"]]
- opts += [["#{_('Tag')}", "tag"]] unless @edit[:new][:model] == "ChargebackContainerImage"
- opts += [["#{_('Project')}", "project"], [_('Label'), 'label']] if @edit[:new][:model] == "ChargebackContainerImage"
- opts += [["#{_('Tag')}", "tag"]] unless @edit[:new][:model] == "ChargebackContainerImage" || @edit[:new][:model] == "MeteringContainerImage"
- opts += [["#{_('Project')}", "project"], [_('Label'), 'label']] if @edit[:new][:model] == "ChargebackContainerImage" || @edit[:new][:model] == "MeteringContainerImage"
= select_tag("cb_groupby",
options_for_select(opts, @edit[:new][:cb_groupby]),
:class => "selectpicker")
Expand Down

0 comments on commit edd7a30

Please sign in to comment.