Class: Karafka::Web::Pro::Ui::Controllers::RecurringTasksController

Inherits:
Ui::Controllers::ClusterController show all
Defined in:
lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb

Overview

Controller for viewing and managing recurring tasks

Constant Summary

Constants inherited from Ui::Controllers::BaseController

Ui::Controllers::BaseController::Models

Instance Attribute Summary

Attributes inherited from Ui::Controllers::BaseController

#params, #session

Instance Method Summary collapse

Methods inherited from Ui::Controllers::ClusterController

#brokers, #replication

Methods inherited from Ui::Controllers::BaseController

#cache, #initialize

Methods included from Ui::Controllers::Requests::Hookable

included, #run_after_hooks, #run_before_hooks

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController

Instance Method Details

#logsObject

Displays the execution logs



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb', line 31

def logs
  @watermark_offsets = Models::WatermarkOffsets.find(logs_topic, 0)
  previous_offset, @logs, next_offset, = current_page_data

  paginate(
    previous_offset,
    @params.current_offset,
    next_offset,
    @logs.map(&:offset)
  )

  # We remap this so we can represent the payloads as logs that we expect
  @logs.map! { |log| Models::RecurringTasks::Log.new(log.payload) }

  render
end

#scheduleObject

Displays the current schedule



22
23
24
25
26
27
28
# File 'lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb', line 22

def schedule
  @schedule = Models::RecurringTasks::Schedule.current

  @tasks = refine(@schedule.tasks) if @schedule

  render
end