omf_web 0.9.1 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (243) hide show
  1. data/.gitignore +0 -1
  2. data/README.md +8 -2
  3. data/doc/screenshot.png +0 -0
  4. data/example/{basic → NOT_WORKING/basic}/hello-world-wired.rb +0 -0
  5. data/example/{basic → NOT_WORKING/basic}/visualisation.yml +0 -0
  6. data/example/{brooklyn → NOT_WORKING/brooklyn}/brooklynDemo.sq3 +0 -0
  7. data/example/{brooklyn → NOT_WORKING/brooklyn}/brooklyn_gps.dat +0 -0
  8. data/example/{brooklyn → NOT_WORKING/brooklyn}/brooklyn_server.rb +0 -0
  9. data/example/{brooklyn → NOT_WORKING/brooklyn}/brooklyn_wimax.dat +0 -0
  10. data/example/{brooklyn → NOT_WORKING/brooklyn}/sql_source.rb +0 -0
  11. data/example/{code → NOT_WORKING/code}/code_server.rb +0 -0
  12. data/example/{frisbee → NOT_WORKING/frisbee}/data_sources/parse_log.rb +0 -0
  13. data/example/{frisbee → NOT_WORKING/frisbee}/data_sources/pxe_slice-2012-06-02t02.25.00-04.00.log +0 -0
  14. data/example/{frisbee → NOT_WORKING/frisbee}/progress_chart.yaml +0 -0
  15. data/example/{frisbee → NOT_WORKING/frisbee}/progress_tab.yaml +0 -0
  16. data/example/{frisbee → NOT_WORKING/frisbee}/progress_table.yaml +0 -0
  17. data/example/{frisbee → NOT_WORKING/frisbee}/viz_server.rb +0 -0
  18. data/example/{gec12 → NOT_WORKING/gec12}/gec12-53.rb +0 -0
  19. data/example/{gec12 → NOT_WORKING/gec12}/gec12_demo.sq3 +0 -0
  20. data/example/{gec12 → NOT_WORKING/gec12}/gec12_demo_server.rb +0 -0
  21. data/example/{gec12 → NOT_WORKING/gec12}/visualization.rb +0 -0
  22. data/example/{incoming → NOT_WORKING/incoming}/ofpu_barchart_widget.yaml +0 -0
  23. data/example/{log → NOT_WORKING/log}/log_config.xml +0 -0
  24. data/example/{log → NOT_WORKING/log}/log_server.rb +0 -0
  25. data/example/{network → NOT_WORKING/network}/flow_tab.yaml +0 -0
  26. data/example/{network → NOT_WORKING/network}/network_server.rb +0 -0
  27. data/example/{text → NOT_WORKING/text}/test.md +0 -0
  28. data/example/{text → NOT_WORKING/text}/test.rb +0 -0
  29. data/example/{wimax → NOT_WORKING/wimax}/downlink.yaml +0 -0
  30. data/example/{wimax → NOT_WORKING/wimax}/power.yaml +0 -0
  31. data/example/{wimax → NOT_WORKING/wimax}/snapshot.db +0 -0
  32. data/example/{wimax → NOT_WORKING/wimax}/snapshot.sql +0 -0
  33. data/example/{wimax → NOT_WORKING/wimax}/test.rb +0 -0
  34. data/example/{wimax → NOT_WORKING/wimax}/uplink.yaml +0 -0
  35. data/example/{wimax → NOT_WORKING/wimax}/viz_server.rb +0 -0
  36. data/example/demo/data_sources/mobile_network.rb +3 -0
  37. data/example/demo/data_sources/static_network.rb +54 -0
  38. data/example/demo/widgets/charts_tab.yaml +21 -16
  39. data/example/demo/widgets/linked_graphs_tab.yaml +95 -0
  40. data/example/demo/widgets/mobile_network_widget.yaml +1 -1
  41. data/example/demo/widgets/pie_chart_widget.yaml +1 -1
  42. data/lib/omf-web/config.ru +2 -2
  43. data/lib/omf-web/data_source_proxy.rb +81 -19
  44. data/lib/omf-web/rack/websocket_handler.rb +77 -23
  45. data/lib/omf-web/theme/abstract_page.rb +43 -26
  46. data/lib/omf-web/theme/bright/code_renderer.rb +1 -1
  47. data/lib/omf-web/theme/bright/page.rb +1 -0
  48. data/lib/omf-web/theme/bright/tabbed_renderer.rb +7 -0
  49. data/lib/omf-web/version.rb +7 -0
  50. data/lib/omf-web/widget/data_widget.rb +38 -46
  51. data/lib/omf-web/widget/layout/stacked_layout.rb +2 -1
  52. data/lib/omf-web/widget/layout/tabbed_layout.rb +1 -2
  53. data/{MARUKU-LICENSE → lib/omf-web/widget/text/maruku/MARUKU-LICENSE} +0 -0
  54. data/lib/{maruku → omf-web/widget/text/maruku}/helpers.rb +0 -0
  55. data/lib/{maruku → omf-web/widget/text/maruku}/input/parse_block.rb +0 -0
  56. data/lib/{maruku → omf-web/widget/text/maruku}/output/to_html.rb +26 -21
  57. data/lib/omf-web/widget/text/maruku.rb +5 -0
  58. data/omf_web.gemspec +2 -1
  59. data/share/htdocs/{js → UNUSED}/log/table.js +0 -0
  60. data/share/htdocs/{css → graph/css}/graph.css +0 -0
  61. data/share/htdocs/{image/graph → graph/img}/bar_chart.png +0 -0
  62. data/share/htdocs/{image/graph → graph/img}/donut_chart.png +0 -0
  63. data/share/htdocs/{image/graph → graph/img}/funnel.png +0 -0
  64. data/share/htdocs/{image/graph → graph/img}/info.png +0 -0
  65. data/share/htdocs/{image/graph → graph/img}/line_chart.png +0 -0
  66. data/share/htdocs/{image/graph → graph/img}/line_chart_fill.png +0 -0
  67. data/share/htdocs/{image/graph → graph/img}/misc.png +0 -0
  68. data/share/htdocs/{image/graph → graph/img}/overview.png +0 -0
  69. data/share/htdocs/{image/graph → graph/img}/pie_chart.png +0 -0
  70. data/share/htdocs/{image/graph → graph/img}/scatter_plot.png +0 -0
  71. data/share/htdocs/{image/graph → graph/img}/stacked_bar_chart.png +0 -0
  72. data/share/htdocs/{image/graph → graph/img}/stacked_line_chart.png +0 -0
  73. data/share/htdocs/{image/graph → graph/img}/table.png +0 -0
  74. data/share/htdocs/{js/graph → graph/js}/abstract_chart.js +1 -1
  75. data/share/htdocs/{js/graph → graph/js}/abstract_nv_chart.js +8 -13
  76. data/share/htdocs/{js/graph → graph/js}/abstract_widget.js +9 -16
  77. data/share/htdocs/{js/graph → graph/js}/axis.js +1 -1
  78. data/share/htdocs/{js/graph → graph/js}/barchart.js +2 -2
  79. data/share/htdocs/{js/graph → graph/js}/code_mirror.js +1 -5
  80. data/share/htdocs/{js/graph → graph/js}/discrete_bar_chart.js +1 -1
  81. data/share/htdocs/{js/graph → graph/js}/histogram2.js +1 -1
  82. data/share/htdocs/{js/graph → graph/js}/holt_winters_chart.js +1 -1
  83. data/share/htdocs/{js/graph → graph/js}/line_chart3.js +1 -1
  84. data/share/htdocs/{js/graph → graph/js}/line_chart_with_focus.js +1 -1
  85. data/share/htdocs/{js/graph → graph/js}/map2.js +1 -1
  86. data/share/htdocs/{js/graph → graph/js}/multi_barchart.js +1 -1
  87. data/share/htdocs/graph/js/network2.js +412 -0
  88. data/share/htdocs/{js/graph → graph/js}/pie_chart2.js +1 -1
  89. data/share/htdocs/{js/graph → graph/js}/scatter_plot.js +1 -1
  90. data/share/htdocs/{js/graph → graph/js}/table2.js +17 -20
  91. data/share/htdocs/js/data_source2.js +187 -60
  92. data/share/htdocs/js/require3.js +38 -57
  93. data/share/htdocs/theme/bright/css/bright.css +4 -4
  94. data/share/htdocs/vendor/jquery/jquery.js +9404 -0
  95. data/share/htdocs/vendor/osa/LICENSE.txt +11 -0
  96. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_arrow_green_left.svg +0 -0
  97. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_arrow_yellow_right.svg +0 -0
  98. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_awareness.svg +0 -0
  99. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_camera-web.svg +0 -0
  100. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_cloud.svg +0 -0
  101. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_contract.svg +0 -0
  102. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_database.svg +0 -0
  103. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_desktop.svg +0 -0
  104. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_desktop_imac.svg +0 -0
  105. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_device-music.svg +0 -0
  106. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_device-scanner.svg +0 -0
  107. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_device-usb-wifi.svg +0 -0
  108. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_device-usb.svg +0 -0
  109. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_device-wireless-router.svg +0 -0
  110. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_disposal.svg +0 -0
  111. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_drive-harddisk.svg +0 -0
  112. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_drive-optical.svg +0 -0
  113. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_firewall.svg +0 -0
  114. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_home.svg +0 -0
  115. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_hub.svg +0 -0
  116. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_iPhone.svg +0 -0
  117. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_ics_drive.svg +0 -0
  118. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_ics_plc.svg +0 -0
  119. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_ics_thermometer.svg +0 -0
  120. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_id_card.svg +0 -0
  121. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_image-generic.svg +0 -0
  122. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_laptop.svg +0 -0
  123. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_lifecycle.svg +0 -0
  124. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_lightning.svg +0 -0
  125. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_media-flash.svg +0 -0
  126. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_media-optical.svg +0 -0
  127. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_media-tape.svg +0 -0
  128. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_mobile_pda.svg +0 -0
  129. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_padlock.svg +0 -0
  130. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_printer.svg +0 -0
  131. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server.svg +0 -0
  132. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_application.svg +0 -0
  133. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_database.svg +0 -0
  134. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_directory.svg +0 -0
  135. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_distribution.svg +0 -0
  136. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_file.svg +0 -0
  137. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_gateway.svg +0 -0
  138. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_identity.svg +0 -0
  139. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_mail.svg +0 -0
  140. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_media.svg +0 -0
  141. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_monitor.svg +0 -0
  142. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_proxy.svg +0 -0
  143. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_terminal.svg +0 -0
  144. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_server_web.svg +0 -0
  145. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_site-branch.svg +0 -0
  146. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_site-factory.svg +0 -0
  147. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_site-head-office.svg +0 -0
  148. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_site-neighbourhood.svg +0 -0
  149. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_audit.svg +0 -0
  150. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_black_hat.svg +0 -0
  151. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_blue.svg +0 -0
  152. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_blue_security_specialist.svg +0 -0
  153. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_blue_sysadmin.svg +0 -0
  154. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_blue_tester.svg +0 -0
  155. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_blue_tie.svg +0 -0
  156. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green.svg +0 -0
  157. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_architect.svg +0 -0
  158. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_business_manager.svg +0 -0
  159. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_developer.svg +0 -0
  160. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_operations.svg +0 -0
  161. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_project_manager.svg +0 -0
  162. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_service_manager.svg +0 -0
  163. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_green_warning.svg +0 -0
  164. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_user_large_group.svg +0 -0
  165. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_users_blue_green.svg +0 -0
  166. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_vpn.svg +0 -0
  167. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_warning.svg +0 -0
  168. data/share/htdocs/{svg/osa → vendor/osa/svg}/osa_wireless_network.svg +0 -0
  169. data/share/htdocs/{image → vendor/unknown/image}/.DS_Store +0 -0
  170. data/share/htdocs/{image → vendor/unknown/image}/add_icon.gif +0 -0
  171. data/share/htdocs/{image → vendor/unknown/image}/alertbad_icon.gif +0 -0
  172. data/share/htdocs/{image → vendor/unknown/image}/alertgood_icon.gif +0 -0
  173. data/share/htdocs/{image → vendor/unknown/image}/back_disabled.jpg +0 -0
  174. data/share/htdocs/{image → vendor/unknown/image}/back_disabled.png +0 -0
  175. data/share/htdocs/{image → vendor/unknown/image}/back_enabled.jpg +0 -0
  176. data/share/htdocs/{image → vendor/unknown/image}/back_enabled.png +0 -0
  177. data/share/htdocs/{image → vendor/unknown/image}/back_enabled_hover.jpg +0 -0
  178. data/share/htdocs/{image → vendor/unknown/image}/back_enabled_hover.png +0 -0
  179. data/share/htdocs/{image → vendor/unknown/image}/bottom-bg.gif +0 -0
  180. data/share/htdocs/{image → vendor/unknown/image}/forward_disabled.jpg +0 -0
  181. data/share/htdocs/{image → vendor/unknown/image}/forward_disabled.png +0 -0
  182. data/share/htdocs/{image → vendor/unknown/image}/forward_enabled.jpg +0 -0
  183. data/share/htdocs/{image → vendor/unknown/image}/forward_enabled.png +0 -0
  184. data/share/htdocs/{image → vendor/unknown/image}/forward_enabled_hover.jpg +0 -0
  185. data/share/htdocs/{image → vendor/unknown/image}/forward_enabled_hover.png +0 -0
  186. data/share/htdocs/{image → vendor/unknown/image}/icon-remove.gif +0 -0
  187. data/share/htdocs/{image → vendor/unknown/image}/indicator.gif +0 -0
  188. data/share/htdocs/{image → vendor/unknown/image}/laptop.png +0 -0
  189. data/share/htdocs/{image → vendor/unknown/image}/logo-bottom.gif +0 -0
  190. data/share/htdocs/{image → vendor/unknown/image}/nav-tab-arrow.gif +0 -0
  191. data/share/htdocs/{image → vendor/unknown/image}/norbit_big.gif +0 -0
  192. data/share/htdocs/{image → vendor/unknown/image}/norbit_clipart.png +0 -0
  193. data/share/htdocs/{image → vendor/unknown/image}/progress_bar.gif +0 -0
  194. data/share/htdocs/{image → vendor/unknown/image}/right-bg.gif +0 -0
  195. data/share/htdocs/{image → vendor/unknown/image}/sort_asc.png +0 -0
  196. data/share/htdocs/{image → vendor/unknown/image}/sort_asc_disabled.png +0 -0
  197. data/share/htdocs/{image → vendor/unknown/image}/sort_both.png +0 -0
  198. data/share/htdocs/{image → vendor/unknown/image}/sort_desc.png +0 -0
  199. data/share/htdocs/{image → vendor/unknown/image}/sort_desc_disabled.png +0 -0
  200. data/share/htdocs/{image → vendor/unknown/image}/spinner.gif +0 -0
  201. data/share/htdocs/{svg → vendor/unknown/svg}/ap.svg +0 -0
  202. data/share/htdocs/{svg → vendor/unknown/svg}/router.svg +0 -0
  203. metadata +198 -216
  204. data/example/demo/widgets/dashboard_tab.yaml +0 -28
  205. data/example/demo/widgets/download_tab.yaml +0 -42
  206. data/example/demo/widgets/edit_tab.yaml +0 -20
  207. data/example/demo/widgets/generator_tab.yaml +0 -12
  208. data/lib/omf-oml/endpoint.rb +0 -175
  209. data/lib/omf-oml/indexed_table.rb +0 -57
  210. data/lib/omf-oml/network.rb +0 -413
  211. data/lib/omf-oml/oml_tuple.rb +0 -62
  212. data/lib/omf-oml/schema.rb +0 -191
  213. data/lib/omf-oml/sequel/sequel_server.rb +0 -412
  214. data/lib/omf-oml/sql_row.rb +0 -302
  215. data/lib/omf-oml/sql_source.rb +0 -131
  216. data/lib/omf-oml/table.rb +0 -131
  217. data/lib/omf-oml/tuple.rb +0 -97
  218. data/lib/omf_oml.rb +0 -4
  219. data/share/htdocs/css/coderay.css +0 -127
  220. data/share/htdocs/css/ie.css +0 -40
  221. data/share/htdocs/css/lightbox.css +0 -62
  222. data/share/htdocs/css/scaffold.css +0 -74
  223. data/share/htdocs/css/screen.css +0 -1313
  224. data/share/htdocs/css/search.css +0 -102
  225. data/share/htdocs/css/table.css +0 -538
  226. data/share/htdocs/css/table2.css +0 -191
  227. data/share/htdocs/css/welcome.css +0 -103
  228. data/share/htdocs/css/wfob.css +0 -171
  229. data/share/htdocs/css/wshow.css +0 -69
  230. data/share/htdocs/gec9_demo.html +0 -39
  231. data/share/htdocs/images +0 -1
  232. data/share/htdocs/js/graph/histogram.js +0 -229
  233. data/share/htdocs/js/graph/line_chart.js +0 -342
  234. data/share/htdocs/js/graph/line_chart2.js +0 -232
  235. data/share/htdocs/js/graph/line_chart_fc.js +0 -94
  236. data/share/htdocs/js/graph/map.js +0 -85
  237. data/share/htdocs/js/graph/network.js +0 -591
  238. data/share/htdocs/js/graph/network2.js +0 -318
  239. data/share/htdocs/js/graph/pie_chart.js +0 -130
  240. data/share/htdocs/js/graph/table.js +0 -94
  241. data/share/htdocs/js/require2.js +0 -1998
  242. data/share/htdocs/js/timelines.js +0 -101
  243. data/share/htdocs/stylesheet/grid.css +0 -31
