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 Method Summary collapse

Methods inherited from Ui::Controllers::ClusterController

#brokers, #replication

Methods inherited from Ui::Controllers::BaseController

#initialize

Constructor Details

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

Instance Method Details

#logsObject

Displays the execution logs



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb', line 39

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



30
31
32
33
34
35
36
# File 'lib/karafka/web/pro/ui/controllers/recurring_tasks_controller.rb', line 30

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

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

  render
end