Class: KafkaCommand::ConsumerGroupsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- KafkaCommand::ConsumerGroupsController
- Defined in:
- app/controllers/kafka_command/consumer_groups_controller.rb
Instance Method Summary collapse
-
#index ⇒ Object
GET /clusters/:cluster_id/consumer_groups.
-
#show ⇒ Object
GET /alusters/:cluster_id/consumer_groups/:id.
Instance Method Details
#index ⇒ Object
GET /clusters/:cluster_id/consumer_groups
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'app/controllers/kafka_command/consumer_groups_controller.rb', line 8 def index @cluster = Cluster.find(params[:cluster_id]) @groups = @cluster.groups flash[:search] = params[:group_id] if params[:group_id].present? @groups = @groups.select do |g| regex = /#{params[:group_id]}/i g.group_id.match?(regex) end end render_success(@groups) end |
#show ⇒ Object
GET /alusters/:cluster_id/consumer_groups/:id
25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'app/controllers/kafka_command/consumer_groups_controller.rb', line 25 def show @cluster = Cluster.find(params[:cluster_id]) @group = @cluster.groups.find { |g| g.group_id == params[:id] } if @group.nil? render_error('Consumer group not found', status: 404) return end @current_topic = if params[:topic] @group.consumed_topics.find { |t| t.name == params[:topic] } else @group.consumed_topics.first end render_success(@group) end |