@@ -13,24 +13,8 @@ module OMF::Web::Theme
13
13
  depends_on :js, "/resource/js/require3.js"
14
14
 
15
15
  depends_on :js, "/resource/theme/abstract/abstract.js"
16
- depends_on :js, "/resource/js/data_source.js"
16
+ depends_on :js, "/resource/js/data_source2.js"
17
17
 
18
- # depends_on :script, %{
19
- # L.baseURL = "/resource";
20
- # OML = {
21
- # data_sources: {},
22
- # widgets: {},
23
- #
24
- # };
25
- #
26
- # var OHUB = {};
27
- # _.extend(OHUB, Backbone.Events);
28
- #
29
- # $(window).resize(function(x) {
30
- # OHUB.trigger('window.resize', {});
31
- # });
32
- # }
33
-
34
18
  attr_reader :opts
35
19
 
36
20
  def initialize(widget, opts)
@@ -40,6 +24,17 @@ module OMF::Web::Theme
40
24
  @opts = opts
41
25
  end
42
26
 
27
+ def content
28
+ javascript %{
29
+ if (typeof(LW) == "undefined") LW = {};
30
+ LW.session_id = OML.session_id = '#{Thread.current["sessionID"]}';
31
+
32
+ L.provide('jquery', ['vendor/jquery/jquery.js']);
33
+ //L.provide('jquery.periodicalupdater', ['vendor/jquery/jquery.periodicalupdater.js']);
34
+ //L.provide('jquery.ui', ['vendor/jquery-ui/js/jquery-ui.min.js']);
35
+ }
36
+ end
37
+
43
38
  def render_flash
