Class: WebhookInbox::DashboardController

Inherits:
ApplicationController show all
Defined in:
app/controllers/webhook_inbox/dashboard_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/webhook_inbox/dashboard_controller.rb', line 5

def index
  @events = WebhookInbox::Event.order(created_at: :desc)
  @events = @events.where(status: params[:status]) if params[:status].present?
  @events = @events.where(provider: params[:provider]) if params[:provider].present?
  @events = @events.page(params[:page]).per(50) if @events.respond_to?(:page)
  @events = @events.limit(200) unless @events.respond_to?(:page)

  @status_counts = WebhookInbox::Event.group(:status).count
  @providers     = WebhookInbox::Event.distinct.pluck(:provider).sort
end

#replayObject



20
21
22
23
24
# File 'app/controllers/webhook_inbox/dashboard_controller.rb', line 20

def replay
  @event = WebhookInbox::Event.find(params[:id])
  @event.retry!
  redirect_to webhook_inbox.dashboard_path, notice: "Event #{@event.event_id} queued for reprocessing."
end

#showObject



16
17
18
# File 'app/controllers/webhook_inbox/dashboard_controller.rb', line 16

def show
  @event = WebhookInbox::Event.find(params[:id])
end