omf_web 1.0.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/omf_web_server +18 -0
- data/example/bridge/README.md +7 -0
- data/example/bridge/data_sources/sensor-sqlite.rb +15 -15
- data/example/bridge/htdocs/graph/js/bridge.js +35 -45
- data/example/bridge/htdocs/graph/js/event_line_chart.js +20 -18
- data/example/bridge/htdocs/graph/js/event_table.js +26 -28
- data/example/bridge/viz_server.rb +5 -9
- data/example/demo/demo_viz_server.rb +2 -2
- data/example/demo/widgets/linked_graphs_tab.yaml +9 -32
- data/example/openflow-gec15/code_tab.yaml +7 -12
- data/example/openflow-gec15/dashboard_tab.yaml +11 -12
- data/example/openflow-gec15/exp_source.rb +26 -26
- data/example/openflow-gec15/of_viz_server.rb +7 -7
- data/example/simple/simple.yaml +2 -1
- data/example/simple/simple_dynamic.yaml +1 -1
- data/example/web_rtc/web_rtc.yaml +54 -0
- data/example/web_rtc/webrtc-exp_1381786573.sq3 +0 -0
- data/lib/omf-web/config.ru +1 -1
- data/lib/omf-web/content/content_proxy.rb +2 -2
- data/lib/omf-web/content/file_repository.rb +11 -53
- data/lib/omf-web/content/git_repository.rb +1 -1
- data/lib/omf-web/content/irods_repository.rb +1 -1
- data/lib/omf-web/content/repository.rb +5 -3
- data/lib/omf-web/content/static_repository.rb +25 -11
- data/lib/omf-web/data_source_proxy.rb +3 -3
- data/lib/omf-web/rack/content_handler.rb +2 -2
- data/lib/omf-web/rack/session_authenticator.rb +3 -3
- data/lib/omf-web/rack/tab_mapper.rb +2 -2
- data/lib/omf-web/rack/update_handler.rb +2 -2
- data/lib/omf-web/rack/websocket_handler.rb +3 -3
- data/lib/omf-web/rack/widget_mapper.rb +2 -2
- data/lib/omf-web/session_store.rb +2 -2
- data/lib/omf-web/theme/abstract_page.rb +15 -24
- data/lib/omf-web/theme/bright/code_renderer.rb +24 -30
- data/lib/omf-web/theme/bright/data_renderer.rb +7 -5
- data/lib/omf-web/theme/bright/page.rb +2 -1
- data/lib/omf-web/theme/bright/widget_chrome.rb +16 -14
- data/lib/omf-web/theme.rb +1 -1
- data/lib/omf-web/thin/logging.rb +18 -13
- data/lib/omf-web/thin/runner.rb +2 -2
- data/lib/omf-web/thin/server.rb +105 -27
- data/lib/omf-web/version.rb +1 -1
- data/lib/omf-web/widget/abstract_widget.rb +3 -3
- data/lib/omf-web/widget/data_widget.rb +1 -0
- data/lib/omf-web/widget/text/maruku.rb +1 -1
- data/lib/omf-web/widget.rb +22 -22
- data/lib/omf_web.rb +1 -1
- data/omf_web.gemspec +18 -15
- data/share/htdocs/graph/js/abstract_chart.js +69 -68
- data/share/htdocs/graph/js/abstract_nv_chart.js +35 -33
- data/share/htdocs/graph/js/abstract_widget.js +61 -62
- data/share/htdocs/graph/js/axis.js +30 -25
- data/share/htdocs/graph/js/barchart_brush.js +23 -21
- data/share/htdocs/graph/js/code_mirror.js +35 -33
- data/share/htdocs/graph/js/discrete_bar_chart.js +27 -30
- data/share/htdocs/graph/js/histogram2.js +37 -47
- data/share/htdocs/graph/js/line_chart3.js +36 -30
- data/share/htdocs/graph/js/line_chart_with_focus.js +10 -9
- data/share/htdocs/graph/js/multi_barchart.js +33 -30
- data/share/htdocs/graph/js/network2.js +98 -97
- data/share/htdocs/graph/js/pie_chart2.js +25 -23
- data/share/htdocs/graph/js/scatter_plot.js +38 -36
- data/share/htdocs/graph/js/table2.js +60 -54
- data/share/htdocs/js/app.js +43 -0
- data/share/htdocs/js/{data_source2.js → data_source3.js} +44 -73
- data/share/htdocs/js/data_source_repo.js +42 -0
- data/share/htdocs/require/nv_d3.js +2 -0
- data/share/htdocs/theme/abstract/abstract.js +4 -4
- data/share/htdocs/vendor/VERSION_MAP.yaml +2 -0
- data/share/htdocs/vendor/require-2.1.8/require.js +2053 -0
- data/share/htdocs/vendor/require-2.1.8/require.min.js +36 -0
- data/share/htdocs/vendor/require-css-0.0.7/.gitignore +1 -0
- data/share/htdocs/vendor/require-css-0.0.7/LICENSE +10 -0
- data/share/htdocs/vendor/require-css-0.0.7/README.md +231 -0
- data/share/htdocs/vendor/require-css-0.0.7/bower.json +5 -0
- data/share/htdocs/vendor/require-css-0.0.7/css-builder.js +251 -0
- data/share/htdocs/vendor/require-css-0.0.7/css.js +436 -0
- data/share/htdocs/vendor/require-css-0.0.7/normalize.js +138 -0
- data/share/htdocs/vendor/require-css-0.0.7/package.json +5 -0
- data/share/htdocs/vendor/spin/jquery.spin.js +6 -4
- metadata +100 -74
- checksums.yaml +0 -7
- data/bin/omf_web_demo +0 -3
- data/bin/omf_web_demo.sh +0 -7
- data/bin/omf_web_server.rb +0 -157
- data/lib/omf_common/lobject.rb +0 -187
- data/lib/omf_common/log4r_outputter.rb +0 -69
- data/sample.sq3 +0 -0
- data/share/htdocs/js/data_source.js +0 -173
- data/share/htdocs/js/require3.js +0 -292
data/bin/omf_web_server
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
BIN_DIR = File.dirname(File.symlink?(__FILE__) ? File.readlink(__FILE__) : __FILE__)
|
4
|
+
TOP_DIR = File.join(BIN_DIR, '..')
|
5
|
+
$: << File.join(TOP_DIR, 'lib')
|
6
|
+
|
7
|
+
require 'json'
|
8
|
+
require 'omf-web/thin/server'
|
9
|
+
|
10
|
+
DESCR = %{
|
11
|
+
Start an OMF Web based Visualisation Server
|
12
|
+
}
|
13
|
+
|
14
|
+
opts = {
|
15
|
+
#footer_right: "V#{TuhuraViz::VERSION}",
|
16
|
+
}
|
17
|
+
|
18
|
+
OMF::Web::Server.start('omf_web_server', DESCR, TOP_DIR, opts)
|
@@ -1,9 +1,9 @@
|
|
1
1
|
require 'omf_web'
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'omf_oml/table'
|
4
4
|
require 'omf_oml/sql_source'
|
5
5
|
|
6
|
-
class LazySlicableTable < OMF::
|
6
|
+
class LazySlicableTable < OMF::Base::LObject
|
7
7
|
|
8
8
|
attr_reader :name
|
9
9
|
# attr_accessor :max_size
|
@@ -15,26 +15,26 @@ class LazySlicableTable < OMF::Common::LObject
|
|
15
15
|
@schema = schema
|
16
16
|
@block = block
|
17
17
|
end
|
18
|
-
|
18
|
+
|
19
19
|
def create_sliced_table(col_name, col_value, table_opts = {})
|
20
20
|
@block.call(col_name, col_value, table_opts)
|
21
21
|
end
|
22
22
|
|
23
23
|
end
|
24
24
|
|
25
|
-
class BridgeSensor < OMF::
|
25
|
+
class BridgeSensor < OMF::Base::LObject
|
26
26
|
attr_reader :table
|
27
|
-
|
27
|
+
|
28
28
|
def initialize(db_name)
|
29
29
|
@db_name = db_name
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
# 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
|
33
33
|
def process_acceleration(stream)
|
34
34
|
#puts stream.class
|
35
35
|
@table = stream.to_table(:sensors_raw, :include_oml_internals => true)
|
36
|
-
|
37
|
-
#OMF::Web.register_datasource @table
|
36
|
+
|
37
|
+
#OMF::Web.register_datasource @table
|
38
38
|
OMF::Web.register_datasource(LazySlicableTable.new(:sensors, @table.schema) do |col_name, col_value, table_opts|
|
39
39
|
@table.create_sliced_table(col_name, col_value, table_opts)
|
40
40
|
end)
|
@@ -43,13 +43,13 @@ class BridgeSensor < OMF::Common::LObject
|
|
43
43
|
def process_health(stream)
|
44
44
|
if $fake_bridge_events
|
45
45
|
fake_health
|
46
|
-
return
|
46
|
+
return
|
47
47
|
end
|
48
|
-
|
48
|
+
|
49
49
|
@table = stream.to_table(:health, :include_oml_internals => true)
|
50
|
-
OMF::Web.register_datasource @table
|
50
|
+
OMF::Web.register_datasource @table
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
def run
|
54
54
|
#ep = OMF::OML::OmlSqlSource.new(@db_name, :offset => -500, :check_interval => 1.0)
|
55
55
|
ep = OMF::OML::OmlSqlSource.new(@db_name, :check_interval => 3.0)
|
@@ -69,13 +69,13 @@ class BridgeSensor < OMF::Common::LObject
|
|
69
69
|
ep.run
|
70
70
|
self
|
71
71
|
end
|
72
|
-
|
72
|
+
|
73
73
|
def fake_health()
|
74
74
|
# oml_sender_id INTEGER, oml_seq INTEGER, oml_ts_client REAL, oml_ts_server REAL, "eventID" TEXT, "jointID" TEXT, "health" REAL
|
75
75
|
schema = [[:oml_sender_id, :integer], [:oml_seq, :integer], [:oml_ts_client, :float], [:oml_ts_server, :float], [:eventID, :string], [:jointID, :string], [:health, :float]]
|
76
76
|
table = OMF::OML::OmlTable.new 'health', schema, :max_size => 20
|
77
77
|
OMF::Web.register_datasource table
|
78
|
-
|
78
|
+
|
79
79
|
Thread.new do
|
80
80
|
begin
|
81
81
|
seq_no = 1
|
@@ -94,7 +94,7 @@ class BridgeSensor < OMF::Common::LObject
|
|
94
94
|
puts ex
|
95
95
|
puts ex.backtrace.join("\n")
|
96
96
|
end
|
97
|
-
end
|
97
|
+
end
|
98
98
|
end
|
99
99
|
end
|
100
100
|
wv = BridgeSensor.new($oml_database).run()
|
@@ -1,46 +1,38 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
define(["graph/abstract_chart"], function(abstract_chart) {
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
OML.bridge = OML.abstract_chart.extend({
|
4
|
+
var bridge = abstract_chart.extend({
|
7
5
|
decl_properties: [
|
8
|
-
['health', 'key'],
|
9
|
-
['fill_color', 'color', 'blue'],
|
6
|
+
['health', 'key'],
|
7
|
+
['fill_color', 'color', 'blue'],
|
10
8
|
],
|
11
|
-
|
9
|
+
|
12
10
|
defaults: function() {
|
13
11
|
return this.deep_defaults({
|
14
12
|
width: 1.0, // <= 1.0 means set width to enclosing element
|
15
13
|
height: 200, // <= 1.0 means fraction of width
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
orientation: 'horizontal'
|
20
|
-
}
|
21
|
-
*/
|
22
|
-
}, OML.bridge.__super__.defaults.call(this));
|
23
|
-
},
|
24
|
-
|
14
|
+
}, bridge.__super__.defaults.call(this));
|
15
|
+
},
|
16
|
+
|
25
17
|
base_css_class: 'oml-bridge',
|
26
|
-
|
18
|
+
|
27
19
|
initialize: function(opts) {
|
28
|
-
|
29
|
-
|
20
|
+
bridge.__super__.initialize.call(this, opts);
|
21
|
+
|
30
22
|
var self = this;
|
31
23
|
OHUB.bind("bridge.event_selected", function(evt) {
|
32
24
|
var joint_id = evt.datum[evt.schema.jointID.index];
|
33
25
|
self.redraw_sensor_locator(joint_id);
|
34
26
|
});
|
35
27
|
},
|
36
|
-
|
37
|
-
|
28
|
+
|
29
|
+
|
38
30
|
configure_base_layer: function(vis) {
|
39
31
|
var base = this.base_layer = vis.append("svg:g")
|
40
32
|
.attr("class", "bridge")
|
41
33
|
;
|
42
|
-
|
43
|
-
var ca = this.chart_area;
|
34
|
+
|
35
|
+
var ca = this.chart_area;
|
44
36
|
var bgl = this.background_layer = base.append("svg:g");
|
45
37
|
this.draw_background(bgl);
|
46
38
|
|
@@ -53,7 +45,7 @@ L.provide('OML.bridge', ["graph/js/abstract_chart", "#OML.abstract_chart"],
|
|
53
45
|
var o = this.opts;
|
54
46
|
var ca = this.widget_area;
|
55
47
|
var m = this.mapping;
|
56
|
-
|
48
|
+
|
57
49
|
var events = this.data_layer.selectAll('.event')
|
58
50
|
.data(data)
|
59
51
|
;
|
@@ -70,17 +62,17 @@ L.provide('OML.bridge', ["graph/js/abstract_chart", "#OML.abstract_chart"],
|
|
70
62
|
.attr("r", 2)
|
71
63
|
.attr('cy', m.y + 50)
|
72
64
|
.style("stroke-opacity", 1e-6)
|
73
|
-
.remove();
|
65
|
+
.remove();
|
74
66
|
;
|
75
67
|
},
|
76
|
-
|
68
|
+
|
77
69
|
redraw_sensor_locator: function(joint_id) {
|
78
70
|
var self = this;
|
79
71
|
var o = this.opts;
|
80
72
|
var ca = this.widget_area;
|
81
73
|
var m = this.mapping;
|
82
74
|
var self= this;
|
83
|
-
|
75
|
+
|
84
76
|
function locator(g) {
|
85
77
|
g.append('svg:rect')
|
86
78
|
.attr('x', m.joint2x)
|
@@ -100,27 +92,24 @@ L.provide('OML.bridge', ["graph/js/abstract_chart", "#OML.abstract_chart"],
|
|
100
92
|
;
|
101
93
|
return g;
|
102
94
|
}
|
103
|
-
|
95
|
+
|
104
96
|
var selector = this.selector_layer.selectAll('.locator')
|
105
97
|
.data([joint_id], function(d) { return d; })
|
106
98
|
;
|
107
99
|
selector
|
108
100
|
.enter().append('g')
|
109
101
|
.attr('class', 'locator')
|
110
|
-
.call(locator)
|
102
|
+
.call(locator);
|
111
103
|
selector.exit().remove();
|
112
104
|
},
|
113
|
-
|
105
|
+
|
114
106
|
draw_background: function(bgl) {
|
115
|
-
|
116
|
-
var
|
117
|
-
var y = -977.36218 + bh - 75;
|
107
|
+
var bw = 600, bh = 180; // bridge dim
|
108
|
+
var y = -977.36218 + bh - 75;
|
118
109
|
var boffset = 70;
|
119
|
-
|
120
110
|
var lmargin = (this.w - (2 * boffset + bw)) / 2;
|
121
|
-
|
122
111
|
var stroke = 'silver';
|
123
|
-
|
112
|
+
|
124
113
|
bgl.append('g')
|
125
114
|
.attr("transform", 'translate(' + (boffset + lmargin) + ', ' + y + ')')
|
126
115
|
.append('path')
|
@@ -139,11 +128,11 @@ L.provide('OML.bridge', ["graph/js/abstract_chart", "#OML.abstract_chart"],
|
|
139
128
|
.attr('x1', 0)
|
140
129
|
.attr('x2', 2 * boffset + bw)
|
141
130
|
.attr('y1', ly)
|
142
|
-
.attr('y2', ly)
|
131
|
+
.attr('y2', ly)
|
143
132
|
.attr('stroke', stroke)
|
144
133
|
.attr('stroke-width', '4px')
|
145
134
|
;
|
146
|
-
|
135
|
+
|
147
136
|
var self = this;
|
148
137
|
var jid = this.schema.jointID.index;
|
149
138
|
var scale = d3.scale.linear().domain([0, 60]).range([lmargin, lmargin + 2 * boffset + bw]);
|
@@ -152,14 +141,15 @@ L.provide('OML.bridge', ["graph/js/abstract_chart", "#OML.abstract_chart"],
|
|
152
141
|
var joint = parseInt(joint_s);
|
153
142
|
var x = scale(joint);
|
154
143
|
return x;
|
155
|
-
}
|
144
|
+
};
|
156
145
|
this.mapping.x = function(d) {
|
157
146
|
return joint2x(d[jid]);
|
158
|
-
}
|
159
|
-
|
147
|
+
};
|
160
148
|
this.mapping.y = ly;
|
161
149
|
},
|
162
|
-
|
163
|
-
|
164
|
-
}) // end of
|
165
|
-
|
150
|
+
|
151
|
+
|
152
|
+
}); // end of bridge
|
153
|
+
|
154
|
+
return bridge;
|
155
|
+
});
|
@@ -1,17 +1,17 @@
|
|
1
1
|
|
2
|
-
|
2
|
+
define(["graph/line_chart3"], function (line_chart3) {
|
3
3
|
|
4
|
-
|
4
|
+
var event_line_chart = line_chart3.extend({
|
5
5
|
defaults: function() {
|
6
6
|
return this.deep_defaults({
|
7
|
-
},
|
8
|
-
},
|
9
|
-
|
7
|
+
}, event_line_chart .__super__.defaults.call(this));
|
8
|
+
},
|
9
|
+
|
10
10
|
base_css_class: 'oml-event-line-chart',
|
11
|
-
|
11
|
+
|
12
12
|
initialize: function(opts) {
|
13
|
-
|
14
|
-
|
13
|
+
event_line_chart.__super__.initialize.call(this, opts);
|
14
|
+
|
15
15
|
var self = this;
|
16
16
|
OHUB.bind("bridge.event_selected", function(evt) {
|
17
17
|
self.event_id = evt.datum[evt.schema.eventID.index];
|
@@ -19,26 +19,28 @@ L.provide('OML.event_line_chart', ["graph/js/line_chart3", "#OML.line_chart3"],
|
|
19
19
|
self.update();
|
20
20
|
});
|
21
21
|
},
|
22
|
-
|
22
|
+
|
23
23
|
update: function() {
|
24
|
-
var eid = this.event_id
|
24
|
+
var eid = this.event_id;
|
25
25
|
if (! eid) return;
|
26
|
-
|
26
|
+
|
27
27
|
var data;
|
28
28
|
if ((data = this.data_source.rows()) == null) {
|
29
|
-
throw "Missing events array in data source"
|
29
|
+
throw "Missing events array in data source";
|
30
30
|
}
|
31
|
-
|
31
|
+
|
32
32
|
var ei = this.schema.eventID.index;
|
33
33
|
data = _.filter(data, function(r) {
|
34
34
|
return r[ei] == eid;
|
35
|
-
})
|
35
|
+
});
|
36
36
|
if (data.length == 0) return;
|
37
37
|
this.redraw(data);
|
38
|
-
|
38
|
+
|
39
39
|
var i = 0;
|
40
40
|
},
|
41
41
|
|
42
|
-
|
43
|
-
}) // end of event-line_chart
|
44
|
-
|
42
|
+
|
43
|
+
}); // end of event-line_chart
|
44
|
+
|
45
|
+
return event_line_chart;
|
46
|
+
}); // end of provide
|
@@ -1,34 +1,30 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
// 'vendor/slickgrid/slick.editors.js',
|
6
|
-
// 'vendor/slickgrid/plugins/slick.rowselectionmodel.js',
|
7
|
-
// 'vendor/slickgrid/slick.grid.js',
|
8
|
-
// 'vendor/slickgrid/slick.dataview.js',
|
2
|
+
define(["graph/table2",
|
3
|
+
'vendor/slickgrid/plugins/slick.checkboxselectcolumn',
|
4
|
+
'css!/resource/css/bridge.css'], function(table2) {
|
9
5
|
|
10
|
-
L.provide('OML.event_table', ["graph/js/table2", "#OML.table2",
|
11
|
-
'vendor/slickgrid/plugins/slick.checkboxselectcolumn.js',
|
12
|
-
'css/bridge.css'
|
13
|
-
], function () {
|
6
|
+
// L.provide('OML.event_table', ["graph/js/table2", "#OML.table2",
|
7
|
+
// 'vendor/slickgrid/plugins/slick.checkboxselectcolumn.js',
|
8
|
+
// 'css/bridge.css'
|
9
|
+
// ], function () {
|
14
10
|
|
15
|
-
|
11
|
+
var event_table = table2.extend({
|
16
12
|
decl_properties: [
|
17
13
|
],
|
18
|
-
|
14
|
+
|
19
15
|
defaults: function() {
|
20
16
|
return this.deep_defaults({
|
21
|
-
},
|
22
|
-
},
|
23
|
-
|
17
|
+
}, event_table.__super__.defaults.call(this));
|
18
|
+
},
|
19
|
+
|
24
20
|
base_css_class: 'oml-event-table',
|
25
|
-
|
21
|
+
|
26
22
|
init_grid: function() {
|
27
|
-
|
23
|
+
event_table.__super__.init_grid.call(this);
|
28
24
|
|
29
25
|
var grid = this.grid;
|
30
26
|
var self = this;
|
31
|
-
|
27
|
+
|
32
28
|
grid.setSelectionModel(new Slick.RowSelectionModel());
|
33
29
|
grid.onSelectedRowsChanged.subscribe(function(e, args) {
|
34
30
|
var rindex = args.rows[0];
|
@@ -39,22 +35,22 @@ L.provide('OML.event_table', ["graph/js/table2", "#OML.table2",
|
|
39
35
|
}
|
40
36
|
});
|
41
37
|
},
|
42
|
-
|
38
|
+
|
43
39
|
init_columns: function() {
|
44
|
-
var columns =
|
45
|
-
|
40
|
+
var columns = event_table.__super__.init_columns.call(this);
|
41
|
+
|
46
42
|
// var checkboxSelector = new Slick.CheckboxSelectColumn({
|
47
43
|
// cssClass: "slick-cell-checkboxsel"
|
48
44
|
// });
|
49
45
|
// columns.splice(0, 0, checkboxSelector.getColumnDefinition());
|
50
|
-
|
46
|
+
|
51
47
|
function health_formatter(row, cell, value, columnDef, dataContext) {
|
52
48
|
if (value == null || value === "") {
|
53
49
|
return "";
|
54
50
|
}
|
55
51
|
var value = Math.round(100 * (1 - value));
|
56
52
|
var color;
|
57
|
-
|
53
|
+
|
58
54
|
if (value < 30) {
|
59
55
|
color = "silver";
|
60
56
|
} else if (value < 50) {
|
@@ -69,10 +65,12 @@ L.provide('OML.event_table', ["graph/js/table2", "#OML.table2",
|
|
69
65
|
}
|
70
66
|
var hc = columns[2];
|
71
67
|
hc.formatter = health_formatter;
|
72
|
-
hc.name = 'Attention'
|
68
|
+
hc.name = 'Attention';
|
73
69
|
return columns;
|
74
70
|
},
|
75
71
|
|
76
|
-
|
77
|
-
}) // end of event-table
|
78
|
-
|
72
|
+
|
73
|
+
}); // end of event-table
|
74
|
+
|
75
|
+
return event_table;
|
76
|
+
});
|
@@ -1,14 +1,10 @@
|
|
1
1
|
|
2
|
-
|
3
|
-
require 'omf_common/lobject'
|
4
|
-
# require 'yaml'
|
5
|
-
# require 'log4r'
|
2
|
+
require 'omf_base/lobject'
|
6
3
|
|
7
|
-
|
8
|
-
OMF::Common::Loggable.init_log 'bridge', :searchPath => File.dirname(__FILE__)
|
4
|
+
OMF::Base::Loggable.init_log 'bridge', :searchPath => File.dirname(__FILE__)
|
9
5
|
|
10
6
|
|
11
|
-
# If set, create fake sensor events
|
7
|
+
# If set, create fake sensor events
|
12
8
|
$fake_bridge_events = false
|
13
9
|
# Path to OML database
|
14
10
|
$oml_database = 'sqlite://example/bridge/data_sources/test3.sq3'
|
@@ -20,10 +16,10 @@ def load_environment
|
|
20
16
|
Dir.glob("#{File.dirname(__FILE__)}/data_sources/*.rb").each do |fn|
|
21
17
|
load fn
|
22
18
|
end
|
23
|
-
|
19
|
+
|
24
20
|
require 'yaml'
|
25
21
|
Dir.glob("#{File.dirname(__FILE__)}/widgets/*.yaml").each do |fn|
|
26
|
-
OMF::
|
22
|
+
OMF::Base::LObject.debug "Load yaml file '#{fn}'"
|
27
23
|
h = YAML.load_file(fn)
|
28
24
|
if w = h['widget']
|
29
25
|
OMF::Web.register_widget w
|
@@ -1,7 +1,7 @@
|
|
1
1
|
#ENV['BUNDLE_GEMFILE'] = "#{File.dirname(__FILE__)}/../../Gemfile"
|
2
2
|
#require 'bundler/setup'
|
3
|
-
require '
|
4
|
-
OMF::
|
3
|
+
require 'omf_base/lobject'
|
4
|
+
OMF::Base::Loggable.init_log 'demo', :searchPath => File.dirname(__FILE__)
|
5
5
|
|
6
6
|
|
7
7
|
require 'omf_oml/table'
|
@@ -13,7 +13,7 @@ widget:
|
|
13
13
|
- name: Network
|
14
14
|
type: data/network2
|
15
15
|
width: 1.0
|
16
|
-
data_source:
|
16
|
+
data_source:
|
17
17
|
name: static_network
|
18
18
|
unique_column: id # only use the latest link and row descriptions
|
19
19
|
dynamic: true
|
@@ -21,7 +21,7 @@ widget:
|
|
21
21
|
nodes:
|
22
22
|
x:
|
23
23
|
property: x
|
24
|
-
y:
|
24
|
+
y:
|
25
25
|
property: y
|
26
26
|
links:
|
27
27
|
stroke_width:
|
@@ -31,44 +31,21 @@ widget:
|
|
31
31
|
stroke_color:
|
32
32
|
property: load
|
33
33
|
color: red_yellow20_green() #green_yellow80_red()
|
34
|
-
margin:
|
34
|
+
margin:
|
35
35
|
left: 30
|
36
36
|
right: 30
|
37
37
|
interaction_mode: click # click on link to create event
|
38
38
|
|
39
39
|
|
40
|
-
|
41
|
-
# type: data/line_chart3
|
42
|
-
# #area: true # color the area between line and zero line
|
43
|
-
# data_source:
|
44
|
-
# name: static_network/links
|
45
|
-
# dynamic: true
|
46
|
-
# group_by: name
|
47
|
-
# mapping:
|
48
|
-
# x_axis: ts
|
49
|
-
# y_axis:
|
50
|
-
# property: load
|
51
|
-
# min: 0
|
52
|
-
# max: 1
|
53
|
-
# axis:
|
54
|
-
# x:
|
55
|
-
# ticks:
|
56
|
-
# type: time
|
57
|
-
# #transition: 0
|
58
|
-
# legend: Time (sec)
|
59
|
-
# y:
|
60
|
-
# legend: Load (bps)
|
61
|
-
# margin:
|
62
|
-
# left: 100
|
63
|
-
|
40
|
+
|
64
41
|
right:
|
65
42
|
- name: Single Link Stats
|
66
43
|
type: data/line_chart3
|
67
44
|
#area: true # color the area between line and zero line
|
68
45
|
data_source:
|
69
46
|
name: link_history
|
70
|
-
#name: static_network/links
|
71
|
-
|
47
|
+
#name: static_network/links
|
48
|
+
|
72
49
|
# Only fetch a 'slice' of the underlying data source. A slice
|
73
50
|
# is defined by specific value in the 'slice_column' of all rows
|
74
51
|
slice:
|
@@ -79,8 +56,8 @@ widget:
|
|
79
56
|
group_by: name
|
80
57
|
mapping:
|
81
58
|
x_axis: ts
|
82
|
-
y_axis:
|
83
|
-
property: load
|
59
|
+
y_axis:
|
60
|
+
property: load
|
84
61
|
min: 0
|
85
62
|
max: 1
|
86
63
|
axis:
|
@@ -91,5 +68,5 @@ widget:
|
|
91
68
|
legend: Time (sec)
|
92
69
|
y:
|
93
70
|
legend: Load (bps)
|
94
|
-
margin:
|
71
|
+
margin:
|
95
72
|
left: 100
|
@@ -1,32 +1,27 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
# Simple tab showing a line chart with supporting table
|
5
1
|
#
|
6
|
-
|
2
|
+
# Tab showing the source code used in this demo
|
3
|
+
#
|
7
4
|
widget:
|
8
5
|
id: code
|
9
6
|
name: Code
|
10
7
|
top_level: true
|
11
8
|
priority: 600
|
12
9
|
type: layout/tabbed
|
13
|
-
widgets:
|
14
|
-
|
15
|
-
|
10
|
+
widgets:
|
16
11
|
- name: OIDL
|
17
12
|
type: code
|
18
13
|
width: 1.0
|
19
14
|
#height: 800
|
20
15
|
content:
|
21
|
-
url: file:code:of-exp.rb
|
22
|
-
|
16
|
+
url: file:code:of-exp.rb
|
17
|
+
|
23
18
|
- name: Trema
|
24
19
|
type: code
|
25
20
|
width: 1.0
|
26
21
|
#height: 800
|
27
22
|
content:
|
28
|
-
url: file:code:trema-ctl6.rb
|
29
|
-
|
23
|
+
url: file:code:trema-ctl6.rb
|
24
|
+
|
30
25
|
|
31
26
|
|
32
27
|
|
@@ -1,8 +1,7 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# Define a 'dashboard' consisting of two columns of widgets
|
4
1
|
#
|
5
|
-
|
2
|
+
# First tab showing the network on the left and
|
3
|
+
# link stats on the right.
|
4
|
+
#
|
6
5
|
widget:
|
7
6
|
id: linked_graphs
|
8
7
|
name: Dashboard
|
@@ -14,7 +13,7 @@ widget:
|
|
14
13
|
type: data/network2
|
15
14
|
width: 1.0
|
16
15
|
height: 1.0
|
17
|
-
data_source:
|
16
|
+
data_source:
|
18
17
|
name: network
|
19
18
|
unique_column: id # only use the latest link and row descriptions
|
20
19
|
dynamic: true
|
@@ -22,7 +21,7 @@ widget:
|
|
22
21
|
nodes:
|
23
22
|
x:
|
24
23
|
property: x
|
25
|
-
y:
|
24
|
+
y:
|
26
25
|
property: y
|
27
26
|
radius: 20
|
28
27
|
links:
|
@@ -35,12 +34,12 @@ widget:
|
|
35
34
|
property: load
|
36
35
|
max: 1.0
|
37
36
|
color: green_yellow80_red()
|
38
|
-
margin:
|
37
|
+
margin:
|
39
38
|
left: 30
|
40
39
|
right: 30
|
41
|
-
|
40
|
+
interaction_mode: click # click on link to create event
|
41
|
+
|
42
42
|
|
43
|
-
|
44
43
|
right:
|
45
44
|
- name: Link Stats
|
46
45
|
type: data/line_chart3
|
@@ -51,8 +50,8 @@ widget:
|
|
51
50
|
name: link_history
|
52
51
|
mapping:
|
53
52
|
x_axis: ts
|
54
|
-
y_axis:
|
55
|
-
property: rate
|
53
|
+
y_axis:
|
54
|
+
property: rate
|
56
55
|
#max: 1
|
57
56
|
group_by: name
|
58
57
|
axis:
|
@@ -68,5 +67,5 @@ widget:
|
|
68
67
|
ticks:
|
69
68
|
format: 's'
|
70
69
|
transition: 0
|
71
|
-
margin:
|
70
|
+
margin:
|
72
71
|
left: 100
|