44
39
  return unless @flash
45
40
  if @flash[:notice]
@@ -61,23 +56,44 @@ module OMF::Web::Theme
61
56
  end
62
57
  end # render_flesh
63
58
 
59
+ # Return an array of widgets to collect data sources from
60
+ #
61
+ def data_source_widgets
62
+ # puts ">>>>> #{@widget.class}"
63
+ # if @widget.respond_to? :data_source_widgets
64
+ # @widget.data_source_widgets
65
+ # else
66
+ [@widget]
67
+ # end
68
+ end
69
+
64
70
  def render_data_sources
65
71
  return unless @widget
66
72
 
67
73
  require 'omf-oml/table'
68
74
  require 'set'
69
75
 
70
- dsh = {}
71
- @widget.collect_data_sources(Set.new).each do |ds|
72
- name = ds[:name].to_s
73
- dsh[name] = ds.merge(dsh[name] || {})
76
+ dss = Set.new
77
+ data_source_widgets.each do |w|
78
+ w.collect_data_sources(dss)
74
79
  end
80
+ #puts ">>>>>>>>>>> #{dss.inspect}"
81
+ # dsh = {}
82
+ # dss.each do |ds|
83
+ # name = ds[:name].to_s
84
+ # dsh[name] = ds.merge(dsh[name] || {})
85
+ # end
86
+
75
87
  #puts ">>>> #{dsh.inspect}"
