Class: ForemanDatacenter::DeviceInterfaceConnectionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ForemanDatacenter::DeviceInterfaceConnectionsController
- Defined in:
- app/controllers/foreman_datacenter/device_interface_connections_controller.rb
Instance Method Summary collapse
- #connected ⇒ Object
- #create ⇒ Object
- #destroy ⇒ Object
- #index ⇒ Object
- #interfaces ⇒ Object
- #new ⇒ Object
- #planned ⇒ Object
Instance Method Details
#connected ⇒ Object
40 41 42 43 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 40 def connected @device_interface_connection.connected! head :ok end |
#create ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 18 def create @device_interface_connection = DeviceInterfaceConnection.new(device_interface_connection_params) @device_interface_connection.first_interface = get_device_interface if @device_interface_connection.save redirect_to device_url(@device_interface_connection.first_interface.device), notice: 'Connection was successfully created.' else process_error object: @device_interface_connection end end |
#destroy ⇒ Object
30 31 32 33 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 30 def destroy @device_interface_connection.destroy head :ok end |
#index ⇒ Object
6 7 8 9 10 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 6 def index @device_interface_connections = DeviceInterfaceConnection.includes( :second_interface, first_interface: [:device] ) end |
#interfaces ⇒ Object
45 46 47 48 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 45 def interfaces @interfaces = Device.find(params[:device_id]).free_interfaces render partial: 'interfaces' end |
#new ⇒ Object
12 13 14 15 16 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 12 def new @device_interface_connection = DeviceInterfaceConnection.connected.new( first_interface: get_device_interface ) end |
#planned ⇒ Object
35 36 37 38 |
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 35 def planned @device_interface_connection.planned! head :ok end |