omf_web 1.2.6 → 1.2.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (93) hide show
  1. data/.travis.yml +13 -0
  2. data/README.md +6 -0
  3. data/example/bridge/README.md +1 -1
  4. data/example/bridge/bridge.yaml +10 -0
  5. data/example/bridge/bridge_viz_server +41 -0
  6. data/example/bridge/data_sources/sensor-sqlite.rb +3 -2
  7. data/example/bridge/htdocs/graph/js/event_table.js +2 -7
  8. data/example/bridge/tabs/overview.yaml +82 -0
  9. data/example/openflow-gec15/dashboard_tab.yaml +1 -0
  10. data/example/simple/simple.yaml +1 -1
  11. data/example/simple/simple_dynamic.yaml +5 -3
  12. data/example/topo_discovery/data_sources/links.csv +3 -0
  13. data/example/topo_discovery/data_sources/links2.csv +21 -0
  14. data/example/topo_discovery/data_sources/node_info.csv +10 -0
  15. data/example/topo_discovery/data_sources/nodes.csv +4 -0
  16. data/example/topo_discovery/data_sources/nodes2.csv +11 -0
  17. data/example/topo_discovery/introduction.md +17 -0
  18. data/example/topo_discovery/topo_discovery_simple.yaml +35 -0
  19. data/example/topo_discovery/topo_discovery_simple2.yaml +32 -0
  20. data/example/topo_discovery/widgets/network.yaml +52 -0
  21. data/example/topo_discovery/widgets/node_info.yaml +23 -0
  22. data/lib/omf-web/content/file_repository.rb +5 -1
  23. data/lib/omf-web/content/git_repository.rb +11 -0
  24. data/lib/omf-web/content/repository.rb +13 -2
  25. data/lib/omf-web/data_source_proxy.rb +22 -10
  26. data/lib/omf-web/theme.rb +11 -4
  27. data/lib/omf-web/theme/abstract_page.rb +5 -0
  28. data/lib/omf-web/thin/server.rb +62 -16
  29. data/lib/omf-web/version.rb +1 -1
  30. data/lib/omf-web/widget/code_widget.rb +24 -23
  31. data/lib/omf-web/widget/data_widget.rb +14 -5
  32. data/lib/omf-web/widget/text/maruku.rb +16 -1
  33. data/lib/omf-web/widget/text/text_widget.rb +1 -1
  34. data/share/htdocs/graph/js/abstract_chart.js +7 -1
  35. data/share/htdocs/graph/js/abstract_multiple_datasource_chart.js +21 -3
  36. data/share/htdocs/graph/js/abstract_nv_chart.js +17 -11
  37. data/share/htdocs/graph/js/abstract_widget.js +44 -14
  38. data/share/htdocs/graph/js/line_chart3.js +5 -9
  39. data/share/htdocs/graph/js/map2.js +122 -79
  40. data/share/htdocs/graph/js/network2.js +205 -36
  41. data/share/htdocs/graph/js/table2.js +7 -11
  42. data/share/htdocs/js/data_source3.js +24 -4
  43. data/share/htdocs/vendor/VERSION_MAP.yaml +1 -1
  44. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/css/font-awesome.css +251 -23
  45. data/share/htdocs/vendor/font-awesome-4.1.0/css/font-awesome.min.css +4 -0
  46. data/share/htdocs/vendor/font-awesome-4.1.0/fonts/FontAwesome.otf +0 -0
  47. data/share/htdocs/vendor/font-awesome-4.1.0/fonts/fontawesome-webfont.eot +0 -0
  48. data/share/htdocs/vendor/font-awesome-4.1.0/fonts/fontawesome-webfont.svg +504 -0
  49. data/share/htdocs/vendor/font-awesome-4.1.0/fonts/fontawesome-webfont.ttf +0 -0
  50. data/share/htdocs/vendor/font-awesome-4.1.0/fonts/fontawesome-webfont.woff +0 -0
  51. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/bordered-pulled.less +0 -0
  52. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/core.less +0 -0
  53. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/fixed-width.less +0 -0
  54. data/share/htdocs/vendor/font-awesome-4.1.0/less/font-awesome.less +17 -0
  55. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/icons.less +97 -3
  56. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/larger.less +0 -0
  57. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/list.less +0 -0
  58. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/mixins.less +0 -0
  59. data/share/htdocs/vendor/font-awesome-4.1.0/less/path.less +14 -0
  60. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/rotated-flipped.less +0 -0
  61. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/spinning.less +8 -6
  62. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/stacked.less +0 -0
  63. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/less/variables.less +463 -329
  64. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_bordered-pulled.scss +0 -0
  65. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_core.scss +0 -0
  66. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_fixed-width.scss +0 -0
  67. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_icons.scss +97 -3
  68. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_larger.scss +0 -0
  69. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_list.scss +0 -0
  70. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_mixins.scss +2 -2
  71. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_path.scss +0 -0
  72. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_rotated-flipped.scss +0 -0
  73. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_spinning.scss +8 -6
  74. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_stacked.scss +0 -0
  75. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/_variables.scss +464 -330
  76. data/share/htdocs/vendor/{font-awesome-4.0.3 → font-awesome-4.1.0}/scss/font-awesome.scss +1 -1
  77. data/share/htdocs/vendor/jquery-ui-1.8.23/js/jquery-ui.js +125 -0
  78. data/share/htdocs/vendor/spin/jquery.spin.js +46 -24
  79. data/share/htdocs/vendor/spin/spin.js +20 -17
  80. metadata +277 -237
  81. data/example/bridge/data_sources/test2.oml +0 -1808
  82. data/example/bridge/data_sources/test2.sq3 +0 -0
  83. data/example/bridge/data_sources/test31.sq3 +0 -0
  84. data/example/bridge/viz_server.rb +0 -59
  85. data/share/htdocs/vendor/font-awesome-4.0.3/css/font-awesome.min.css +0 -4
  86. data/share/htdocs/vendor/font-awesome-4.0.3/fonts/FontAwesome.otf +0 -0
  87. data/share/htdocs/vendor/font-awesome-4.0.3/fonts/fontawesome-webfont.eot +0 -0
  88. data/share/htdocs/vendor/font-awesome-4.0.3/fonts/fontawesome-webfont.svg +0 -414
  89. data/share/htdocs/vendor/font-awesome-4.0.3/fonts/fontawesome-webfont.ttf +0 -0
  90. data/share/htdocs/vendor/font-awesome-4.0.3/fonts/fontawesome-webfont.woff +0 -0
  91. data/share/htdocs/vendor/font-awesome-4.0.3/less/font-awesome.less +0 -17
  92. data/share/htdocs/vendor/font-awesome-4.0.3/less/path.less +0 -14
  93. data/share/htdocs/vendor/spin/spin.min.js +0 -1
