Class: ForemanDatacenter::ConsolePortsController
- Inherits:
-
ApplicationController
show all
- Includes:
- Foreman::Controller::AutoCompleteSearch, ForemanDatacenter::Controller::Parameters::ConsolePort
- Defined in:
- app/controllers/foreman_datacenter/console_ports_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
69
70
71
72
73
74
75
76
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 69
def connect
console_server_port = ConsoleServerPort.find(params[:console_server_port][:id])
@console_port.connect(
console_server_port,
params[:console_port][:connection_status]
)
process_success(success_msg: "Console port was successfully connected.", success_redirect: device_url(id: @console_port.device_id))
end
|
#connected ⇒ Object
56
57
58
59
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 56
def connected
@console_port.connected!
head :ok
end
|
#create ⇒ Object
25
26
27
28
29
30
31
32
33
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 25
def create
@console_port = ConsolePort.new(console_port_params.merge(device_id: params[:device_id]))
if @console_port.save
process_success success_redirect: device_path(@console_port.device_id)
else
process_error object: @console_port
end
end
|
#destroy ⇒ Object
43
44
45
46
47
48
49
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 43
def destroy
if @console_port.destroy
process_success success_redirect: device_path(@console_port.device_id)
else
process_error object: @console_port
end
end
|
#disconnect ⇒ Object
78
79
80
81
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 78
def disconnect
@console_port.disconnect
process_success(success_msg: "Console port was successfully disconnected.", success_redirect: device_url(id: @console_port.device_id))
end
|
#edit ⇒ Object
22
23
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 22
def edit
end
|
#for_device ⇒ Object
51
52
53
54
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 51
def for_device
@device = Device.find(params[:device_id])
render partial: 'for_device'
end
|
#index ⇒ Object
10
11
12
13
14
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 10
def index
@console_ports = resource_base_search_and_page.where.not(console_server_port_id: nil).includes(:device, console_server_port: [:device])
end
|
#new ⇒ Object
16
17
18
19
20
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 16
def new
@console_port = ConsolePort.new(
device: Device.find(params[:device_id])
)
end
|
#new_connection ⇒ Object
66
67
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 66
def new_connection
end
|
#planned ⇒ Object
61
62
63
64
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 61
def planned
@console_port.planned!
head :ok
end
|
#update ⇒ Object
35
36
37
38
39
40
41
|
# File 'app/controllers/foreman_datacenter/console_ports_controller.rb', line 35
def update
if @console_port.update(console_port_params)
process_success success_redirect: device_path(@console_port.device_id)
else
process_error object: @console_port
end
end
|