class AdminPower

Permits a reboot of both the Gestion and the Dreamplug itself

Public Instance Methods

layout() click to toggle source
# File Views/Admin/Power.rb, line 4
def layout
  @order = 400

  gui_vbox do
    gui_vbox do
      show_button :reboot_gestion
    end
    gui_vbox do
      show_button :reboot_dreamplug
    end
    gui_vbox do
      show_button :update_files
    end
    gui_window :reload do
      show_html :txt
      show_button :OK
    end
  end
end
rpc_button(session, name, data) click to toggle source
# File Views/Admin/Power.rb, line 24
def rpc_button(session, name, data)
  msg = ''
  case name
    when /reboot_gestion/ then
      Thread.new {
        Platform.restart('gestion')
      }
      msg = '<h1>Recharger le navigateur avec ctrl+r ou F5</h1>'
    when /reboot_dreamplug/ then
      Thread.new {
        System.run_bool "#{GESTION_DIR}/Binaries/reboot"
      }
      msg = '<h1>Recharger le navigateur avec ctrl+r ou F5</h1><br>' +
          '<h2>Attention: il faudra attendre au moins 2 minutes!</h2>'
    when /update_files/ then
      Thread.new {
        System.run_bool('nohup /home/ftp/Files/update_files')
      }
      msg = '<h1>Les fichiers vont être mises à jour - patience</h1>'
    when /OK/ then
      return reply(:window_hide)
  end
  reply(:window_show, :reload) +
      reply(:update, :txt => msg)
end