Class: ScalingController
Instance Method Summary
collapse
#active_tab
#sshkey_uploaded?
#domain_is_missing, #user_default_domain
#user_capabilities
Instance Method Details
#delete ⇒ Object
18
19
20
21
22
|
# File 'app/controllers/scaling_controller.rb', line 18
def delete
user_default_domain
@application = @domain.find_application params[:application_id]
redirect_to new_application_scaling_path(@application) unless @application.scales?
end
|
#new ⇒ Object
11
12
13
14
15
16
|
# File 'app/controllers/scaling_controller.rb', line 11
def new
user_default_domain
@application = @domain.find_application params[:application_id]
@cartridge_type = CartridgeType.cached.find 'haproxy-1.4'
@cartridge = Cartridge.new :name => @cartridge_type.name
end
|
#show ⇒ Object
3
4
5
6
7
8
9
|
# File 'app/controllers/scaling_controller.rb', line 3
def show
user_default_domain
@application = @domain.find_application params[:application_id]
@cartridges = @application.cartridges
@user = User.find :one, :as => current_user
redirect_to new_application_scaling_path(@application) unless @application.scales?
end
|
#update ⇒ Object
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
# File 'app/controllers/scaling_controller.rb', line 24
def update
user_default_domain
@user = User.find :one, :as => current_user
@application = @domain.find_application params[:application_id]
@cartridges = @application.cartridges
@cartridge = @cartridges.find{ |c| c.name == params[:id] } or raise RestApi::ResourceNotFound.new(Cartridge.model_name, params[:id])
range = [params[:cartridge][:scales_from].to_i, params[:cartridge][:scales_to].to_i]
range.reverse! if range.first > range.last && range.last != -1
@cartridge.scales_from, @cartridge.scales_to = range
if @cartridge.save
redirect_to application_scaling_path, :flash => {:success => "Updated scale settings for cartridge '#{@cartridge.display_name}'"}
else
render :show
end
end
|