Class: ForemanDatacenter::PowerOutletsController
- Inherits:
-
ApplicationController
show all
- Includes:
- Controller::Parameters::PowerOutlet
- Defined in:
- app/controllers/foreman_datacenter/power_outlets_controller.rb
Instance Method Summary
collapse
#action_permission, #controller_permission, #find_resource, #not_found, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for
Instance Method Details
#connect ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 49
def connect
power_port = PowerPort.find(params[:power_port][:id])
power_port.connect(
@power_outlet,
params[:power_port][:connection_status]
)
redirect_to device_url(id: @power_outlet.device_id),
notice: 'Power outlet was successfully connected.'
end
|
#create ⇒ Object
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 17
def create
@power_outlet = PowerOutlet.new(power_outlet_params.merge(device_id: params[:device_id]))
if @power_outlet.save
redirect_to device_url(id: @power_outlet.device_id),
notice: 'Power outlet was successfully created.'
else
process_error object: @power_outlet
end
end
|
#destroy ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 37
def destroy
if @power_outlet.destroy
redirect_to device_url(id: @power_outlet.device_id),
notice: 'Power outlet was successfully destroyed.'
else
process_error object: @power_outlet
end
end
|
#disconnect ⇒ Object
59
60
61
62
63
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 59
def disconnect
@power_outlet.power_port.disconnect
redirect_to device_url(id: @power_outlet.device_id),
notice: 'Power outlet was successfully disconnected.'
end
|
#edit ⇒ Object
14
15
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 14
def edit
end
|
#for_device ⇒ Object
65
66
67
68
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 65
def for_device
@device = Device.find(params[:device_id])
render partial: 'for_device'
end
|
#new ⇒ Object
9
10
11
12
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 9
def new
device = Device.find(params[:device_id])
@power_outlet = PowerOutlet.new(device: device)
end
|
#new_connection ⇒ Object
46
47
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 46
def new_connection
end
|
#update ⇒ Object
28
29
30
31
32
33
34
35
|
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 28
def update
if @power_outlet.update(power_outlet_params)
redirect_to device_url(id: @power_outlet.device_id),
notice: 'Power outlet was successfully updated.'
else
process_error object: @power_outlet
end
end
|