Class: Dontbugme::TracesController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/dontbugme/traces_controller.rb

Instance Method Summary collapse

Instance Method Details

#diffObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/dontbugme/traces_controller.rb', line 23

def diff
  @trace_a = params[:a].present? ? store.find_trace(params[:a]) : nil
  @trace_b = params[:b].present? ? store.find_trace(params[:b]) : nil
  @diff_output = if @trace_a && @trace_b
    Dontbugme::Formatters::Diff.format(@trace_a, @trace_b)
  else
    nil
  end
end

#indexObject



9
10
11
12
13
14
15
16
# File 'app/controllers/dontbugme/traces_controller.rb', line 9

def index
  filters = { limit: 50 }
  filters[:status] = params[:status] if params[:status].present?
  filters[:kind] = params[:kind] if params[:kind].present?
  filters[:identifier] = params[:q] if params[:q].present?
  filters[:correlation_id] = params[:correlation_id] if params[:correlation_id].present?
  @traces = store.search(filters)
end

#showObject



18
19
20
21
# File 'app/controllers/dontbugme/traces_controller.rb', line 18

def show
  @trace = store.find_trace(params[:id])
  return render plain: 'Trace not found', status: :not_found unless @trace
end