Class: KafkaCommand::ClustersController

Inherits:
ApplicationController show all
Defined in:
app/controllers/kafka_command/clusters_controller.rb

Instance Method Summary collapse

Instance Method Details

#indexObject

GET /clusters



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'app/controllers/kafka_command/clusters_controller.rb', line 8

def index
  @clusters = Cluster.all

  flash[:search] = params[:name]

  if params[:name].present?
    @clusters = @clusters.select do |c|
      regex = /#{params[:name]}/i
      c.name.match?(regex)
    end
  end

  render_success(@clusters, flash: flash.to_hash)
end

#showObject

GET /clusters/:id



24
25
26
27
28
29
30
31
32
# File 'app/controllers/kafka_command/clusters_controller.rb', line 24

def show
  @cluster = Cluster.find(params[:id])

  if @cluster
    render_success(@cluster)
  else
    record_not_found
  end
end