Class: ForemanDatacenter::InterfaceTemplatesController

Inherits:
ApplicationController show all
Includes:
Controller::Parameters::InterfaceTemplate
Defined in:
app/controllers/foreman_datacenter/interface_templates_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#action_permission, #controller_permission, #find_resource, #not_found, #resource_class, #resource_class_for, #resource_finder, #resource_name, #resource_scope, #scope_for

Instance Method Details

#createObject



23
24
25
26
27
28
29
30
31
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 23

def create
  @interface_template = InterfaceTemplate.new(interface_template_params.merge(device_type_id: params[:device_type_id]))

  if @interface_template.save
    process_success success_redirect: device_type_url(@interface_template.device_type_id)
  else
    process_error object: @interface_template
  end
end

#destroyObject



33
34
35
36
37
38
39
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 33

def destroy
  if @interface_template.destroy
    process_success success_redirect: device_type_url(params[:device_type_id])
  else
    process_error object: @interface_template
  end
end

#newObject



7
8
9
10
11
12
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 7

def new
  @interface_template = InterfaceTemplate.new(
    device_type: DeviceType.find(params[:device_type_id]),
    form_factor: '10GE (SFP+)'
  )
end

#new_managementObject



14
15
16
17
18
19
20
21
# File 'app/controllers/foreman_datacenter/interface_templates_controller.rb', line 14

def new_management
  @interface_template = InterfaceTemplate.new(
    device_type: DeviceType.find(params[:device_type_id]),
    form_factor: '10GE (SFP+)',
    mgmt_only: true
  )
  render :new
end