Module: BmcHelper

Included in:
HostsHelper
Defined in:
app/helpers/bmc_helper.rb

Instance Method Summary collapse

Instance Method Details

#boot_actionsObject


20
21
22
23
24
25
26
27
28
29
30
# File 'app/helpers/bmc_helper.rb', line 20

def boot_actions
  controller_options = { :action => "ipmi_boot", :id => @host }

  confirm = _('Are you sure?')

  links = HostsController::BOOT_DEVICES.map do |device,label|
     display_link_if_authorized(_(label), controller_options.merge(:ipmi_device => device),
                                :confirm => confirm, :method => :put)
  end
  action_buttons("Select device", links)
end

#power_actionsObject


11
12
13
14
15
16
17
18
# File 'app/helpers/bmc_helper.rb', line 11

def power_actions
  action_buttons(
    (PowerManager::SUPPORTED_ACTIONS - ['state']).map do |action|
      display_link_if_authorized(_(action.to_s.capitalize), { :action => "power", :id => @host, :power_action => action},
                                 :confirm => _('Are you sure?'), :method => :put)
    end
  )
end

#power_status(s) ⇒ Object


3
4
5
6
7
8
9
# File 'app/helpers/bmc_helper.rb', line 3

def power_status s
  if s.downcase == 'on'
    "<span class='label label-success'>#{_('On')}</span>".html_safe
  else
    "<span class='label'>#{_('Off')}</span>".html_safe
  end
end