module Roma::CommandPlugin::PluginGui

Public Instance Methods

ev_gather_logs(s) click to toggle source

gather_logs [start_date(YYYY-MM-DDThh:mm:ss)] <end_date(YYYY-MM-DDThh:mm:ss)>

   # File lib/roma/plugin/plugin_gui.rb
24 def ev_gather_logs(s)
25   if s.length < 2 || s.length > 3
26     return send_data("CLIENT_ERROR number of arguments (#{s.length-1} for 2-3)\r\n")
27   end
28 
29   start_date = s[1]
30   end_date = s[2]
31   end_date ||= 'current'
32 
33   if @stats.gui_run_gather_logs
34     return send_data("CLIENT_ERROR gathering process is already going\r\n")
35   end
36 
37   begin
38     @stats.gui_run_gather_logs = true
39     Roma::AsyncProcess::queue.push(Roma::AsyncMessage.new('start_get_logs', [start_date, end_date]))
40 
41     send_data("STARTED\r\n")
42   rescue
43     @stats.gui_run_gather_logs = false
44     @rttable.logs = []
45     send_data("CLIENT_ERROR\r\n")
46   end
47 end
ev_get_routing_history(s) click to toggle source

get_routing_history

   # File lib/roma/plugin/plugin_gui.rb
10 def ev_get_routing_history(s)
11   routing_path  = get_config_stat["config.RTTABLE_PATH"]
12   contents = ""
13   Dir.glob("#{routing_path}/*").each{|fname|
14     contents << File.read(fname) if !FileTest::directory?(fname) && fname =~ /#{@stats.ap_str}\.route*/
15   }
16   routing_list = contents.scan(/[-\.a-zA-Z\d]+_[\d]+/).uniq.sort
17   routing_list.each{|routing|
18     send_data("#{routing}\r\n")
19   }
20   send_data("END\r\n")
21 end
ev_show_logs(s) click to toggle source

show_logs

   # File lib/roma/plugin/plugin_gui.rb
50 def ev_show_logs(s)
51   if @stats.gui_run_gather_logs
52     send_data("Not finished gathering\r\n")
53   else
54     @rttable.logs.each_with_index{|log, index|
55       send_data("#{log}\r\n")
56       sleep @stats.stream_show_wait_param if index % 10 == 0
57     }
58     send_data("END\r\n")
59     @rttable.logs.clear
60   end
61 end