76
- return if dsh.empty?
88
+ return if dss.empty?
77
89
 
78
- js = dsh.values.to_a.collect do |ds|
90
+ js = dss.map do |ds|
79
91
  render_data_source(ds)
80
92
  end
93
+
94
+ # js = dsh.values.to_a.collect do |ds|
95
+ # render_data_source(ds)
96
+ # end
81
97
  # Calling 'javascript' doesn't seem to work here. No idea why, so let's do it by hand
82
98
  %{
83
99
  <script type="text/javascript">
@@ -88,11 +104,11 @@ module OMF::Web::Theme
88
104
  }
89
105
  end
90
106
 
91
- def render_data_source(ds, update_interval = -1)
107
+ def render_data_source(ds)
92
108
  dspa = OMF::Web::DataSourceProxy.for_source(ds)
93
109
  dspa.collect do |dsp|
94
110
  dsp.reset()
95
- dsp.to_javascript(update_interval)
111
+ dsp.to_javascript(ds)
96
112
  end.join("\n")
97
113
  end
98
114
 
@@ -105,6 +121,7 @@ module OMF::Web::Theme
105
121
  end
106
122
 
107
123
  def to_html(opts = {})
124
+ page_title = @title # context may get screwed up below, so put title into scope
108
125
  b = super
