Class: ForemanDatacenter::DeviceInterfaceConnectionsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- ApplicationController
- ForemanDatacenter::DeviceInterfaceConnectionsController
show all
- Includes:
- Foreman::Controller::AutoCompleteSearch, Controller::Parameters::DeviceInterfaceConnection
- Defined in:
- app/controllers/foreman_datacenter/device_interface_connections_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
#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 = ForemanDatacenter::DeviceInterfaceConnection.new(device_interface_connection_params.merge(interface_a: params[:device_interface_id]))
@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
8
9
10
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 8
def index
@device_interface_connections = resource_base_search_and_page.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 = ForemanDatacenter::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 = ForemanDatacenter::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
|