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.
Files changed (90) hide show
  1. data/bin/omf_web_server +18 -0
  2. data/example/bridge/README.md +7 -0
  3. data/example/bridge/data_sources/sensor-sqlite.rb +15 -15
  4. data/example/bridge/htdocs/graph/js/bridge.js +35 -45
  5. data/example/bridge/htdocs/graph/js/event_line_chart.js +20 -18
  6. data/example/bridge/htdocs/graph/js/event_table.js +26 -28
  7. data/example/bridge/viz_server.rb +5 -9
  8. data/example/demo/demo_viz_server.rb +2 -2
  9. data/example/demo/widgets/linked_graphs_tab.yaml +9 -32
  10. data/example/openflow-gec15/code_tab.yaml +7 -12
  11. data/example/openflow-gec15/dashboard_tab.yaml +11 -12
  12. data/example/openflow-gec15/exp_source.rb +26 -26
  13. data/example/openflow-gec15/of_viz_server.rb +7 -7
  14. data/example/simple/simple.yaml +2 -1
  15. data/example/simple/simple_dynamic.yaml +1 -1
  16. data/example/web_rtc/web_rtc.yaml +54 -0
  17. data/example/web_rtc/webrtc-exp_1381786573.sq3 +0 -0
  18. data/lib/omf-web/config.ru +1 -1
  19. data/lib/omf-web/content/content_proxy.rb +2 -2
  20. data/lib/omf-web/content/file_repository.rb +11 -53
  21. data/lib/omf-web/content/git_repository.rb +1 -1
  22. data/lib/omf-web/content/irods_repository.rb +1 -1
  23. data/lib/omf-web/content/repository.rb +5 -3
  24. data/lib/omf-web/content/static_repository.rb +25 -11
  25. data/lib/omf-web/data_source_proxy.rb +3 -3
  26. data/lib/omf-web/rack/content_handler.rb +2 -2
  27. data/lib/omf-web/rack/session_authenticator.rb +3 -3
  28. data/lib/omf-web/rack/tab_mapper.rb +2 -2
  29. data/lib/omf-web/rack/update_handler.rb +2 -2
  30. data/lib/omf-web/rack/websocket_handler.rb +3 -3
  31. data/lib/omf-web/rack/widget_mapper.rb +2 -2
  32. data/lib/omf-web/session_store.rb +2 -2
  33. data/lib/omf-web/theme/abstract_page.rb +15 -24
  34. data/lib/omf-web/theme/bright/code_renderer.rb +24 -30
  35. data/lib/omf-web/theme/bright/data_renderer.rb +7 -5
  36. data/lib/omf-web/theme/bright/page.rb +2 -1
  37. data/lib/omf-web/theme/bright/widget_chrome.rb +16 -14
  38. data/lib/omf-web/theme.rb +1 -1
  39. data/lib/omf-web/thin/logging.rb +18 -13
  40. data/lib/omf-web/thin/runner.rb +2 -2
  41. data/lib/omf-web/thin/server.rb +105 -27
  42. data/lib/omf-web/version.rb +1 -1
  43. data/lib/omf-web/widget/abstract_widget.rb +3 -3
  44. data/lib/omf-web/widget/data_widget.rb +1 -0
  45. data/lib/omf-web/widget/text/maruku.rb +1 -1
  46. data/lib/omf-web/widget.rb +22 -22
  47. data/lib/omf_web.rb +1 -1
  48. data/omf_web.gemspec +18 -15
  49. data/share/htdocs/graph/js/abstract_chart.js +69 -68
  50. data/share/htdocs/graph/js/abstract_nv_chart.js +35 -33
  51. data/share/htdocs/graph/js/abstract_widget.js +61 -62
  52. data/share/htdocs/graph/js/axis.js +30 -25
  53. data/share/htdocs/graph/js/barchart_brush.js +23 -21
  54. data/share/htdocs/graph/js/code_mirror.js +35 -33
  55. data/share/htdocs/graph/js/discrete_bar_chart.js +27 -30
  56. data/share/htdocs/graph/js/histogram2.js +37 -47
  57. data/share/htdocs/graph/js/line_chart3.js +36 -30
  58. data/share/htdocs/graph/js/line_chart_with_focus.js +10 -9
  59. data/share/htdocs/graph/js/multi_barchart.js +33 -30
  60. data/share/htdocs/graph/js/network2.js +98 -97
  61. data/share/htdocs/graph/js/pie_chart2.js +25 -23
  62. data/share/htdocs/graph/js/scatter_plot.js +38 -36
  63. data/share/htdocs/graph/js/table2.js +60 -54
  64. data/share/htdocs/js/app.js +43 -0
  65. data/share/htdocs/js/{data_source2.js → data_source3.js} +44 -73
  66. data/share/htdocs/js/data_source_repo.js +42 -0
  67. data/share/htdocs/require/nv_d3.js +2 -0
  68. data/share/htdocs/theme/abstract/abstract.js +4 -4
  69. data/share/htdocs/vendor/VERSION_MAP.yaml +2 -0
  70. data/share/htdocs/vendor/require-2.1.8/require.js +2053 -0
  71. data/share/htdocs/vendor/require-2.1.8/require.min.js +36 -0
  72. data/share/htdocs/vendor/require-css-0.0.7/.gitignore +1 -0
  73. data/share/htdocs/vendor/require-css-0.0.7/LICENSE +10 -0
  74. data/share/htdocs/vendor/require-css-0.0.7/README.md +231 -0
  75. data/share/htdocs/vendor/require-css-0.0.7/bower.json +5 -0
  76. data/share/htdocs/vendor/require-css-0.0.7/css-builder.js +251 -0
  77. data/share/htdocs/vendor/require-css-0.0.7/css.js +436 -0
  78. data/share/htdocs/vendor/require-css-0.0.7/normalize.js +138 -0
  79. data/share/htdocs/vendor/require-css-0.0.7/package.json +5 -0
  80. data/share/htdocs/vendor/spin/jquery.spin.js +6 -4
  81. metadata +100 -74
  82. checksums.yaml +0 -7
  83. data/bin/omf_web_demo +0 -3
  84. data/bin/omf_web_demo.sh +0 -7
  85. data/bin/omf_web_server.rb +0 -157
  86. data/lib/omf_common/lobject.rb +0 -187
  87. data/lib/omf_common/log4r_outputter.rb +0 -69
  88. data/sample.sq3 +0 -0
  89. data/share/htdocs/js/data_source.js +0 -173
  90. data/share/htdocs/js/require3.js +0 -292
