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
43
44
45
46
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 43
def connected
@device_interface_connection.connected!
head :ok
end
|
#create ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 22
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
process_success(success_msg: "Connection was successfully created.", success_redirect: device_url(id: @device_interface_connection.first_interface.device))
else
process_error object: @device_interface_connection
end
end
|
#destroy ⇒ Object
33
34
35
36
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 33
def destroy
@device_interface_connection.destroy
head :ok
end
|
#edit ⇒ Object
18
19
20
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 18
def edit
@device = @device_interface_connection.first_device
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: [:device], first_interface: [:device])
end
|
#interfaces ⇒ Object
48
49
50
51
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 48
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
38
39
40
41
|
# File 'app/controllers/foreman_datacenter/device_interface_connections_controller.rb', line 38
def planned
@device_interface_connection.planned!
head :ok
end
|