109
126
  if @opts[:request].params.key?('embedded')
110
127
  b
@@ -114,7 +131,7 @@ module OMF::Web::Theme
114
131
  instruct
115
132
  html do
116
133
  head do
117
- title @title || "OMF WEB"
134
+ title page_title || "OMF WEB"
118
135
  #<link rel="shortcut icon" href="/resource/theme/@theme/img/favicon.ico">
119
136
  #<link rel="apple-touch-icon" href="/resource/theme/@theme/img/apple-touch-icon.png">
120
137
  text! e.join("\n")
@@ -93,7 +93,7 @@ module OMF::Web::Theme
93
93
  :media => "all", :rel => "stylesheet", :type => "text/css"
94
94
 
95
95
  javascript(%{
96
- L.require('#OML.code_mirror2', 'graph/code_mirror2.js', function() {
96
+ L.require('#OML.code_mirror', 'graph/js/code_mirror', function() {
97
97
  OML.widgets.#{base_id} = new OML.code_mirror(#{opts.to_json});
98
98
  });
99
99
  })
@@ -32,6 +32,7 @@ module OMF::Web::Theme
32
32
  # end
33
33
 
34
34
  def content
35
+ super
35
36
  div :id => 'doc3' do
36
37
  div :id => 'hd' do
37
38
  render_top_line
@@ -29,6 +29,13 @@ module OMF::Web::Theme
29
29
  end
30
30
  end
31
31
  end
32
+
33
+ # Return an array of widgets to collect data sources from
34
+ #
35
+ # def data_source_widgets
36
+ # puts "TABREN>>>>>>> #{get_selected_widget()}"
37
+ # [get_selected_widget()]
38
+ # end
32
39
 
33
40
  def render_card_nav(selected)
34
41
  cname = @opts[:component_name]
@@ -0,0 +1,7 @@
1
+
2
+ module OMF
3
+ module Web
4
+ VERSION = '0.9.3'
5
+ end
6
+ end
7
+
@@ -25,37 +25,29 @@ module OMF::Web::Widget
25
25
  raise "Missing widget option ':viz_type' for widget '#{name}' (#{opts.inspect})"
26
26
  end
27
27
  name = opts[:name] ||= 'Unknown'
28
- opts[:js_url] = "graph/#{vizType}.js"
28
+ opts[:js_url] = "graph/js/#{vizType}.js"
29
29
  opts[:js_class] = "OML.#{vizType}"
30
30
  opts[:base_el] = "\##{dom_id}"
31
-
32
- # @js_class = @widget_type = opts[:js_class]
33
- # @js_url = opts[:js_url]
34
- #
35
- # @base_id = "w#{object_id.abs}"
36
- # @base_el = "\##{@base_id}"
37
- # @wopts['base_el'] = @base_el
38
- #
39
- # @js_var_name = "oml_#{object_id.abs}"
40
-
41
31
  super opts
42
32
 
43
- # @widget_type = vizType
44
-
45
- # @wopts = opts.dup
46
33
  if (ds = opts.delete(:data_source))
47
34
  # single source
48
- @data_sources = {:default => ds}
35
+ data_sources = {:default => ds}
49
36
  end
50
- unless @data_sources ||= opts.delete(:data_sources)
37
+ unless data_sources ||= opts.delete(:data_sources)
51
38
  raise "Missing option ':data_sources' for widget '#{name}'"
52
39
  end
53
- unless @data_sources.kind_of? Hash
54
- @data_sources = {:default => @data_sources}
40
+ unless data_sources.kind_of? Hash
41
+ data_sources = {:default => data_sources}
55
42
  end
56
- opts[:data_sources] = @data_sources.collect do |name, ds_name|
57
- {:stream => ds_name, :name => name}
43
+ opts[:data_sources] = data_sources.collect do |name, ds_descr|
44
+ unless ds_descr.is_a? Hash
45
+ ds_descr = {:name => ds_descr}
46
+ end
47
+ ds_descr[:alias] = "#{name}_#{self.object_id}"
48
+ {:stream => ds_descr, :name => name}
58
49
  end
50
+ #puts "DTA_WIDGTE>>> #{opts[:data_sources].inspect}"
59
51
  end
60
52
 
61
53
  # This is the DOM id which should be used by the renderer for this widget.
@@ -78,35 +70,35 @@ module OMF::Web::Widget
78
70
  # start monitoring the table for new stuff when the web socket connects. Any
79
71
  # data added in between is not covered.
80
72
  #
81
- def on_ws_open(ws)
82
- raise "ARE WE STILL NEEDING THIS"
83
- #puts ">>>> ON_WS_OPEN"
84
- @ws = ws
85
- @data_sources.each do |name, table|
86
- table.on_row_added(self.object_id) do |row|
87
- begin
88
- # may want to queue events to group events into larger messages
89
- msg = [{:stream => name, :events => [row]}]
90
- ws.send_data msg.to_json
91
- rescue Exception => ex
92
- warn ex
93
- end
94
- end
95
- end
96
- end
97
-
98
- def on_ws_close(ws)
99
- raise "ARE WE STILL NEEDING THIS"
100
- @ws = nil
101
- @data_sources.each do |name, table|
102
- table.on_row_added(self.object_id)
103
- end
104
- end
73
+ # def on_ws_open(ws)
74
+ # raise "ARE WE STILL NEEDING THIS"
75
+ # #puts ">>>> ON_WS_OPEN"
76
+ # @ws = ws
77
+ # @data_sources.each do |name, table|
78
+ # table.on_row_added(self.object_id) do |row|
79
+ # begin
80
+ # # may want to queue events to group events into larger messages
81
+ # msg = [{:stream => name, :events => [row]}]
82
+ # ws.send_data msg.to_json
83
+ # rescue Exception => ex
84
+ # warn ex
85
+ # end
86
+ # end
87
+ # end
88
+ # end
89
+ #
90
+ # def on_ws_close(ws)
91
+ # raise "ARE WE STILL NEEDING THIS"
92
+ # @ws = nil
93
+ # @data_sources.each do |name, table|
94
+ # table.on_row_added(self.object_id)
95
+ # end
96
+ # end
105
97
 
106
98
  def collect_data_sources(ds_set)
107
99
  #puts "DATA_SOURCES>>>> #{@data_sources.values.inspect}"
108
- @data_sources.values.each do |ds|
109
- ds_set.add(ds.is_a?(Hash) ? ds : {:name => ds})
100
+ @opts[:data_sources].each do |ds|
101
+ ds_set.add(ds[:stream])
110
102
  end
111
103
  ds_set
112
104
  end
@@ -31,7 +31,8 @@ module OMF::Web::Widget::Layout
31
31
 
32
32
 
33
33
  def collect_data_sources(ds_set)
34
- @widgets.each {|w| w.collect_data_sources(ds_set) }
34
+ @active_widget.collect_data_sources(ds_set)
35
+ #@widgets.each {|w| w.collect_data_sources(ds_set) }
35
36
  ds_set
36
37
  end
37
38
 
@@ -19,7 +19,6 @@ module OMF::Web::Widget::Layout
19
19
  OMF::Web::Theme::TabbedRenderer.new(self, @widgets, @opts)
20
20
  end
21
21
 
22
-
23
22
  def collect_data_sources(ds_set)
24
23
  @widgets.each {|w| w.collect_data_sources(ds_set) }
25
24
  ds_set
@@ -65,6 +64,6 @@ module OMF::Web::Widget::Layout
65
64
 
66
65
 
67
66
 
68
- end # StackedWidget
67
+ end # class
69
68
 
70
69
  end
@@ -94,25 +94,26 @@ module MaRuKu; module Out; module HTML
94
94
  Xhtml11_mathml2_svg11 + xml
95
95
  end
96
96
 
97
-
98
- Xhtml10strict =
99
- "<?xml version='1.0' encoding='utf-8'?>
100
- <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
101
- 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n"
102
-
103
- Xhtml11strict_mathml2 = '<?xml version="1.0" encoding="utf-8"?>
104
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
105
- "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
106
- <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
107
- ]>
108
- '
109
-
110
- Xhtml11_mathml2_svg11 =
111
- '<?xml version="1.0" encoding="utf-8"?>
112
- <!DOCTYPE html PUBLIC
113
- "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
114
- "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
115
- '
97
+ unless defined? Xhtml10strict
98
+ Xhtml10strict =
99
+ "<?xml version='1.0' encoding='utf-8'?>
100
+ <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN'
101
+ 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>\n"
102
+
103
+ Xhtml11strict_mathml2 = '<?xml version="1.0" encoding="utf-8"?>
104
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
105
+ "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [
106
+ <!ENTITY mathml "http://www.w3.org/1998/Math/MathML">
107
+ ]>
108
+ '
109
+
110
+ Xhtml11_mathml2_svg11 =
111
+ '<?xml version="1.0" encoding="utf-8"?>
112
+ <!DOCTYPE html PUBLIC
113
+ "-//W3C//DTD XHTML 1.1 plus MathML 2.0 plus SVG 1.1//EN"
114
+ "http://www.w3.org/2002/04/xhtml-math-svg/xhtml-math-svg.dtd">
115
+ '
116
+ end
116
117
 
