Skip to content

Commit

Permalink
Merge pull request #2005 from europ/remove-ui-constants-34
Browse files Browse the repository at this point in the history
Remove TREND_MODEL from UiConstants
  • Loading branch information
mzazrivec committed Aug 28, 2017
2 parents d5839e9 + 2fa744f commit 4c4fa19
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ def pp_choices

PERPAGE_TYPES = %w(grid tile list reports).each_with_object({}) { |value, acc| acc[value] = value.to_sym }.freeze

TREND_MODEL = "VimPerformanceTrend".freeze # Performance trend model name requiring special processing

# Default UI settings
DEFAULT_SETTINGS = {
:quadicons => { # Show quad icons, by resource type
Expand Down
12 changes: 6 additions & 6 deletions app/controllers/report_controller/reports/editor.rb
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ def reset_report_col_fields

def build_tabs
req = "edit"
if @edit[:new][:model] == TREND_MODEL
if @edit[:new][:model] == ApplicationController::TREND_MODEL
@tabs = [
["#{req}_1", _("Columns")],
["#{req}_3", _("Filter")],
Expand Down Expand Up @@ -1081,7 +1081,7 @@ def set_record_vars(rpt)
end

# Remove when we support user sorting of trend reports
if rpt.db == TREND_MODEL
if rpt.db == ApplicationController::TREND_MODEL
rpt.sortby = ["resource_name"]
rpt.order = "Ascending"
end
Expand Down Expand Up @@ -1428,7 +1428,7 @@ def set_form_vars
@edit[:new][:name] = "Copy of #{@rpt.name}" if params[:pressed] == "miq_report_copy"

# For trend reports, check for percent field chosen
if @rpt.db && @rpt.db == TREND_MODEL &&
if @rpt.db && @rpt.db == ApplicationController::TREND_MODEL &&
MiqExpression.reporting_available_fields(@edit[:new][:model], @edit[:new][:perf_interval]).find do|af|
af.last ==
@edit[:new][:perf_trend_db] + "-" + @edit[:new][:perf_trend_col]
Expand Down Expand Up @@ -1623,7 +1623,7 @@ def setnode_for_customreport

def valid_report?(rpt)
active_tab = 'edit_1'
if @edit[:new][:model] == TREND_MODEL
if @edit[:new][:model] == ApplicationController::TREND_MODEL
unless @edit[:new][:perf_trend_col]
add_flash(_('Trending for is required'), :error)
end
Expand Down Expand Up @@ -1746,7 +1746,7 @@ def check_tabs
add_flash(_('Formatting tab is not available until at least 1 field has been selected'), :error)
end
when '3'
if @edit[:new][:model] == TREND_MODEL
if @edit[:new][:model] == ApplicationController::TREND_MODEL
unless @edit[:new][:perf_trend_col]
add_flash(_('Filter tab is not available until Trending for field has been selected'), :error)
end
Expand Down Expand Up @@ -1786,7 +1786,7 @@ def check_tabs
end
end
when '7'
if @edit[:new][:model] == TREND_MODEL
if @edit[:new][:model] == ApplicationController::TREND_MODEL
unless @edit[:new][:perf_trend_col]
add_flash(_('Preview tab is not available until Trending for field has been selected'), :error)
end
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,7 @@ def model_report_type(model)
if model
if model.ends_with?("Performance", "MetricsRollup")
return :performance
elsif model == UiConstants::TREND_MODEL
elsif model == ApplicationController::TREND_MODEL
return :trend
elsif model.starts_with?("Chargeback")
return model.downcase.to_sym
Expand Down
2 changes: 0 additions & 2 deletions app/helpers/ui_constants.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ module UiConstants
NOTHING_STRING = "<<< Nothing >>>"
GRAPH_MAX_COUNT = 10

TREND_MODEL = "VimPerformanceTrend" # Performance trend model name requiring special processing

VALID_PLANNING_VM_MODES = PlanningHelper::PLANNING_VM_MODES.keys.index_by(&:to_s)

TASK_TIME_PERIODS = {
Expand Down
2 changes: 1 addition & 1 deletion app/views/report/_form_filter.html.haml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#filter_div
- if @edit[:new][:perf_interval]
= render :partial => "form_filter_performance"
- if @edit[:new][:model] == TREND_MODEL
- if @edit[:new][:model] == ApplicationController::TREND_MODEL
-# No additional filters for trend reports
- elsif Chargeback.db_is_chargeback?(@edit[:new][:model])
= render :partial => "form_filter_chargeback"
Expand Down

0 comments on commit 4c4fa19

Please sign in to comment.