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
@@ -1,22 +1,22 @@
|
|
1
1
|
require 'omf_web'
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'omf_oml/network'
|
4
4
|
require 'omf_oml/table'
|
5
5
|
require 'omf_oml/sql_source'
|
6
6
|
|
7
|
-
require 'em-postgresql-sequel'
|
7
|
+
#require 'em-postgresql-sequel'
|
8
8
|
|
9
9
|
|
10
10
|
include OMF::OML
|
11
11
|
|
12
|
-
class ExpDB < OMF::
|
13
|
-
|
14
|
-
|
12
|
+
class ExpDB < OMF::Base::LObject
|
13
|
+
|
14
|
+
|
15
15
|
def initialize(db_opts)
|
16
16
|
@db_opts = db_opts
|
17
17
|
init_network
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
def init_network
|
21
21
|
@nw = nw = OmlNetwork.new('network')
|
22
22
|
nw.node_schema [[:x, :float], [:y, :float]]
|
@@ -24,7 +24,7 @@ class ExpDB < OMF::Common::LObject
|
|
24
24
|
nw.create_node :n1, :x => 0.2, :y => 0.5
|
25
25
|
nw.create_node :n2, :x => 0.8, :y => 0.5
|
26
26
|
nw.create_node :n3, :x => 0.8, :y => 0.2
|
27
|
-
|
27
|
+
|
28
28
|
nw.link_schema [[:ts, :float], [:bytes, :int], [:rate, :float], [:load, :float]]
|
29
29
|
@links = {}
|
30
30
|
@links[:l20] = nw.create_link(:l20, :n2, :n0, :ts => 0, :bytes => 0, :rate => 0, :load => 0)
|
@@ -32,21 +32,21 @@ class ExpDB < OMF::Common::LObject
|
|
32
32
|
@links[:l21] = nw.create_link(:l21, :n2, :n1, :ts => 0, :bytes => 0, :rate => 0, :load => 0)
|
33
33
|
@links[:l32] = nw.create_link(:l32, :n3, :n2, :ts => 0, :bytes => 0, :rate => 0, :load => 0)
|
34
34
|
|
35
|
-
|
35
|
+
|
36
36
|
OMF::Web.register_datasource nw.to_table(:nodes, :index => :id)
|
37
37
|
OMF::Web.register_datasource nw.to_table(:links, :index => :id)
|
38
38
|
@link_history = nw.to_table(:links, :max_size => 100)
|
39
39
|
OMF::Web.register_datasource @link_history, :name => 'link_history'
|
40
40
|
end
|
41
|
-
|
41
|
+
|
42
42
|
def setup_nmetric(stream)
|
43
43
|
schema = stream.schema
|
44
44
|
t = OMF::OML::OmlTable.new(:nmetric, schema, :max_size => 1000)
|
45
45
|
ts_i = schema.index_for_col(:oml_ts_server)
|
46
46
|
name_i = schema.index_for_col(:name)
|
47
|
-
tx_i = schema.index_for_col(:tx_bytes)
|
48
|
-
rx_i = schema.index_for_col(:rx_bytes)
|
49
|
-
|
47
|
+
tx_i = schema.index_for_col(:tx_bytes)
|
48
|
+
rx_i = schema.index_for_col(:rx_bytes)
|
49
|
+
|
50
50
|
def process(l, ts, bytes, max_rate)
|
51
51
|
if (delta_t = ts - l[:ts]) > 0
|
52
52
|
old_v = l[:bytes]
|
@@ -58,10 +58,10 @@ class ExpDB < OMF::Common::LObject
|
|
58
58
|
l[:load] = 1.0 * rate / max_rate
|
59
59
|
end
|
60
60
|
end
|
61
|
-
|
61
|
+
|
62
62
|
stream.on_new_tuple() do |v|
|
63
63
|
r = v.to_a(schema)
|
64
|
-
|
64
|
+
|
65
65
|
t.add_row(r)
|
66
66
|
ts = r[ts_i]; name = r[name_i].to_sym; tx = r[tx_i]; rx = r[rx_i]
|
67
67
|
#puts "VVV(#{ts}) >> #{v.row.inspect}"
|
@@ -78,24 +78,24 @@ class ExpDB < OMF::Common::LObject
|
|
78
78
|
end
|
79
79
|
sleep 0.5 if ts > 7300
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
# nw.transaction do
|
83
|
-
# links.each_with_index do |l, i|
|
83
|
+
# links.each_with_index do |l, i|
|
84
84
|
# l[:ts] = ts
|
85
|
-
# l[:load] = rand() * frac + i * frac
|
85
|
+
# l[:load] = rand() * frac + i * frac
|
86
86
|
# end
|
87
87
|
# end
|
88
|
-
|
89
|
-
OMF::Web.register_datasource t
|
88
|
+
|
89
|
+
OMF::Web.register_datasource t
|
90
90
|
end
|
91
|
-
|
91
|
+
|
92
92
|
def process_nmetric(table)
|
93
93
|
schema = table.schema
|
94
94
|
ts_i = schema.index_for_col(:oml_ts_server)
|
95
95
|
name_i = schema.index_for_col(:name)
|
96
|
-
tx_i = schema.index_for_col(:tx_bytes)
|
97
|
-
rx_i = schema.index_for_col(:rx_bytes)
|
98
|
-
|
96
|
+
tx_i = schema.index_for_col(:tx_bytes)
|
97
|
+
rx_i = schema.index_for_col(:rx_bytes)
|
98
|
+
|
99
99
|
def process(l, ts, bytes, max_rate)
|
100
100
|
if (delta_t = ts - l[:ts]) > 0
|
101
101
|
old_v = l[:bytes]
|
@@ -125,7 +125,7 @@ class ExpDB < OMF::Common::LObject
|
|
125
125
|
end
|
126
126
|
OMF::Web.register_datasource table, name: 'nmetric'
|
127
127
|
end
|
128
|
-
|
128
|
+
|
129
129
|
def run
|
130
130
|
ep = OMF::OML::OmlSqlSource.new(@db_opts, :check_interval => 3.0)
|
131
131
|
t = ep.create_table('nmetrics_net_if', include_oml_internals: true, max_size: 1000)
|
@@ -136,8 +136,8 @@ class ExpDB < OMF::Common::LObject
|
|
136
136
|
# setup_nmetric(stream)
|
137
137
|
# end
|
138
138
|
# end
|
139
|
-
# ep.run
|
139
|
+
# ep.run
|
140
140
|
self
|
141
141
|
end
|
142
|
-
|
142
|
+
|
143
143
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
|
-
require '
|
3
|
-
OMF::
|
2
|
+
require 'omf_base/lobject'
|
3
|
+
OMF::Base::Loggable.init_log 'of-demo'
|
4
4
|
|
5
5
|
|
6
6
|
require 'omf_oml/table'
|
@@ -10,13 +10,13 @@ $oml_database = 'postgres://norbit.npc.nicta.com.au/openflow-demo?user=oml2&pass
|
|
10
10
|
|
11
11
|
def load_environment
|
12
12
|
require 'omf-web/content/file_repository'
|
13
|
-
OMF::Web::ContentRepository.register_repo(:code, type: 'file',
|
14
|
-
|
13
|
+
OMF::Web::ContentRepository.register_repo(:code, type: 'file', top_dir: File.join(File.dirname(__FILE__), 'repository'))
|
14
|
+
|
15
15
|
|
16
16
|
Dir.glob("#{File.dirname(__FILE__)}/*_source.rb").each do |fn|
|
17
17
|
load fn
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
require 'yaml'
|
21
21
|
Dir.glob("#{File.dirname(__FILE__)}/*_tab.yaml").each do |fn|
|
22
22
|
h = YAML.load_file(fn)
|
@@ -26,7 +26,7 @@ def load_environment
|
|
26
26
|
MObject.error "Don't know what to do with '#{fn}'"
|
27
27
|
end
|
28
28
|
end
|
29
|
-
|
29
|
+
|
30
30
|
# Start database adapter
|
31
31
|
EM.next_tick do
|
32
32
|
EM::run do
|
@@ -56,7 +56,7 @@ opts = {
|
|
56
56
|
end
|
57
57
|
p.separator ""
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
}
|
61
61
|
}
|
62
62
|
require 'omf_web'
|
data/example/simple/simple.yaml
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
|
7
7
|
server:
|
8
8
|
name: 'Simple Demo'
|
9
|
+
page_title: 'Simple Demo'
|
9
10
|
port: 4050
|
10
11
|
|
11
12
|
data_sources:
|
@@ -13,7 +14,7 @@ data_sources:
|
|
13
14
|
table: wave
|
14
15
|
database:
|
15
16
|
id: sample
|
16
|
-
url: sqlite
|
17
|
+
url: sqlite:sample.sq3
|
17
18
|
|
18
19
|
repositories:
|
19
20
|
- id: simple
|
@@ -0,0 +1,54 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
|
4
|
+
# Simple tab showing a line chart with supporting table
|
5
|
+
#
|
6
|
+
|
7
|
+
server:
|
8
|
+
name: 'WebRTC Demo'
|
9
|
+
page_title: 'WebRTC Demo'
|
10
|
+
port: 4050
|
11
|
+
|
12
|
+
data_sources:
|
13
|
+
- id: rtc_stats
|
14
|
+
#table: webrtc_stats
|
15
|
+
query: SELECT oml_ts_server as ts, val, wrid FROM webrtc_stats WHERE key='googRtt'
|
16
|
+
schema: [[ts, float], [val, int], [wrid, string]]
|
17
|
+
database:
|
18
|
+
id: rtc
|
19
|
+
url: sqlite:webrtc-exp_1381786573.sq3
|
20
|
+
|
21
|
+
widgets:
|
22
|
+
- id: main
|
23
|
+
name: Main
|
24
|
+
top_level: true
|
25
|
+
priority: 900
|
26
|
+
type: layout/one_column
|
27
|
+
widgets:
|
28
|
+
- type: layout/stacked
|
29
|
+
info: This widget shows ?????.
|
30
|
+
widgets:
|
31
|
+
- name: WRID
|
32
|
+
type: data/line_chart3
|
33
|
+
data_source:
|
34
|
+
name: rtc_stats
|
35
|
+
mapping:
|
36
|
+
x_axis: ts
|
37
|
+
y_axis:
|
38
|
+
property: val
|
39
|
+
min: 0
|
40
|
+
group_by: wrid
|
41
|
+
axis:
|
42
|
+
x:
|
43
|
+
legend: Time (sec)
|
44
|
+
y:
|
45
|
+
legend: ??
|
46
|
+
ticks:
|
47
|
+
format: ".1s"
|
48
|
+
|
49
|
+
- name: Table
|
50
|
+
type: data/table2
|
51
|
+
data_source:
|
52
|
+
name: rtc_stats
|
53
|
+
|
54
|
+
|
Binary file
|
data/lib/omf-web/config.ru
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'digest/md5'
|
3
|
-
require '
|
3
|
+
require 'omf_base/lobject'
|
4
4
|
require 'omf_web'
|
5
5
|
|
6
6
|
module OMF::Web
|
@@ -9,7 +9,7 @@ module OMF::Web
|
|
9
9
|
# in a web browser and the corresponding +OmlTable+ in this server.
|
10
10
|
#
|
11
11
|
#
|
12
|
-
class ContentProxy < OMF::
|
12
|
+
class ContentProxy < OMF::Base::LObject
|
13
13
|
|
14
14
|
@@proxies = {}
|
15
15
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
require 'find'
|
3
|
-
require '
|
3
|
+
require 'omf_base/lobject'
|
4
4
|
require 'omf_web'
|
5
5
|
require 'omf-web/content/content_proxy'
|
6
6
|
require 'omf-web/content/repository'
|
@@ -10,55 +10,13 @@ module OMF::Web
|
|
10
10
|
# This class provides an interface to a directory based repository
|
11
11
|
# It retrieves, archives and versions content.
|
12
12
|
#
|
13
|
-
class FileContentRepository < ContentRepository
|
14
|
-
|
15
|
-
# @@file_repositories = {}
|
16
|
-
#
|
17
|
-
# # Return the repository which is referenced to by elements in 'opts'.
|
18
|
-
# #
|
19
|
-
# #
|
20
|
-
# def self.[](name)
|
21
|
-
# unless repo = @@file_repositories[name.to_sym]
|
22
|
-
# raise "Unknown file repo '#{name}'"
|
23
|
-
# end
|
24
|
-
# repo
|
25
|
-
# end
|
26
|
-
#
|
27
|
-
# # Register an existing directory to the system. It will be
|
28
|
-
# # consulted for all content url's strarting with
|
29
|
-
# # 'file:_top_dir_:'. If 'is_primary' is set to true, it will
|
30
|
-
# # become the default repo for all newly created content
|
31
|
-
# # in this app.
|
32
|
-
# #
|
33
|
-
# def self.register_file_repo(name, top_dir, is_primary = false)
|
34
|
-
# name = name.to_sym
|
35
|
-
# if @@file_repositories[name]
|
36
|
-
# warn "Ignoring repeated registration of file rep '#{name}'"
|
37
|
-
# return
|
38
|
-
# end
|
39
|
-
# repo = @@file_repositories[name] = FileContentRepository.new(name, top_dir)
|
40
|
-
# if is_primary
|
41
|
-
# @@primary_repository = repo
|
42
|
-
# end
|
43
|
-
# end
|
44
|
-
|
45
|
-
|
13
|
+
class FileContentRepository < ContentRepository
|
14
|
+
|
46
15
|
def initialize(name, opts)
|
47
16
|
super
|
48
17
|
@url_prefix = "file:#{name}:"
|
49
18
|
end
|
50
|
-
|
51
|
-
#
|
52
|
-
# Create a URL for a file with 'path' in.
|
53
|
-
# If 'strictly_new' is true, returns nil if 'path' already exists.
|
54
|
-
#
|
55
|
-
# def create_url(path, strictly_new = true)
|
56
|
-
# return "git:"
|
57
|
-
# # TODO: Need to add code to select proper repository
|
58
|
-
# return GitContentRepository.create_url(path, strictly_new)
|
59
|
-
# end
|
60
|
-
|
61
|
-
|
19
|
+
|
62
20
|
# Load content described by either a hash or a straightforward path
|
63
21
|
# and return a 'ContentProxy' holding it.
|
64
22
|
#
|
@@ -73,9 +31,9 @@ module OMF::Web
|
|
73
31
|
descr = descr ? descr.dup : {}
|
74
32
|
url = @url_prefix + path
|
75
33
|
key = Digest::MD5.hexdigest(url)
|
76
|
-
descr[:url] = url
|
34
|
+
descr[:url] = url
|
77
35
|
descr[:url_key] = key
|
78
|
-
descr[:path] = path
|
36
|
+
descr[:path] = path
|
79
37
|
descr[:name] = url # Should be something human digestable
|
80
38
|
if (descr[:strictly_new])
|
81
39
|
Dir.chdir(@top_dir) do
|
@@ -85,7 +43,7 @@ module OMF::Web
|
|
85
43
|
proxy = ContentProxy.create(descr, self)
|
86
44
|
return proxy
|
87
45
|
end
|
88
|
-
|
46
|
+
|
89
47
|
def write(content_descr, content, message)
|
90
48
|
path = _get_path(content_descr)
|
91
49
|
Dir.chdir(@top_dir) do
|
@@ -97,13 +55,13 @@ module OMF::Web
|
|
97
55
|
f.close
|
98
56
|
end
|
99
57
|
end
|
100
|
-
|
58
|
+
|
101
59
|
# Return a URL for a path in this repo
|
102
|
-
#
|
60
|
+
#
|
103
61
|
def get_url_for_path(path)
|
104
62
|
"file:#{path}"
|
105
63
|
end
|
106
|
-
|
64
|
+
|
107
65
|
def _get_path(content_descr)
|
108
66
|
if content_descr.is_a? String
|
109
67
|
path = content_descr.to_s
|
@@ -129,6 +87,6 @@ module OMF::Web
|
|
129
87
|
end
|
130
88
|
return path
|
131
89
|
end
|
132
|
-
|
90
|
+
|
133
91
|
end # class
|
134
92
|
end # module
|
@@ -2,7 +2,7 @@
|
|
2
2
|
#require 'base64'
|
3
3
|
require 'grit'
|
4
4
|
require 'find'
|
5
|
-
require '
|
5
|
+
require 'omf_base/lobject'
|
6
6
|
require 'omf_web'
|
7
7
|
require 'omf-web/content/content_proxy'
|
8
8
|
|
@@ -11,7 +11,7 @@ module OMF::Web
|
|
11
11
|
# This class provides an interface to a particular content repository.
|
12
12
|
# It retrieves, archives and versions content.
|
13
13
|
#
|
14
|
-
class ContentRepository < OMF::
|
14
|
+
class ContentRepository < OMF::Base::LObject
|
15
15
|
|
16
16
|
MIME_TYPE = {
|
17
17
|
:js => 'text/javascript',
|
@@ -83,7 +83,9 @@ module OMF::Web
|
|
83
83
|
if (text = url_or_descr[:text])
|
84
84
|
# a bit of a hack for small static text blocks
|
85
85
|
# Much better for maintenance is to use a separate file
|
86
|
-
|
86
|
+
require 'omf-web/content/static_repository'
|
87
|
+
url = OMF::Web::StaticContentRepository.create_from_text(url_or_descr, opts)
|
88
|
+
#url = repo.url # "static:-"
|
87
89
|
else
|
88
90
|
url = url_or_descr[:url]
|
89
91
|
end
|
@@ -1,25 +1,39 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'omf_web'
|
4
4
|
require 'omf-web/content/content_proxy'
|
5
5
|
require 'omf-web/content/repository'
|
6
6
|
require 'singleton'
|
7
7
|
|
8
8
|
module OMF::Web
|
9
|
-
|
9
|
+
|
10
10
|
# This class provides an interface to a repository of static,
|
11
11
|
# preloaded content.
|
12
12
|
#
|
13
|
-
class StaticContentRepository < ContentRepository
|
14
|
-
|
15
|
-
|
13
|
+
class StaticContentRepository < ContentRepository
|
14
|
+
|
15
|
+
# Create a static repo.
|
16
|
+
# @param descr - {text: ....}
|
17
|
+
# @param opts - ???
|
18
|
+
# @returns url for repo
|
19
|
+
#
|
20
|
+
def self.create_from_text(descr, opts)
|
21
|
+
puts "STATIC>>> #{opts}"
|
22
|
+
unless (text = descr[:text])
|
23
|
+
text "Missing 'text' declaration in 'content'"
|
24
|
+
end
|
25
|
+
key = Digest::MD5.hexdigest(text)
|
26
|
+
ContentRepository.register_repo(key, type: :static, text: text)
|
27
|
+
"static:#{key}"
|
28
|
+
end
|
29
|
+
|
16
30
|
# Load content described by either a hash or a straightforward path
|
17
31
|
# and return a 'ContentProxy' holding it.
|
18
32
|
#
|
19
33
|
# @return: Content proxy
|
20
34
|
#
|
21
35
|
def create_content_proxy_for(content_descr)
|
22
|
-
debug content_descr
|
36
|
+
debug "CREATE CONTNT PROXY: #{content_descr}"
|
23
37
|
if content_descr.is_a? String
|
24
38
|
content_descr = {text: content_descr}
|
25
39
|
end
|
@@ -27,7 +41,7 @@ module OMF::Web
|
|
27
41
|
unless text = descr.delete(:text)
|
28
42
|
raise "Missing ':text' declaraton for static content"
|
29
43
|
end
|
30
|
-
|
44
|
+
|
31
45
|
key = Digest::MD5.hexdigest(text)
|
32
46
|
@content[key] = text
|
33
47
|
descr[:url] = url = "static:" + key
|
@@ -41,7 +55,7 @@ module OMF::Web
|
|
41
55
|
debug "READ: #{content_descr}"
|
42
56
|
@content[content_descr[:url_key]] || 'Unknown'
|
43
57
|
end
|
44
|
-
|
58
|
+
|
45
59
|
def write(content_descr, content, message)
|
46
60
|
raise "READ ONLY"
|
47
61
|
end
|
@@ -54,8 +68,8 @@ module OMF::Web
|
|
54
68
|
super
|
55
69
|
@content = {}
|
56
70
|
end
|
57
|
-
|
58
|
-
|
59
|
-
|
71
|
+
|
72
|
+
|
73
|
+
|
60
74
|
end # class
|
61
75
|
end # module
|
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
|
3
|
-
require '
|
3
|
+
require 'omf_base/lobject'
|
4
4
|
require 'omf_oml/network'
|
5
5
|
|
6
6
|
module OMF::Web
|
@@ -9,7 +9,7 @@ module OMF::Web
|
|
9
9
|
# in a web browser and the corresponding +OmlTable+ in this server.
|
10
10
|
#
|
11
11
|
#
|
12
|
-
class DataSourceProxy < OMF::
|
12
|
+
class DataSourceProxy < OMF::Base::LObject
|
13
13
|
|
14
14
|
@@datasources = {}
|
15
15
|
|
@@ -164,7 +164,7 @@ module OMF::Web
|
|
164
164
|
#puts "to_java2>>>>> #{opts.inspect}"
|
165
165
|
|
166
166
|
%{
|
167
|
-
|
167
|
+
ds.register(#{opts.to_json});
|
168
168
|
}
|
169
169
|
|
170
170
|
end
|
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'omf-web/rack/rack_exceptions'
|
4
4
|
require 'omf-web/content/content_proxy'
|
5
5
|
|
6
6
|
module OMF::Web::Rack
|
7
7
|
|
8
|
-
class ContentHandler < OMF::
|
8
|
+
class ContentHandler < OMF::Base::LObject
|
9
9
|
|
10
10
|
def call(env)
|
11
11
|
req = ::Rack::Request.new(env)
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'rack'
|
4
4
|
require 'omf-web/session_store'
|
5
5
|
|
@@ -16,7 +16,7 @@ module OMF::Web::Rack
|
|
16
16
|
# Calls to the class methods are resolved inthe context
|
17
17
|
# of a Session using 'OMF::Web::SessionStore'
|
18
18
|
#
|
19
|
-
class SessionAuthenticator < OMF::
|
19
|
+
class SessionAuthenticator < OMF::Base::LObject
|
20
20
|
|
21
21
|
# Returns true if this Rack module has been instantiated
|
22
22
|
# in the current Rack stack.
|
@@ -130,7 +130,7 @@ module OMF::Web::Rack
|
|
130
130
|
sid = "s#{(rand * 10000000).to_i}_#{(rand * 10000000).to_i}"
|
131
131
|
end
|
132
132
|
Thread.current["sessionID"] = sid # needed for Session Store
|
133
|
-
debug "Request for '#{path_info}' - sid: #{sid} - #{self.class.authenticated?}"
|
133
|
+
#debug "Request for '#{path_info}' - sid: #{sid} - #{self.class.authenticated?}"
|
134
134
|
unless @opts[:no_session].find {|rx| rx.match(path_info) }
|
135
135
|
# If 'login_page_url' is defined, check if this session is authenticated
|
136
136
|
login_url = @opts[:login_page_url]
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
#require 'erector'
|
4
4
|
require 'rack'
|
5
5
|
#require 'omf-web/page'
|
@@ -11,7 +11,7 @@ require 'omf-web/theme'
|
|
11
11
|
|
12
12
|
|
13
13
|
module OMF::Web::Rack
|
14
|
-
class TabMapper < OMF::
|
14
|
+
class TabMapper < OMF::Base::LObject
|
15
15
|
|
16
16
|
|
17
17
|
def initialize(opts = {})
|
@@ -1,11 +1,11 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'omf-web/session_store'
|
4
4
|
require 'omf-web/rack/rack_exceptions'
|
5
5
|
|
6
6
|
module OMF::Web::Rack
|
7
7
|
|
8
|
-
class UpdateHandler < OMF::
|
8
|
+
class UpdateHandler < OMF::Base::LObject
|
9
9
|
|
10
10
|
def initialize(opts = {})
|
11
11
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
2
|
|
3
3
|
require 'rack/websocket'
|
4
|
-
require '
|
4
|
+
require 'omf_base/lobject'
|
5
5
|
require 'omf-web/session_store'
|
6
6
|
require 'thread'
|
7
7
|
|
8
8
|
module OMF::Web::Rack
|
9
9
|
|
10
10
|
class WebsocketHandler < ::Rack::WebSocket::Application
|
11
|
-
include OMF::
|
12
|
-
extend OMF::
|
11
|
+
include OMF::Base::Loggable
|
12
|
+
extend OMF::Base::Loggable
|
13
13
|
|
14
14
|
MESSAGE_DELAY = 0.5 # Delay in pushing action message to browser
|
15
15
|
# after receiving a 'on_change' from monitored data proxy
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
require 'rack'
|
4
4
|
require 'omf-web/session_store'
|
5
5
|
require 'omf-web/widget'
|
@@ -9,7 +9,7 @@ OMF::Web::Theme.require 'widget_page'
|
|
9
9
|
|
10
10
|
module OMF::Web::Rack
|
11
11
|
|
12
|
-
class WidgetMapper < OMF::
|
12
|
+
class WidgetMapper < OMF::Base::LObject
|
13
13
|
|
14
14
|
def initialize(opts = {})
|
15
15
|
@opts = opts
|
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
require '
|
2
|
+
require 'omf_base/lobject'
|
3
3
|
|
4
4
|
|
5
5
|
module OMF::Web
|
@@ -8,7 +8,7 @@ module OMF::Web
|
|
8
8
|
#
|
9
9
|
# TODO: Implement cleanup thread
|
10
10
|
#
|
11
|
-
class SessionStore < OMF::
|
11
|
+
class SessionStore < OMF::Base::LObject
|
12
12
|
@@sessions = {}
|
13
13
|
|
14
14
|
def self.[](key, domain)
|