Method: Blazer::DashboardsController#show

Defined in:
app/controllers/blazer/dashboards_controller.rb

#showObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'app/controllers/blazer/dashboards_controller.rb', line 22

def show
  @queries = @dashboard.dashboard_queries.order(:position).preload(:query).map(&:query)
  @queries.each do |query|
    process_vars(query.statement, query.data_source)
  end
  @bind_vars ||= []

  @smart_vars = {}
  @sql_errors = []
  @data_sources = @queries.map { |q| Blazer.data_sources[q.data_source] }.uniq
  @bind_vars.each do |var|
    @data_sources.each do |data_source|
      smart_var, error = parse_smart_variables(var, data_source)
      ((@smart_vars[var] ||= []).concat(smart_var)).uniq! if smart_var
      @sql_errors << error if error
    end
  end
end