Class: ForemanDatacenter::PowerOutletsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanDatacenter::PowerOutletsController
- Defined in:
- app/controllers/foreman_datacenter/power_outlets_controller.rb
Instance Method Summary collapse
- #connect ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #disconnect ⇒ Object
- #edit ⇒ Object
- #for_device ⇒ Object
- #new ⇒ Object
- #new_connection ⇒ Object
- #update ⇒ Object
Instance Method Details
#connect ⇒ Object
46 47 48 49 50 51 52 53 54 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 46 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
14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 14 def create @power_outlet = PowerOutlet.new(power_outlet_params) 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
34 35 36 37 38 39 40 41 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 34 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
56 57 58 59 60 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 56 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
11 12 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 11 def edit end |
#for_device ⇒ Object
62 63 64 65 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 62 def for_device @device = Device.find(params[:device_id]) render partial: 'for_device' end |
#new ⇒ Object
6 7 8 9 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 6 def new device = Device.find(params[:device_id]) @power_outlet = PowerOutlet.new(device: device) end |
#new_connection ⇒ Object
43 44 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 43 def new_connection end |
#update ⇒ Object
25 26 27 28 29 30 31 32 |
# File 'app/controllers/foreman_datacenter/power_outlets_controller.rb', line 25 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 |