Sha256: 4a93935cd0276d4c933d8931c2cd0cbb3c90726d1b7fe20c92dc30ab7ad09380

Contents?: true

Size: 1.77 KB

Versions: 14

Compression:

Stored size: 1.77 KB

Contents

require 'omf-common/mobject2'
OMF::Common::Loggable.init_log 'demo'

require 'omf_oml/table'
require 'omf_oml/sql_source'


#require 'omf-web/tab/graph/init'
require 'omf-web/widget/code/code'
require 'omf-web/widget/graph/graph'


include OMF::OML
#
# Configure graph displays
#
def init_graph(name, table, viz_type = 'table', viz_opts = {})
  #  i = 0
  def_viz_opts = {
    :schema => table.schema    
  }
  
  gopts = {
    :data_sources => table,
    :viz_type => viz_type,
    # :viz_type => 'map',    
    :wopts => def_viz_opts.merge(viz_opts)
  }
  OMF::Web::Widget::Graph.addGraph(name, gopts) 
end

Tables = {}

ep = OmlSqlSource.new("#{File.dirname(__FILE__)}/brooklynDemo.sq3")
ep.on_new_stream() do |stream|
  case stream.stream_name
  when 'wimaxmonitor_wimaxstatus'
    t = stream.capture_in_table(:oml_ts_server, :sender_hostname, :frequency, :rssi, :cinr)
    name = 'Wimax Status'
    init_graph(name, t, 'line_chart', 
      :mapping => {
        :x_axis => {:property => :oml_ts_server},
        :y_axis => {:property => :rssi},        
        :group_by => {:property => :sender_hostname}
      },
      :schema => t.schema,
      :ymax => -50
    )
  when 'GPSlogger_gps_data'
    t = stream.capture_in_table(:oml_ts_server, :oml_sender_id, :lat, :lon)
    name = 'Location'
    init_graph(name, t, 'map')
  end
  init_graph(name + ' (T)', t, 'table', :schema => t.schema.describe)
  #create_table(select, stream, 'table')
end
ep.run()

files = ['brooklyn_server.rb']

files.each do |fn|
  fp = "#{File.dirname(__FILE__)}/#{fn}"
  OMF::Web::Widget::Code.addCode(fn, :file => fp)
end


# Configure the web server
#
opts = {
  :page_title => 'Brooklyn Demo',  
#  :use_tabs => [:graph, :code, :log],
  :use_tabs => [:graph, :code],
  :theme => :bright
}
require 'omf_web'
OMF::Web.start(opts)

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
omf_web-1.2.9 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.8 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.7 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.6 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.5 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.4 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.3 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.2 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.1 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.2.0 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-1.0.0 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-0.9.9 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-0.9.8 example/NOT_WORKING/brooklyn/brooklyn_server.rb
omf_web-0.9.7 example/NOT_WORKING/brooklyn/brooklyn_server.rb