Class: ForemanDlm::DlmlocksController

Inherits:
ApplicationController show all
Includes:
Foreman::Controller::AutoCompleteSearch
Defined in:
app/controllers/foreman_dlm/dlmlocks_controller.rb

Instance Method Summary collapse

Methods inherited from ApplicationController

#controller_name, #controller_permission, #resource_class, #resource_name

Instance Method Details

#destroyObject



17
18
19
20
21
22
23
24
25
26
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 17

def destroy
  if @dlmlock.destroy
    process_success(
      :success_msg => _('Successfully deleted lock.'),
      :success_redirect => foreman_dlm_dlmlocks_path
    )
  else
    process_error
  end
end

#disableObject



39
40
41
42
43
44
45
46
47
48
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 39

def disable
  if @dlmlock.disable!
    process_success(
      :success_msg => _('Successfully disabled lock.'),
      :success_redirect => foreman_dlm_dlmlocks_path
    )
  else
    process_error
  end
end

#enableObject



50
51
52
53
54
55
56
57
58
59
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 50

def enable
  if @dlmlock.enable!
    process_success(
      :success_msg => _('Successfully enabled lock.'),
      :success_redirect => foreman_dlm_dlmlocks_path
    )
  else
    process_error
  end
end

#indexObject



10
11
12
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 10

def index
  @dlmlocks = resource_base_search_and_page(:host)
end

#model_of_controllerObject



61
62
63
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 61

def model_of_controller
  ForemanDlm::Dlmlock
end

#releaseObject



28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 28

def release
  if @dlmlock.update(host: nil)
    process_success(
      :success_msg => _('Successfully released lock.'),
      :success_redirect => foreman_dlm_dlmlocks_path
    )
  else
    process_error
  end
end

#showObject



14
15
# File 'app/controllers/foreman_dlm/dlmlocks_controller.rb', line 14

def show
end