Class: Karafka::Web::Ui::Pro::Controllers::Consumers
- Inherits:
-
Controllers::Base
- Object
- Controllers::Base
- Karafka::Web::Ui::Pro::Controllers::Consumers
- Defined in:
- lib/karafka/web/ui/pro/controllers/consumers.rb
Overview
Controller for displaying consumers states and details about them
Instance Method Summary collapse
- #details(process_id) ⇒ Object
-
#index ⇒ Object
Consumers list.
-
#pending_jobs(process_id) ⇒ Object
Renders details about pending jobs.
-
#running_jobs(process_id) ⇒ Object
Renders details about running jobs.
- #subscriptions(process_id) ⇒ Object
Methods inherited from Controllers::Base
Constructor Details
This class inherits a constructor from Karafka::Web::Ui::Controllers::Base
Instance Method Details
#details(process_id) ⇒ Object
57 58 59 60 61 62 |
# File 'lib/karafka/web/ui/pro/controllers/consumers.rb', line 57 def details(process_id) current_state = Models::ConsumersState.current! @process = Models::Process.find(current_state, process_id) render end |
#index ⇒ Object
Consumers list
42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/karafka/web/ui/pro/controllers/consumers.rb', line 42 def index @current_state = Models::ConsumersState.current! @counters = Models::Counters.new(@current_state) @processes, last_page = Lib::Paginations::Paginators::Arrays.call( refine(Models::Processes.active(@current_state)), @params.current_page ) paginate(@params.current_page, !last_page) render end |
#pending_jobs(process_id) ⇒ Object
Renders details about pending jobs
80 81 82 83 84 85 86 87 88 |
# File 'lib/karafka/web/ui/pro/controllers/consumers.rb', line 80 def pending_jobs(process_id) details(process_id) @pending_jobs = @process.jobs.pending refine(@pending_jobs) render end |
#running_jobs(process_id) ⇒ Object
Renders details about running jobs
67 68 69 70 71 72 73 74 75 |
# File 'lib/karafka/web/ui/pro/controllers/consumers.rb', line 67 def running_jobs(process_id) details(process_id) @running_jobs = @process.jobs.running refine(@running_jobs) render end |
#subscriptions(process_id) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/karafka/web/ui/pro/controllers/consumers.rb', line 91 def subscriptions(process_id) details(process_id) # We want to have sorting but on a per subscription group basis and not to sort # everything @process.consumer_groups.each do |consumer_group| # We need to initialize the whole structure so dynamic fields are also built into # the underlying hashes for sorting consumer_group.subscription_groups.flat_map(&:topics).flat_map(&:partitions) refine(consumer_group) end render end |