@@ -1,292 +0,0 @@
1
-
2
- L = new function() {
3
- this.baseURL = null;
4
-
5
-
6
- // deps: module name starting with '#'
7
- // onReady: last argument should be a function
8
- //
9
- this.require = function(deps, onReady) {
10
- var deps = Array.prototype.slice.call(arguments);
11
- var onReady = deps.pop();
12
-
13
- var absDeps = this._calculate_required(deps);
14
- absDeps.push('#DOM_LOADED'); // only continue when DOM is ready
15
-
16
- this._pending_require.push({
17
- deps: absDeps, onReady: onReady
18
- });
19
- this._load(deps, true);
20
- this._checkAllPending(); // we may already have everything we need
21
- };
22
-
23
- this._calculate_required = function(deps) {
24
- var fDeps = this._arr_flatten(deps);
25
- var absDeps = [];
26
- var i = fDeps.length;
27
- for (; i;) {
28
- var d = fDeps[--i];
29
- if (d[0] == '#') {
30
- // module
31
- //modules.push(d.split('#')[1]);
32
- absDeps.push(d);
33
- } else {
34
- absDeps.push(this._getAbsoluteUrl(d));
35
- }
36
- }
37
- return absDeps;
38
- };
39
-
40
-
41
- // Provides 'obj_name' after loading all 'deps' and executing 'onReady'
42
- //
43
- this.provide = function(obj_name, deps, onReady) {
44
- var absDeps = this._calculate_required(deps);
45
- absDeps.push('#DOM_LOADED');
46
-
47
- this._pending_provide.push({
48
- obj_name: obj_name, deps: absDeps, onReady: onReady
49
- });
50
- this._load(deps, true);
51
- this._checkAllPending(); // we may already have everything we need
52
- }
53
-
54
- // Report that an URL has been loaded through some other means
55
- this.already_loaded = function(url) {
56
- this._loaded[url] = true;
57
- this._checkAllPending();
58
- }
59
-
60
- this._load = function(urls, loadParallel) {
61
- if (urls instanceof Array) {
62
- if (loadParallel == true) {
63
- var b = urls.length;
64
- for (; b;) {
65
- var url = urls[--b];
66
- this._load(url, false);
67
- }
68
- } else {
69
- urls = this._arr_flatten(urls);
70
- var url = urls.shift();
71
- if (urls.length > 0) {
72
- var self = this;
73
- // load one at a time
74
- this.require(url, function() {
75
- self._load(urls, false);
76
- });
77
- }
78
- this._loadOne(url);
79
- }
80
- } else {
81
- this._loadOne(urls);
82
- }
83
- }
84
-
85
- this._loadOne = function(url) {
86
- if (url[0] == '#') {
87
- return; // modules are 'provided'
88
- }
89
- var abs_url = this._getAbsoluteUrl(url);
90
- if (this._requested[abs_url] == true) return;
91
- this._requested[abs_url] = true;
92
- var sel = this._createDomFor(abs_url);
93
- sel.async = true;
94
- var hel = document.getElementsByTagName("head")[0];
95
- hel.appendChild(sel);
96
- };
97
-
98
- this._createDomFor = function(url) {
99
- var ext = url.split(".").pop();
100
- var sel;
101
- var self = this;
102
- if (ext != "css") { // this is a bit of a hack!
103
- sel = document.createElement("script");
104
- sel.src = url;
105
- sel.onload = sel.onreadystatechange = function () {
106
- if (!(this.readyState
107
- && this.readyState !== "complete"
108
- && this.readyState !== "loaded"))
109
- {
110
- this.onload = this.onreadystatechange = null;
111
- self._onLoad(url);
112
- }
113
- };
114
-
115
- } else { // css
116
- var sel = document.createElement("link");
117
- sel.href = url;
118
- sel.rel = "stylesheet";
119
- sel.type ="text/css";
120
- this._monitor_css_loaded(sel, url)
121
- }
122
- return sel;
123
- }
124
-
125
- this._monitor_css_loaded = function(sel, url) {
126
- var href = sel.href;
127
- var self = this;
128
- window.setTimeout(function() {
129
- var sheets = document.styleSheets;
130
- for (var i = 0; i < sheets.length; i++) {
131
- var sheet = sheets[i];
132
- if (sheet.href == href) {
133
- // TODO: HACK ALLERT
134
- // OK, stylesheet is loaded but we are having issues with SLickgrid and Chrome
135
- // recoginisng it immediately, maybe a delay helps
136
- window.setTimeout(function() {
137
- self._onLoad(url);
138
- }, 200);
139
- return;
140
- }
141
- }
142
- // still not loaded, try again
143
- self._monitor_css_loaded(sel, url);
144
- }, 100) ;
145
- }
146
-
147
- this._getAbsoluteUrl = function(url) {
148
- if (url.indexOf(':') < 0) { // don't change when it contains protocol
149
- if (url[0] != '/') { // don't change when starting with '/'
150
- var s = url.split(".");
151
- if (s.length == 1) { // append default '.js'
152
- url = url + '.js';
153
- s.push('js');
154
- }
155
- var ext = s.pop();
156
- //url = this.baseURL + '/' + ext + "/" + url;
157
- url = this.baseURL + '/' + url;
158
- }
159
- }
160
- return url;
161
- };
162
-
163
- this._requested = {};
164
- this._loaded = {};
165
- this._pending_require = [];
166
- this._pending_provide = [];
167
-
168
- this._onLoad = function(url) {
169
- this._loaded[url] = true;
170
- this._checkAllPending();
171
- };
172
-
173
- this._checkAllPending = function() {
174
- this._checkAllPendingProvide();
175
- this._checkAllPendingRequire();
176
- }
177
-
178
- this._checkAllPendingRequire = function() {
179
- var pending = this._pending_require.slice(0);
180
- var l = pending.length;
181
- var still_pending = [];
182
- for (; l;) {
183
- var p = pending[--l];
184
- if (this._all_loaded(p.deps)) {
185
- if (p.processed != true) { // avoid infinite recursions
186
- p.processed = true
187
- if (p.onReady) {
188
- //try {
189
- p.onReady();
190
- // } catch(err) {
191
- // //Handle errors here
192
- // var st = printStackTrace({e: err});
193
- // console.log(st.join('\n'));
194
- // var x = err;
195
- // }
196
-
197
- // As onReady may call this library as well, better start
198
- // checking from scratch
199
- this._checkAllPendingRequire();
200
- return;
201
- }
202
- }
203
- } else {
204
- still_pending.push(p);
205
- }
206
- }
207
- this._pending_require = still_pending;
208
- }
209
-
210
- // Return true if all dependencies are met
211
- // this._checkOnePendingRequire = function(descr) {
212
- // var deps = descr.deps;
213
- // if (! this._all_loaded(deps)) {
214
- // return false;
215
- // }
216
- // var modules = descr.modules;
217
- // // Also need to check on pending modules
218
- // if (descr.onReady) {
219
- // descr.onReady();
220
- // }
221
- // return true;
222
- // }
223
-
224
- this._checkAllPendingProvide = function() {
225
- var pending = this._pending_provide.slice(0);
226
- var l = pending.length;
227
- var still_pending = [];
228
- for (; l;) {
229
- var p = pending[--l];
230
- if (this._all_loaded(p.deps)) {
231
- if (p.processed != true) { // avoid infinite recursions
232
- p.processed = true
233
- if (p.onReady) {
234
- try {
235
- p.onReady();
236
- } catch(err) {
237
- //Handle errors here
238
- var s = printStackTrace({e: err});
239
- console.log(s);
240
- }
241
- }
242
- if (p.obj_name) {
243
- this._loaded["#" + p.obj_name] = true;
244
- }
245
- // As onReady may call this library as well, better start
246
- // checking from scratch
247
- this._checkAllPendingProvide();
248
- return;
249
- }
250
- } else {
251
- still_pending.push(p);
252
- }
253
- }
254
- this._pending_provide = still_pending;
255
- }
256
-
257
- // Return true if all resources in 'deps' are loaded
258
- //
259
- this._all_loaded = function(deps) {
260
- var loaded = this._loaded;
261
- var l = deps.length;
262
- for (; l;) {
263
- var name = deps[--l];
264
- if (loaded[name] != true) {
265
- return false;
266
- }
267
- }
268
- return true;
269
- };
270
-
271
- this._arr_flatten = function(array) {
272
- // http://tech.karbassi.com/2009/12/17/pure-javascript-flatten-array/
273
- var flat = [];
274
- for (var i = 0, l = array.length; i < l; i++){
275
- var type = Object.prototype.toString.call(array[i]).split(' ').pop().split(']').shift().toLowerCase();
276
- if (type) { flat = flat.concat(/^(array|collection|arguments|object)$/.test(type) ? this._arr_flatten(array[i]) : array[i]); }
277
- }
278
- return flat;
279
- }
280
-
281
- // Report that an URL has been loaded through some other means
282
- var self = this;
283
- //this.require(['vendor/jquery/jquery.js'], function() {
284
- $(document).ready(function() {
285
- self._loaded['#DOM_LOADED'] = true;
286
- self._checkAllPending();
287
- });
288
- //});
289
-
290
- };
291
-
292
-