data/.travis.yml ADDED
@@ -0,0 +1,13 @@
1
+ language: ruby
2
+
3
+ cache:
4
+ directories:
5
+ - vendor/bundle
6
+
7
+ rvm:
8
+ - 1.9.3
9
+ - 2.1.1
10
+
11
+ before_install:
12
+ - sudo apt-get update -qq
13
+ - sudo apt-get install -y libicu-dev
data/README.md CHANGED
@@ -13,7 +13,13 @@ At this stage the best course of action is to clone the repository
13
13
  % cd omf_web
14
14
  % export OMF_WEB=`pwd`
15
15
  % bundle install
16
+
17
+ On some systems you will need to install 'libicu'
18
+
19
+ On Mac with Ports
16
20
 
21
+ % sudo port install icu
22
+ % bundle config build.charlock_holmes --with-icu-dir=/opt/local
17
23
 
18
24
  Getting Started
19
25
  ---------------
@@ -4,4 +4,4 @@ This would deserve a long write up as it shows off many of the neat features of
4
4
  Running
5
5
  -------
6
6
 
7
- ruby -I example/bridge -I lib -e development --fake-events start
7
+ bundle exec ruby example/bridge/bridge_viz_server start
@@ -0,0 +1,10 @@
1
+
2
+ server:
3
+ page_title: Bridge Monitoring
4
+ port: 4020
5
+
6
+ include: tabs/*.yaml
7
+
8
+ load:
9
+ - data_sources/sensor-sqlite.rb
10
+
@@ -0,0 +1,41 @@
1
+ #!/usr/bin/env ruby
2
+ # encoding: utf-8
3
+ THIS_DIR = File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
4
+ TOP_DIR = File.join(THIS_DIR, '../..')
5
+ $: << File.join(TOP_DIR, 'lib')
6
+
7
+ require 'json'
8
+ require 'omf-web/thin/server'
9
+
10
+ DESCR = %{
11
+ Start the Bridge Viz Server
12
+ }
13
+
14
+ OMF::Base::Loggable.init_log 'bridge', searchPath: THIS_DIR
15
+
16
+ # If set, create fake sensor events
17
+ $fake_bridge_events = false
18
+ # Path to OML database
19
+ $oml_database = 'sqlite://example/bridge/data_sources/test3.sq3'
20
+
21
+
22
+ opts = {
23
+ port: 4050,
24
+ handlers: {
25
+ pre_parse: lambda do |p, runner|
26
+ runner.options[:omf_config_file] = File.join(THIS_DIR, 'bridge.yaml')
27
+
28
+ p.separator ""
29
+ p.separator "BRIDGE options:"
30
+ p.on("--fake-events", "If set, create fake sensor events") { $fake_bridge_events = true }
31
+ p.on("--oml-database DATABASE", "Database containing bridge data [#{$oml_database}]") do |f|
32
+ $oml_database = f
33
+ end
34
+ p.separator ""
35
+ end,
36
+ },
37
+ footer_left: "Imagined by NICTA",
38
+ footer_right: "git:omf_web/bridge",
39
+ }
40
+
41
+ OMF::Web::Server.start('omf_web_server', DESCR, TOP_DIR, opts)
@@ -25,8 +25,9 @@ end
25
25
  class BridgeSensor < OMF::Base::LObject
26
26
  attr_reader :table
27
27
 
28
- def initialize(db_name)
28
+ def initialize(db_name, fake_bridge_events)
29
29
  @db_name = db_name
30
+ @fake_bridge_events = fake_bridge_events
30
31
  end
31
32
 
32
33
  # oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "eventID" TEXT, "sensorID" TEXT, "time" REAL, "x" REAL, "y" REAL, "z" REAL, "v1" REAL, "v2" REAL
@@ -97,4 +98,4 @@ class BridgeSensor < OMF::Base::LObject
97
98
  end
98
99
  end
99
100
  end
100
- wv = BridgeSensor.new($oml_database).run()
101
+ wv = BridgeSensor.new($oml_database, $fake_bridge_events).run()
@@ -1,12 +1,7 @@
1
1
 
2
2
  define(["graph/table2",
3
- 'vendor/slickgrid/plugins/slick.checkboxselectcolumn',
4
- 'css!/resource/css/bridge.css'], function(table2) {
5
-
6
- // L.provide('OML.event_table', ["graph/js/table2", "#OML.table2",
7
- // 'vendor/slickgrid/plugins/slick.checkboxselectcolumn.js',
8
- // 'css/bridge.css'
9
- // ], function () {
3
+ 'vendor/slickgrid/plugins/slick.checkboxselectcolumn',
4
+ 'css!/resource/css/bridge.css'], function(table2) {
10
5
 
11
6
  var event_table = table2.extend({
12
7
  decl_properties: [
@@ -0,0 +1,82 @@
1
+ # Shows full width model of the bridge followed by two
2
+ # half-width widgets, one listing the last N events and
3
+ # the other one details of a single event (selected in the
4
+ # former widget)
5
+ #
6
+
7
+
8
+ tabs:
9
+ - id: overview
10
+ name: Overview
11
+ priority: 900
12
+ chrome: false # don't show title
13
+ widgets:
14
+ - type: data/bridge
15
+ title: Context
16
+ data_source:
17
+ name: health
18
+ mapping:
19
+ health: health
20
+ fill_color:
21
+ property: health
22
+ #scale: 0.04 # 1.0 / 25
23
+ color: red_green() # () indicates a color scale
24
+ margin:
25
+ left: 20
26
+ right: 20
27
+
28
+ - type: layout/two_columns/50_50
29
+ left:
30
+ - type: data/event_table
31
+ title: Events
32
+ data_source:
33
+ name: health
34
+ dynamic: 1 # check once a second
35
+ columns:
36
+ - field: eventID
37
+ name: Event ID
38
+ behavior: select
39
+ cssClass: cell-selection
40
+ selectable: true
41
+
42
+ - field: jointID
43
+ name: Joint ID
44
+
45
+ - field: health
46
+ topts:
47
+ enableCellNavigation: true
48
+ margin:
49
+ left: 5
50
+ right:
51
+ - type: data/event_line_chart
52
+ title: Sensor Reading
53
+ data_source:
54
+ name: sensors
55
+ # Only fetch a 'slice' of the underlying data source. A slice
56
+ # is defined by specific value in the 'slice_column' of all rows
57
+ slice:
58
+ slice_column: eventID
59
+ event:
60
+ name: bridge.event_selected
61
+ key: eventID
62
+ mapping:
63
+ x_axis: time
64
+ y_axis:
65
+ property: v1
66
+ group_by:
67
+ property: sensorID
68
+ axis:
69
+ x:
70
+ ticks:
71
+ type: date
72
+ #format: %I:%M
73
+ count: 5
74
+ legend: Time
75
+ y:
76
+ ticks:
77
+ format: s
78
+ legend: V1
79
+ margin:
80
+ top: 10
81
+ left: 60
82
+ right: 20
@@ -15,6 +15,7 @@ widget:
15
15
  height: 1.0
16
16
  data_source:
17
17
  name: network
18
+ sub_sources: [nodes, links]
18
19
  unique_column: id # only use the latest link and row descriptions
19
20
  dynamic: true
20
21
  mapping:
@@ -7,7 +7,7 @@
7
7
  server:
8
8
  name: 'Simple Demo'
9
9
  page_title: 'Simple Demo'
10
- port: 4050
10
+ port: 4010
11
11
 
12
12
  data_sources:
13
13
  - id: signal
@@ -5,13 +5,15 @@
5
5
  #
6
6
 
7
7
  server:
8
- name: 'Simple Demo'
9
- port: 4050
8
+ name: 'Simple Dynamic Demo'
9
+ page_title: 'Simple Dynamic Demo'
10
+ port: 4010
10
11
 
11
12
  data_sources:
12
13
  - id: signal
13
14
  table: wave
14
- dynamic: 2 # Check every 2 seconds
15
+ check_interval: 2 # Check every 2 seconds
16
+ query_interval: 1
15
17
  limit: 5 # Fetch 5 rows each time
16
18
  database:
17
19
  id: sample
@@ -0,0 +1,3 @@
1
+ id:int,from_id:int,to_id:int,zone:int
2
+ 0,0,1,0
3
+ 1,1,2,1
@@ -0,0 +1,21 @@
1
+ id:int,from_id:string,to_id:string,zone:int
2
+ 1,00:00:00:00:c1:00,rf1,0
3
+ 2,00:00:00:00:c2:00,rf1,0
4
+ 3,10:10:10:10:10:fe,rf2,0
5
+ 4,rf1,00:00:00:00:c1:00,0
6
+ 5,rf1,00:00:00:00:c2:00,0
7
+ 6,rf1,rf2,0
8
+ 7,rf1,ba:5e:ba:11:00:00,0
9
+ 8,rf2,rf1,0
10
+ 9,rf2,ba:5e:ba:11:00:00,0
11
+ 10,rf2,ba:5e:ba:11:ad:00,0
12
+ 11,rf2,10:10:10:10:10:fe,0
13
+ 12,rf3,ba:5e:ba:11:db:00,0
14
+ 13,rf3,ba:5e:ba:11:ad:00,0
15
+ 14,ba:5e:ba:11:00:00,rf1,0
16
+ 15,ba:5e:ba:11:00:00,rf2,0
17
+ 16,ba:5e:ba:11:00:01,ba:5e:ba:11:db:00,0
18
+ 17,ba:5e:ba:11:ad:00,rf2,0
19
+ 18,ba:5e:ba:11:ad:00,rf3,0
20
+ 19,ba:5e:ba:11:db:00,rf3,0
21
+ 20,ba:5e:ba:11:db:00,ba:5e:ba:11:00:01,0
@@ -0,0 +1,10 @@
1
+ nodeID, property, value
2
+ 00:0,name,Router 1
3
+ 00:0,mac,00:0
4
+ 00:0,type,router
5
+ 00:1,name,Host 1
6
+ 00:1,mac,00:1
7
+ 00:1,type,host
8
+ 00:2,name,Host 2
9
+ 00:2,mac,00:2
10
+ 00:2,type,host
@@ -0,0 +1,4 @@
1
+ id:int,name
2
+ 0,Node 0
3
+ 1,Node 1
4
+ 2,Node 2
@@ -0,0 +1,11 @@
1
+ id:string,name,type
2
+ 00:00:00:00:c1:00,x1,unknown
3
+ 00:00:00:00:c2:00,x2,unknown
4
+ 10:10:10:10:10:fe,x3,unknown
5
+ rf1,rf1,router
6
+ rf2,rf2,router
7
+ rf3,rf3,router
8
+ ba:5e:ba:11:00:00,x4,unknown
9
+ ba:5e:ba:11:00:01,x5,host
10
+ ba:5e:ba:11:ad:00,x6,unknown
11
+ ba:5e:ba:11:db:00,x7,unknown
@@ -0,0 +1,17 @@
1
+ title: Introduction
2
+
3
+
4
+ Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin
5
+ sollicitudin nibh eu ligula lobortis ornare. Sed nibh nibh,
6
+ ullamcorper at vehicula ac, molestie ac nunc. Duis sodales, nisi vel
7
+ pellentesque imperdiet, nisi massa accumsan lorem, gravida scelerisque
8
+ velit est vitae eros. Suspendisse eu lacinia elit.
9
+
10
+
11
+ Suspendisse laoreet, lacus quis dignissim volutpat, dolor augue convallis lectus,
12
+ ac consectetur yyyy sem iaculis diam. Donec iaculis mattis iaculis.
13
+ Curabitur ut nisl in sapien semper ullamcorper in id turpis. Vivamus
14
+ sed sapien justo, ac scelerisque nibh. Sed eget quam velit. Lorem
15
+ ipsum dolor sit amet, consectetur adipiscing elit.
16
+
17
+
@@ -0,0 +1,35 @@
1
+
2
+
3
+
4
+ # Simple tab showing a line chart with supporting table
5
+ #
6
+
7
+ server:
8
+ name: 'Topology Discovery'
9
+ page_title: 'Topology Discovery'
10
+ port: 4020
11
+
12
+
13
+
14
+ repositories:
15
+ - id: content
16
+ type: file
17
+ top_dir: .
18
+
19
+ include: widgets/network.yaml
20
+
21
+ widgets:
22
+ - id: main
23
+ name: Main
24
+ top_level: true
25
+ priority: 900
26
+ type: layout/two_columns/33_66
27
+ left:
28
+ - name: Introduction
29
+ type: text
30
+ content:
31
+ url: file:content:introduction.md
32
+ right:
33
+ - network
34
+
35
+
@@ -0,0 +1,32 @@
1
+
2
+
3
+
4
+ # Simple tab showing a line chart with supporting table
5
+ #
6
+
7
+ server:
8
+ name: 'Topology Discovery'
9
+ page_title: 'Topology Discovery'
10
+ port: 4020
11
+
12
+
13
+
14
+ repositories:
15
+ - id: content
16
+ type: file
17
+ top_dir: .
18
+
19
+ include: widgets/*.yaml
20
+
21
+ widgets:
22
+ - id: main
23
+ name: Main
24
+ top_level: true
25
+ priority: 900
26
+ type: layout/two_columns/66_33
27
+ left:
28
+ - network
29
+ right:
30
+ - node_info
31
+
32
+
@@ -0,0 +1,52 @@
1
+
2
+ data_sources:
3
+ - id: network/nodes
4
+ file: data_sources/nodes2.csv # checking that node ids can be anything
5
+ - id: network/links
6
+ file: data_sources/links2.csv
7
+
8
+ widgets:
9
+ - id: network
10
+ name: Network
11
+ type: data/network2
12
+ height: 1.0
13
+ #data_source: network
14
+ data_sources:
15
+ - name: nodes
16
+ stream: network/nodes
17
+ - name: links
18
+ stream: network/links
19
+
20
+ mapping:
21
+ nodes:
22
+ x: auto # force layout
23
+ y: auto
24
+ radius: 15
25
+ # property: capacity
26
+ # scale: 20
27
+ # min: 4
28
+ fill_color: #white
29
+ property: type
30
+ color:
31
+ router: orange
32
+ switch: green
33
+ host: lightblue
34
+ unknown: gray
35
+ # property: capacity
36
+ # color: red_yellow20_green()
37
+ stroke_width: 2
38
+ label_color: black
39
+ label_size: 14
40
+ links:
41
+ stroke_width: 8
42
+ stroke_color:
43
+ property: zone
44
+ color: category10()
45
+
46
+ force:
47
+ link_distance: 50
48
+ charge: -1000
49
+
50
+ line_mode: straight
51
+ interaction_mode: click
52
+