Class: Klastera::ClustersController

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

Instance Method Summary collapse

Methods inherited from ApplicationController

#check_access_to_cluster_admin

Instance Method Details

#createObject



20
21
22
23
24
25
26
# File 'app/controllers/klastera/clusters_controller.rb', line 20

def create
  @cluster = ::Cluster.new(cluster_params)
  if @cluster.save
    @cluster = ::Cluster.new
    set_clusters
  end
end

#destroyObject



34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/klastera/clusters_controller.rb', line 34

def destroy
  new_cluster_id = params.require(:transfer).permit(:new_cluster_id).values.first rescue nil
  @transfer = Transfer.new( current_cluster: @cluster, new_cluster_id: new_cluster_id )
  if @transfer.valid?
    if @transfer.apply!
      @cluster.destroy
    end
    set_clusters
  end
end

#editObject



14
# File 'app/controllers/klastera/clusters_controller.rb', line 14

def edit; end

#indexObject



8
# File 'app/controllers/klastera/clusters_controller.rb', line 8

def index; end

#newObject



10
11
12
# File 'app/controllers/klastera/clusters_controller.rb', line 10

def new
  @cluster = ::Cluster.new
end

#transferObject



16
17
18
# File 'app/controllers/klastera/clusters_controller.rb', line 16

def transfer
  @transfer = Transfer.new
end

#updateObject



28
29
30
31
32
# File 'app/controllers/klastera/clusters_controller.rb', line 28

def update
  if @cluster.update(cluster_params)
    set_clusters
  end
end