117
118
 
118
119
  def xml_newline() Text.new("\n") end
@@ -188,7 +189,9 @@ Example:
188
189
 
189
190
  =end
190
191
 
191
- METAS = %w{description keywords author revised}
192
+ unless defined? METAS
193
+ METAS = %w{description keywords author revised}
194
+ end
192
195
 
193
196
  # Render to a complete HTML document (returns a REXML document tree)
194
197
  def to_html_document_tree
@@ -387,7 +390,9 @@ It is copied as a standard HTML attribute.
387
390
 
388
391
 
389
392
 
390
- HTML4Attributes = {}
393
+ unless defined? HTML4Attributes
394
+ HTML4Attributes = {}
395
+ end
391
396
 
392
397
  coreattrs = [:id, :class, :style, :title]
393
398
  i18n = [:lang, 'xml:lang'.to_sym]
@@ -3,6 +3,11 @@
3
3
 
4
4
  require 'maruku'
5
5
  require 'maruku/ext/math'
6
+ # Monkey patches to add line numbers to html output
7
+ require 'omf-web/widget/text/maruku/input/parse_block'
8
+ require 'omf-web/widget/text/maruku/output/to_html'
9
+ require 'omf-web/widget/text/maruku/helpers'
10
+
6
11
  require 'rexml/document'
