Class: SagaForge::Dashboard::SagasController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/saga_forge/dashboard/sagas_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



4
5
6
7
8
9
10
11
12
13
# File 'app/controllers/saga_forge/dashboard/sagas_controller.rb', line 4

def index
  @saga_classes = SagaForge::Router.saga_classes.sort_by(&:name)
  @saga_class = (params[:class].presence && @saga_classes.find { |k| k.name == params[:class] }) || @saga_classes.first
  return render :empty unless @saga_class

  @stats = StatsQuery.new(saga_class: @saga_class)
  @query = SagasQuery.new(saga_class: @saga_class, filter: params[:filter],
    correlation: params[:q], before: params[:before], after: params[:after],
    per: SagaForge::Dashboard.config.page_size)
end

#showObject



15
16
17
18
19
20
21
22
# File 'app/controllers/saga_forge/dashboard/sagas_controller.rb', line 15

def show
  @state = SagaForge::State.find(params[:id])
  @timeline = TimelinePresenter.new(@state)
  @context = ContextPresenter.new(@state)
  @stalled = @state.events.stalled.exists?
  @suspended = @state.events.failed.exists?
  @comp_error = @state.context.dig("__saga_forge", "comp_error")
end