7
12
  require 'yaml'
8
13
 
data/omf_web.gemspec CHANGED
@@ -5,7 +5,7 @@ require "omf-web/version"
5
5
  Gem::Specification.new do |s|
6
6
  s.name = "omf_web"
7
7
  # s.version = OmfWeb::VERSION
8
- s.version = '0.9.1'
8
+ s.version = OMF::Web::VERSION
9
9
  s.authors = ["NICTA"]
10
10
  s.email = ["omf-user@lists.nicta.com.au"]
11
11
  s.homepage = "https://www.mytestbed.net"
@@ -21,6 +21,7 @@ Gem::Specification.new do |s|
21
21
 
22
22
  # specify any dependencies here; for example:
23
23
  # s.add_development_dependency "minitest", "~> 2.11.3"
24
+ s.add_runtime_dependency "omf-web", "~> 0.9"
24
25
  s.add_runtime_dependency "erector", "~> 0.8.3"
25
26
  s.add_runtime_dependency "activesupport", "~> 3.0.0" # required by erector:table
26
27
  s.add_runtime_dependency "rack", "~> 1.3.5"
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -1,5 +1,5 @@
1
1
 
2
- L.provide('OML.abstract_chart', ["graph/abstract_widget", "#OML.abstract_widget", "/resource/vendor/d3/d3.js"], function () {
2
+ L.provide('OML.abstract_chart', ["graph/js/abstract_widget", "#OML.abstract_widget", "vendor/d3/d3.js"], function () {
3
3
 
4
4
 
5
5
  OML.abstract_chart = OML.abstract_widget.extend({
@@ -1,8 +1,11 @@
1
- L.provide('OML.abstract_nv_chart', ["graph/abstract_chart", "#OML.abstract_chart", "graph/axis", "#OML.axis", "graph.css",
2
- ["/resource/vendor/d3/d3.js",
3
- "/resource/vendor/nv_d3/js/nv.d3.js",
4
- "/resource/vendor/nv_d3/css/nv.d3.css"
5
- ]], function () {
1
+
2
+ L.provide('d3', ["vendor/d3/d3.js"], function() {
3
+ L.provide('nv_d3', ["vendor/nv_d3/js/nv.d3.js", "vendor/nv_d3/css/nv.d3.css"]);
4
+ })
5
+
6
+ L.provide('OML.abstract_nv_chart', ["graph/js/abstract_chart", "#OML.abstract_chart",
7
+ //"graph/js/axis", "#OML.axis", "graph/css/graph.css",
8
+ "#nv_d3"], function () {
6
9
 
7
10
  OML.abstract_nv_chart = OML.abstract_chart.extend({
8
11
  axis_defaults: {
@@ -32,10 +35,6 @@ L.provide('OML.abstract_nv_chart', ["graph/abstract_chart", "#OML.abstract_chart
32
35
  this._configure_options(this.opts, chart);
33
36
  },
34
37
 
35
- // _create_model: function() {
36
- // return nv.models.lineChart();
37
- // },
38
-
39
38
  _configure_mapping: function(m, chart) {
40
39
  },
41
40
 
@@ -123,10 +122,6 @@ L.provide('OML.abstract_nv_chart', ["graph/abstract_chart", "#OML.abstract_chart
123
122
  .call(this.chart);
124
123
  },
125
124
 
126
- // _datum: function(data, chart) {
127
- // return data;
128
- // },
129
-
130
125
  })
131
126
  })
132
127
 
@@ -1,5 +1,5 @@
1
1
 
2
- L.provide('OML.abstract_widget', ["/resource/vendor/d3/d3.js"], function () {
2
+ L.provide('OML.abstract_widget', ["vendor/d3/d3.js"], function () {
3
3
 
4
4
  if (typeof(OML) == "undefined") OML = {};
5
5
 
@@ -46,11 +46,6 @@ L.provide('OML.abstract_widget', ["/resource/vendor/d3/d3.js"], function () {
46
46
  if (typeof(base_el) == "string") base_el = d3.select(base_el);
47
47
  this.base_el = base_el;
48
48
 
49
- // this.init_data_source();
50
- // this.process_schema();
51
- //
52
-
53
- //o.offset = _.defaults(opts.offset || {}, this.defaults.offset);
54
49
  this.init_data_source();
55
50
  this.process_schema();
56
51
  this.resize();
@@ -68,8 +63,8 @@ L.provide('OML.abstract_widget', ["/resource/vendor/d3/d3.js"], function () {
68
63
  }
69
64
 
70
65
  var data;
71
- if ((data = this.data_source.events) == null) {
72
- throw "Missing events array in data source"
66
+ if ((data = this.data_source.rows()) == null) {
67
+ throw "Missing rows in data source"
73
68
  }
74
69
  if (data.length == 0) return;
75
70
 
@@ -142,11 +137,9 @@ L.provide('OML.abstract_widget', ["/resource/vendor/d3/d3.js"], function () {
142
137
  init_single_data_source: function(ds_descr) {
143
138
  var ds = OML.data_sources.lookup(ds_descr.stream);
144
139
  var self = this;
145
- if (ds.is_dynamic()) {
146
- ds.on_changed(function(evt) {
147
- self.update();
148
- });
149
- }
140
+ OHUB.bind(ds.event_name, function() {
141
+ self.update();;
142
+ })
150
143
  return ds;
151
144
  },
152
145
 
@@ -256,12 +249,12 @@ L.provide('OML.abstract_widget', ["/resource/vendor/d3/d3.js"], function () {
256
249
  if (jcol_schema == undefined) {
257
250
  throw "Unknown stream element '" + jkey + "' in '" + jstream + "'.";
258
251
  }
259
- var jindex = jcol_schema.index;
260
- jstream.create_index(jindex);
252
+ var index_f = jstream.index_for_column(jcol_schema);
261
253
 
262
254
  return function(d) {
263
255
  var join = d[vindex];
264
- var t = jstream.get_indexed_row(jindex, join); //self.get_indexed_table(jstream, jindex);
256
+ //var t = jstream.get_indexed_row(jindex, join); //self.get_indexed_table(jstream, jindex);
257
+ var t = index_f(join);
265
258
  //var r = t[join];
266
259
  return t;
267
260
  }
@@ -1,5 +1,5 @@
1
1
  //L.provide('OML.axis', ["graph.css", ["/resource/vendor/d3/d3.js", "/resource/vendor/d3/d3.time.js"]], function () {
2
- L.provide('OML.axis', ["graph.css", "/resource/vendor/d3/d3.js"], function () {
2
+ L.provide('OML.axis', ["graph/css/graph.css", "vendor/d3/d3.js"], function () {
3
3
 
4
4
  OML.line_chart2_axis = function(options) {
5
5
  if (!options) options = {};
@@ -1,7 +1,7 @@
1
1
 
2
- L.provide('OML.barchart', ["graph/abstract_chart", "#OML.abstract_chart", "graph/axis", "#OML.axis",
2
+ L.provide('OML.barchart', ["graph/js/abstract_chart", "#OML.abstract_chart", "graph/js/axis", "#OML.axis",
3
3
  // ["/resource/vendor/d3/d3.js", "/resource/vendor/d3/d3.layout.js"]],
4
- ["/resource/vendor/d3/d3.js"]],
4
+ ["vendor/d3/d3.js"]],
5
5
  function () {
6
6
 
7
7
  OML.barchart = OML.abstract_chart.extend({
@@ -1,8 +1,4 @@
1
- L.provide('OML.code_mirror',
2
- [
3
- "graph/abstract_widget", "#OML.abstract_widget"
4
- ],
5
- function () {
1
+ L.provide('OML.code_mirror', ["graph/js/abstract_widget", "#OML.abstract_widget"], function () {
6
2
 
7
3
  OML.code_mirror = OML.abstract_widget.extend({
8
4
 
@@ -3,7 +3,7 @@
3
3
  // "/resource/vendor/nv_d3/js/nv.d3.js",
4
4
  // "/resource/vendor/nv_d3/css/nv.d3.css"
5
5
  // ]], function () {
6
- L.provide('OML.discrete_bar_chart', ["graph/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
6
+ L.provide('OML.discrete_bar_chart', ["graph/js/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
7
7
 
8
8
  OML.discrete_bar_chart = OML.abstract_nv_chart.extend({
9
9
  decl_properties: [
@@ -1,4 +1,4 @@
1
- L.provide('OML.histogram2', ["graph/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
1
+ L.provide('OML.histogram2', ["graph/js/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
2
2
 
3
3
  OML.histogram2 = OML.abstract_nv_chart.extend({
4
4
  decl_properties: [
@@ -1,4 +1,4 @@
1
- L.provide('OML.holt_winters_chart', ["graph/line_chart2", "#OML.line_chart2"], function () {
1
+ L.provide('OML.holt_winters_chart', ["graph/js/line_chart2", "#OML.line_chart2"], function () {
2
2
 
3
3
  OML.holt_winters_chart = OML.line_chart2.extend({
4
4
 
@@ -5,7 +5,7 @@
5
5
  // "/resource/vendor/nv_d3/js/models/lineChart.js",
6
6
  // "/resource/vendor/nv_d3/css/nv.d3.css"
7
7
  // ]], function () {
8
- L.provide('OML.line_chart3', ["graph/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
8
+ L.provide('OML.line_chart3', ["graph/js/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
9
9
 
10
10
  OML.line_chart3 = OML.abstract_nv_chart.extend({
11
11
  decl_properties: [
@@ -1,4 +1,4 @@
1
- L.provide('OML.line_chart_with_focus', ["graph/line_chart3", "#OML.line_chart3"], function () {
1
+ L.provide('OML.line_chart_with_focus', ["graph/js/line_chart3", "#OML.line_chart3"], function () {
2
2
 
3
3
  OML.line_chart_with_focus = OML.line_chart3.extend({
4
4
 
@@ -7,7 +7,7 @@ L.provide('OML.googleLoader', ["http://www.google.com/jsapi"], function () {
7
7
 
8
8
  function onMapLoaded() {
9
9
 
10
- L.provide('OML.map2', ["graph/abstract_chart", "#OML.abstract_chart"], function () {
10
+ L.provide('OML.map2', ["graph/js/abstract_chart", "#OML.abstract_chart"], function () {
11
11
 
12
12
  OML.map2 = OML.abstract_chart.extend({
13
13
  //this.opts = opts;
@@ -1,4 +1,4 @@
1
- L.provide('OML.multi_barchart', ["graph/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
1
+ L.provide('OML.multi_barchart', ["graph/js/abstract_nv_chart", "#OML.abstract_nv_chart"], function () {
2
2
 
3
3
  OML.multi_barchart = OML.abstract_nv_chart.extend({
4
4
  decl_properties: [