omf_web 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -0
- data/doc/tutorial/tut01/hello_world.yaml +12 -0
- data/doc/tutorial/tut02/gen.csv +1 -0
- data/doc/tutorial/tut02/simple_graph.yaml +28 -0
- data/doc/tutorial/tut03/stacked.yaml +37 -0
- data/doc/tutorial/tut04/create_db.rb +56 -0
- data/doc/tutorial/tut04/gen.sq3 +0 -0
- data/doc/tutorial/tut04/realtime_graph.yaml +47 -0
- data/doc/tutorial/tut05/gen_maxs-laptop-3.local-35511_foo_2013-12-19t19.20.46+1100 +125 -0
- data/doc/tutorial/tut05/monitor_generator_oml.rb +36 -0
- data/doc/tutorial/tut05/realtime_graph_omsp.yaml +47 -0
- data/lib/omf-web/content/git_repository.rb +3 -3
- data/lib/omf-web/content/irods_repository.rb +2 -1
- data/lib/omf-web/content/repository.rb +5 -0
- data/lib/omf-web/content/static_repository.rb +1 -1
- data/lib/omf-web/data_source_proxy.rb +18 -10
- data/lib/omf-web/session_store.rb +18 -0
- data/lib/omf-web/theme/bright/code_renderer.rb +1 -1
- data/lib/omf-web/thin/server.rb +100 -34
- data/lib/omf-web/version.rb +1 -1
- data/omf_web.gemspec +1 -0
- data/share/htdocs/graph/js/abstract_chart.js +8 -1
- data/share/htdocs/graph/js/abstract_multiple_datasource_chart.js +82 -0
- data/share/htdocs/graph/js/abstract_widget.js +13 -11
- data/share/htdocs/js/data_source3.js +6 -6
- data/share/htdocs/js/data_source_repo.js +2 -2
- metadata +211 -216
- data/doc/tutorial/tut01/hello_world.rb +0 -27
- data/doc/tutorial/tut02/hello_graph.rb +0 -85
- data/doc/tutorial/tut03/hello_database.rb +0 -69
- data/doc/tutorial/tut03/nmetric.sq3 +0 -0
metadata
CHANGED
@@ -1,264 +1,246 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: omf_web
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 2
|
8
|
+
- 2
|
9
|
+
version: 1.2.2
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- NICTA
|
9
13
|
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
16
|
+
|
17
|
+
date: 2014-02-12 00:00:00 +11:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
15
21
|
name: omf_oml
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: '1.0'
|
22
|
-
type: :runtime
|
23
22
|
prerelease: false
|
24
|
-
|
25
|
-
|
26
|
-
requirements:
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
27
25
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
|
30
|
-
-
|
31
|
-
|
32
|
-
|
33
|
-
none: false
|
34
|
-
requirements:
|
35
|
-
- - ! '>='
|
36
|
-
- !ruby/object:Gem::Version
|
37
|
-
version: '0'
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 1
|
29
|
+
- 0
|
30
|
+
version: "1.0"
|
38
31
|
type: :runtime
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: omf_base
|
39
35
|
prerelease: false
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
name: erector
|
48
|
-
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
|
-
requirements:
|
51
|
-
- - ~>
|
52
|
-
- !ruby/object:Gem::Version
|
53
|
-
version: 0.9.0
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
segments:
|
41
|
+
- 0
|
42
|
+
version: "0"
|
54
43
|
type: :runtime
|
44
|
+
version_requirements: *id002
|
45
|
+
- !ruby/object:Gem::Dependency
|
46
|
+
name: erector
|
55
47
|
prerelease: false
|
56
|
-
|
57
|
-
|
58
|
-
requirements:
|
48
|
+
requirement: &id003 !ruby/object:Gem::Requirement
|
49
|
+
requirements:
|
59
50
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
51
|
+
- !ruby/object:Gem::Version
|
52
|
+
segments:
|
53
|
+
- 0
|
54
|
+
- 9
|
55
|
+
- 0
|
61
56
|
version: 0.9.0
|
62
|
-
- !ruby/object:Gem::Dependency
|
63
|
-
name: activesupport
|
64
|
-
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
|
-
requirements:
|
67
|
-
- - ~>
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: 3.0.0
|
70
57
|
type: :runtime
|
58
|
+
version_requirements: *id003
|
59
|
+
- !ruby/object:Gem::Dependency
|
60
|
+
name: activesupport
|
71
61
|
prerelease: false
|
72
|
-
|
73
|
-
|
74
|
-
requirements:
|
62
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
63
|
+
requirements:
|
75
64
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
segments:
|
67
|
+
- 3
|
68
|
+
- 0
|
69
|
+
- 0
|
77
70
|
version: 3.0.0
|
78
|
-
- !ruby/object:Gem::Dependency
|
79
|
-
name: rack
|
80
|
-
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
|
-
requirements:
|
83
|
-
- - ~>
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
version: '1.0'
|
86
71
|
type: :runtime
|
72
|
+
version_requirements: *id004
|
73
|
+
- !ruby/object:Gem::Dependency
|
74
|
+
name: rack
|
87
75
|
prerelease: false
|
88
|
-
|
89
|
-
|
90
|
-
requirements:
|
91
|
-
- - ~>
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
version: '1.0'
|
94
|
-
- !ruby/object:Gem::Dependency
|
95
|
-
name: thin
|
96
|
-
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
|
-
requirements:
|
76
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
99
78
|
- - ~>
|
100
|
-
- !ruby/object:Gem::Version
|
101
|
-
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 1
|
82
|
+
- 0
|
83
|
+
version: "1.0"
|
102
84
|
type: :runtime
|
85
|
+
version_requirements: *id005
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: thin
|
103
88
|
prerelease: false
|
104
|
-
|
105
|
-
|
106
|
-
requirements:
|
107
|
-
- - ~>
|
108
|
-
- !ruby/object:Gem::Version
|
109
|
-
version: '1.0'
|
110
|
-
- !ruby/object:Gem::Dependency
|
111
|
-
name: coderay
|
112
|
-
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
|
-
requirements:
|
89
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
115
91
|
- - ~>
|
116
|
-
- !ruby/object:Gem::Version
|
117
|
-
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
segments:
|
94
|
+
- 1
|
95
|
+
- 0
|
96
|
+
version: "1.0"
|
118
97
|
type: :runtime
|
98
|
+
version_requirements: *id006
|
99
|
+
- !ruby/object:Gem::Dependency
|
100
|
+
name: coderay
|
119
101
|
prerelease: false
|
120
|
-
|
121
|
-
|
122
|
-
requirements:
|
123
|
-
- - ~>
|
124
|
-
- !ruby/object:Gem::Version
|
125
|
-
version: '1.0'
|
126
|
-
- !ruby/object:Gem::Dependency
|
127
|
-
name: maruku
|
128
|
-
requirement: !ruby/object:Gem::Requirement
|
129
|
-
none: false
|
130
|
-
requirements:
|
102
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
131
104
|
- - ~>
|
132
|
-
- !ruby/object:Gem::Version
|
133
|
-
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
segments:
|
107
|
+
- 1
|
108
|
+
- 0
|
109
|
+
version: "1.0"
|
134
110
|
type: :runtime
|
111
|
+
version_requirements: *id007
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: maruku
|
135
114
|
prerelease: false
|
136
|
-
|
137
|
-
|
138
|
-
requirements:
|
115
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
139
117
|
- - ~>
|
140
|
-
- !ruby/object:Gem::Version
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
segments:
|
120
|
+
- 0
|
121
|
+
- 6
|
122
|
+
- 0
|
141
123
|
version: 0.6.0
|
142
|
-
- !ruby/object:Gem::Dependency
|
143
|
-
name: ritex
|
144
|
-
requirement: !ruby/object:Gem::Requirement
|
145
|
-
none: false
|
146
|
-
requirements:
|
147
|
-
- - ~>
|
148
|
-
- !ruby/object:Gem::Version
|
149
|
-
version: 1.0.0
|
150
124
|
type: :runtime
|
125
|
+
version_requirements: *id008
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: ritex
|
151
128
|
prerelease: false
|
152
|
-
|
153
|
-
|
154
|
-
requirements:
|
129
|
+
requirement: &id009 !ruby/object:Gem::Requirement
|
130
|
+
requirements:
|
155
131
|
- - ~>
|
156
|
-
- !ruby/object:Gem::Version
|
132
|
+
- !ruby/object:Gem::Version
|
133
|
+
segments:
|
134
|
+
- 1
|
135
|
+
- 0
|
136
|
+
- 0
|
157
137
|
version: 1.0.0
|
158
|
-
- !ruby/object:Gem::Dependency
|
159
|
-
name: json
|
160
|
-
requirement: !ruby/object:Gem::Requirement
|
161
|
-
none: false
|
162
|
-
requirements:
|
163
|
-
- - ~>
|
164
|
-
- !ruby/object:Gem::Version
|
165
|
-
version: 1.7.0
|
166
138
|
type: :runtime
|
139
|
+
version_requirements: *id009
|
140
|
+
- !ruby/object:Gem::Dependency
|
141
|
+
name: json
|
167
142
|
prerelease: false
|
168
|
-
|
169
|
-
|
170
|
-
requirements:
|
143
|
+
requirement: &id010 !ruby/object:Gem::Requirement
|
144
|
+
requirements:
|
171
145
|
- - ~>
|
172
|
-
- !ruby/object:Gem::Version
|
146
|
+
- !ruby/object:Gem::Version
|
147
|
+
segments:
|
148
|
+
- 1
|
149
|
+
- 7
|
150
|
+
- 0
|
173
151
|
version: 1.7.0
|
174
|
-
- !ruby/object:Gem::Dependency
|
175
|
-
name: grit
|
176
|
-
requirement: !ruby/object:Gem::Requirement
|
177
|
-
none: false
|
178
|
-
requirements:
|
179
|
-
- - ~>
|
180
|
-
- !ruby/object:Gem::Version
|
181
|
-
version: 2.5.0
|
182
152
|
type: :runtime
|
153
|
+
version_requirements: *id010
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: grit
|
183
156
|
prerelease: false
|
184
|
-
|
185
|
-
|
186
|
-
requirements:
|
157
|
+
requirement: &id011 !ruby/object:Gem::Requirement
|
158
|
+
requirements:
|
187
159
|
- - ~>
|
188
|
-
- !ruby/object:Gem::Version
|
160
|
+
- !ruby/object:Gem::Version
|
161
|
+
segments:
|
162
|
+
- 2
|
163
|
+
- 5
|
164
|
+
- 0
|
189
165
|
version: 2.5.0
|
190
|
-
- !ruby/object:Gem::Dependency
|
191
|
-
name: websocket-rack
|
192
|
-
requirement: !ruby/object:Gem::Requirement
|
193
|
-
none: false
|
194
|
-
requirements:
|
195
|
-
- - ~>
|
196
|
-
- !ruby/object:Gem::Version
|
197
|
-
version: 0.4.0
|
198
166
|
type: :runtime
|
167
|
+
version_requirements: *id011
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: websocket-rack
|
199
170
|
prerelease: false
|
200
|
-
|
201
|
-
|
202
|
-
requirements:
|
171
|
+
requirement: &id012 !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
203
173
|
- - ~>
|
204
|
-
- !ruby/object:Gem::Version
|
205
|
-
|
206
|
-
-
|
207
|
-
|
208
|
-
|
209
|
-
none: false
|
210
|
-
requirements:
|
211
|
-
- - ~>
|
212
|
-
- !ruby/object:Gem::Version
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
segments:
|
176
|
+
- 0
|
177
|
+
- 4
|
178
|
+
- 0
|
213
179
|
version: 0.4.0
|
214
180
|
type: :runtime
|
181
|
+
version_requirements: *id012
|
182
|
+
- !ruby/object:Gem::Dependency
|
183
|
+
name: rack-accept
|
215
184
|
prerelease: false
|
216
|
-
|
217
|
-
|
218
|
-
requirements:
|
185
|
+
requirement: &id013 !ruby/object:Gem::Requirement
|
186
|
+
requirements:
|
219
187
|
- - ~>
|
220
|
-
- !ruby/object:Gem::Version
|
188
|
+
- !ruby/object:Gem::Version
|
189
|
+
segments:
|
190
|
+
- 0
|
191
|
+
- 4
|
192
|
+
- 0
|
221
193
|
version: 0.4.0
|
222
|
-
|
194
|
+
type: :runtime
|
195
|
+
version_requirements: *id013
|
196
|
+
- !ruby/object:Gem::Dependency
|
223
197
|
name: i18n
|
224
|
-
|
225
|
-
|
226
|
-
requirements:
|
227
|
-
- -
|
228
|
-
- !ruby/object:Gem::Version
|
229
|
-
|
198
|
+
prerelease: false
|
199
|
+
requirement: &id014 !ruby/object:Gem::Requirement
|
200
|
+
requirements:
|
201
|
+
- - ">="
|
202
|
+
- !ruby/object:Gem::Version
|
203
|
+
segments:
|
204
|
+
- 0
|
205
|
+
version: "0"
|
230
206
|
type: :runtime
|
207
|
+
version_requirements: *id014
|
208
|
+
- !ruby/object:Gem::Dependency
|
209
|
+
name: rake
|
231
210
|
prerelease: false
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
name: ruby-openid
|
240
|
-
requirement: !ruby/object:Gem::Requirement
|
241
|
-
none: false
|
242
|
-
requirements:
|
243
|
-
- - ~>
|
244
|
-
- !ruby/object:Gem::Version
|
245
|
-
version: 2.2.3
|
211
|
+
requirement: &id015 !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
segments:
|
216
|
+
- 0
|
217
|
+
version: "0"
|
246
218
|
type: :runtime
|
219
|
+
version_requirements: *id015
|
220
|
+
- !ruby/object:Gem::Dependency
|
221
|
+
name: ruby-openid
|
247
222
|
prerelease: false
|
248
|
-
|
249
|
-
|
250
|
-
requirements:
|
223
|
+
requirement: &id016 !ruby/object:Gem::Requirement
|
224
|
+
requirements:
|
251
225
|
- - ~>
|
252
|
-
- !ruby/object:Gem::Version
|
226
|
+
- !ruby/object:Gem::Version
|
227
|
+
segments:
|
228
|
+
- 2
|
229
|
+
- 2
|
230
|
+
- 3
|
253
231
|
version: 2.2.3
|
232
|
+
type: :runtime
|
233
|
+
version_requirements: *id016
|
254
234
|
description: OMF's Web based control and visualization framework.
|
255
|
-
email:
|
235
|
+
email:
|
256
236
|
- omf-user@lists.nicta.com.au
|
257
|
-
executables:
|
237
|
+
executables:
|
258
238
|
- omf_web_server
|
259
239
|
extensions: []
|
240
|
+
|
260
241
|
extra_rdoc_files: []
|
261
|
-
|
242
|
+
|
243
|
+
files:
|
262
244
|
- .gitignore
|
263
245
|
- Gemfile
|
264
246
|
- README.md
|
@@ -288,10 +270,16 @@ files:
|
|
288
270
|
- doc/index.md
|
289
271
|
- doc/screenshot.png
|
290
272
|
- doc/screenshot2.png
|
291
|
-
- doc/tutorial/tut01/hello_world.
|
292
|
-
- doc/tutorial/tut02/
|
293
|
-
- doc/tutorial/
|
294
|
-
- doc/tutorial/tut03/
|
273
|
+
- doc/tutorial/tut01/hello_world.yaml
|
274
|
+
- doc/tutorial/tut02/gen.csv
|
275
|
+
- doc/tutorial/tut02/simple_graph.yaml
|
276
|
+
- doc/tutorial/tut03/stacked.yaml
|
277
|
+
- doc/tutorial/tut04/create_db.rb
|
278
|
+
- doc/tutorial/tut04/gen.sq3
|
279
|
+
- doc/tutorial/tut04/realtime_graph.yaml
|
280
|
+
- doc/tutorial/tut05/gen_maxs-laptop-3.local-35511_foo_2013-12-19t19.20.46+1100
|
281
|
+
- doc/tutorial/tut05/monitor_generator_oml.rb
|
282
|
+
- doc/tutorial/tut05/realtime_graph_omsp.yaml
|
295
283
|
- doc/widget_detail.png
|
296
284
|
- etc/omf-web/omf_web.yml
|
297
285
|
- example/NOT_WORKING/basic/hello-world-wired.rb
|
@@ -493,6 +481,7 @@ files:
|
|
493
481
|
- share/htdocs/graph/img/stacked_line_chart.png
|
494
482
|
- share/htdocs/graph/img/table.png
|
495
483
|
- share/htdocs/graph/js/abstract_chart.js
|
484
|
+
- share/htdocs/graph/js/abstract_multiple_datasource_chart.js
|
496
485
|
- share/htdocs/graph/js/abstract_nv_chart.js
|
497
486
|
- share/htdocs/graph/js/abstract_widget.js
|
498
487
|
- share/htdocs/graph/js/axis.js
|
@@ -2435,29 +2424,35 @@ files:
|
|
2435
2424
|
- share/htdocs/vendor/valums-file-uploader-cf7bfb1/tests/test-drop-zone.htm
|
2436
2425
|
- share/htdocs/vendor/valums-file-uploader-cf7bfb1/tests/test-handler-queue.htm
|
2437
2426
|
- share/htdocs/vendor/valums-file-uploader-cf7bfb1/tests/test-upload-handlers.htm
|
2427
|
+
has_rdoc: true
|
2438
2428
|
homepage: https://www.mytestbed.net
|
2439
2429
|
licenses: []
|
2430
|
+
|
2440
2431
|
post_install_message:
|
2441
2432
|
rdoc_options: []
|
2442
|
-
|
2433
|
+
|
2434
|
+
require_paths:
|
2443
2435
|
- lib
|
2444
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
2445
|
-
|
2446
|
-
|
2447
|
-
|
2448
|
-
|
2449
|
-
|
2450
|
-
|
2451
|
-
|
2452
|
-
requirements:
|
2453
|
-
- -
|
2454
|
-
- !ruby/object:Gem::Version
|
2455
|
-
|
2436
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
2437
|
+
requirements:
|
2438
|
+
- - ">="
|
2439
|
+
- !ruby/object:Gem::Version
|
2440
|
+
segments:
|
2441
|
+
- 0
|
2442
|
+
version: "0"
|
2443
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
2444
|
+
requirements:
|
2445
|
+
- - ">="
|
2446
|
+
- !ruby/object:Gem::Version
|
2447
|
+
segments:
|
2448
|
+
- 0
|
2449
|
+
version: "0"
|
2456
2450
|
requirements: []
|
2451
|
+
|
2457
2452
|
rubyforge_project: omf_web
|
2458
|
-
rubygems_version: 1.
|
2453
|
+
rubygems_version: 1.3.6
|
2459
2454
|
signing_key:
|
2460
2455
|
specification_version: 3
|
2461
2456
|
summary: OMF's web frontend.
|
2462
2457
|
test_files: []
|
2463
|
-
|
2458
|
+
|
@@ -1,27 +0,0 @@
|
|
1
|
-
|
2
|
-
site_description = {
|
3
|
-
id: 'top',
|
4
|
-
top_level: true,
|
5
|
-
type: 'layout/one_column',
|
6
|
-
widgets: [
|
7
|
-
name: "Welcome",
|
8
|
-
type: 'text',
|
9
|
-
content: {text: 'Hello World'}
|
10
|
-
]
|
11
|
-
}
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
# Configure the web server
|
16
|
-
#
|
17
|
-
opts = {
|
18
|
-
:app_name => 'tut01',
|
19
|
-
:page_title => 'Tutorial01: Hello World'
|
20
|
-
}
|
21
|
-
|
22
|
-
require 'omf_common/lobject'
|
23
|
-
OMF::Common::Loggable.init_log 'tut01'
|
24
|
-
|
25
|
-
require 'omf_web'
|
26
|
-
OMF::Web.register_widget(site_description)
|
27
|
-
OMF::Web.start(opts)
|
@@ -1,85 +0,0 @@
|
|
1
|
-
require 'omf_common/lobject'
|
2
|
-
require 'omf_web'
|
3
|
-
require 'omf_oml/table'
|
4
|
-
|
5
|
-
OMF::Common::Loggable.init_log 'tut02'
|
6
|
-
|
7
|
-
|
8
|
-
# Create a table containing 'amplitude' measurements taken at a certain time for two different
|
9
|
-
# devices.
|
10
|
-
#
|
11
|
-
schema = [[:t, :float], [:device, :string], [:amplitude, :float], [:x, :float], [:y, :float]]
|
12
|
-
table = OMF::OML::OmlTable.new 'generator', schema
|
13
|
-
|
14
|
-
# Register the table with the web framework
|
15
|
-
OMF::Web.register_datasource table
|
16
|
-
|
17
|
-
# Fill it with some data
|
18
|
-
samples = 30
|
19
|
-
ctxt = {
|
20
|
-
:timeOffset => Time.now.to_i,
|
21
|
-
:timeScale => 300, # Measure every 10 minutes
|
22
|
-
:radius => 10,
|
23
|
-
:fluctuation => 0.1, # max disturbance of sample
|
24
|
-
:rad => 2 * Math::PI / samples
|
25
|
-
}
|
26
|
-
|
27
|
-
def measure(i, table, ctxt)
|
28
|
-
t = ctxt[:timeOffset] + ctxt[:timeScale] * i
|
29
|
-
angle = i * ctxt[:rad]
|
30
|
-
measure_device('Gen 1', t, angle, table, ctxt)
|
31
|
-
measure_device('Gen 2', t, angle + ctxt[:rad] + 0.2 * (rand() - 0.5), table, ctxt)
|
32
|
-
end
|
33
|
-
|
34
|
-
def measure_device(name, t, angle, table, ctxt)
|
35
|
-
r = ctxt[:radius] * (1 + (rand() - 0.5) * ctxt[:fluctuation])
|
36
|
-
table.add_row [t, name, r, r * Math.sin(angle), r * Math.cos(angle)]
|
37
|
-
end
|
38
|
-
|
39
|
-
samples.times {|i| measure(i, table, ctxt) }
|
40
|
-
|
41
|
-
# Now describe a site with two widgets side by side, one showing the data
|
42
|
-
# in a table, and the other as a line graph
|
43
|
-
#
|
44
|
-
site_description = {
|
45
|
-
id: 'top',
|
46
|
-
top_level: true,
|
47
|
-
name: "Main",
|
48
|
-
type: 'layout/two_columns/50_50', # two columns equal width
|
49
|
-
left: [
|
50
|
-
name: 'Line Chart',
|
51
|
-
type: 'data/line_chart3',
|
52
|
-
data_source: { name: 'generator' },
|
53
|
-
mapping: {
|
54
|
-
x_axis: 't',
|
55
|
-
y_axis: {
|
56
|
-
property: 'x',
|
57
|
-
min: -10.5,
|
58
|
-
max: 10.5
|
59
|
-
},
|
60
|
-
group_by: 'device'
|
61
|
-
},
|
62
|
-
axis: {
|
63
|
-
x: {
|
64
|
-
ticks: { type: 'date', format: '%I:%M' },
|
65
|
-
legend: 'Time (hours)'
|
66
|
-
},
|
67
|
-
y: { legend: 'Voltage (V)' }
|
68
|
-
}
|
69
|
-
],
|
70
|
-
right: [
|
71
|
-
name: 'Table',
|
72
|
-
type: 'data/table2',
|
73
|
-
data_source: { name: 'generator' }
|
74
|
-
]
|
75
|
-
}
|
76
|
-
|
77
|
-
# Configure the web server
|
78
|
-
#
|
79
|
-
opts = {
|
80
|
-
:app_name => 'tut02',
|
81
|
-
:page_title => 'Tutorial02: Hello Graph'
|
82
|
-
}
|
83
|
-
|
84
|
-
OMF::Web.register_widget(site_description)
|
85
|
-
OMF::Web.start(opts)
|
@@ -1,69 +0,0 @@
|
|
1
|
-
require 'omf_common/lobject'
|
2
|
-
require 'omf_web'
|
3
|
-
require 'omf_oml/table'
|
4
|
-
require 'omf_oml/sql_source'
|
5
|
-
include OMF::OML
|
6
|
-
OMF::Common::Loggable.init_log 'tut03'
|
7
|
-
|
8
|
-
# Name of database to visualize
|
9
|
-
DB_URL = "sqlite://#{File.dirname(__FILE__)}/nmetric.sq3"
|
10
|
-
|
11
|
-
# Create a table containing measurements fetched from a database
|
12
|
-
# devices.
|
13
|
-
#
|
14
|
-
ep = OMF::OML::OmlSqlSource.new(DB_URL)
|
15
|
-
opts = {
|
16
|
-
max_size: 1000, # max rows to maintain in table (FIFO)
|
17
|
-
include_oml_internals: false, # don't add the OML header columns to the table
|
18
|
-
limit: 100, # to slow things down, fetch 100 rows at a time
|
19
|
-
query_interval: 0.5 # ... and wait that many seconds before fetching the next batch
|
20
|
-
}
|
21
|
-
ds = ep.create_table('traffic', opts)
|
22
|
-
OMF::Web.register_datasource ds
|
23
|
-
|
24
|
-
# Now describe a site with two widgets side by side, one showing the data
|
25
|
-
# in a table, and the other as a line graph
|
26
|
-
#
|
27
|
-
site_description = {
|
28
|
-
id: 'top',
|
29
|
-
top_level: true,
|
30
|
-
name: "Main",
|
31
|
-
type: 'layout/two_columns/50_50', # two columns equal width
|
32
|
-
left: [
|
33
|
-
name: 'Line Chart',
|
34
|
-
type: 'data/line_chart3',
|
35
|
-
data_source: { name: 'traffic' },
|
36
|
-
mapping: {
|
37
|
-
x_axis: 'ts',
|
38
|
-
y_axis: {
|
39
|
-
property: 'tx_byte_rate',
|
40
|
-
# min: -10.5,
|
41
|
-
# max: 10.5
|
42
|
-
},
|
43
|
-
group_by: 'name'
|
44
|
-
},
|
45
|
-
axis: {
|
46
|
-
x: {
|
47
|
-
#ticks: { type: 'date', format: '%I:%M' },
|
48
|
-
legend: 'Time (s)',
|
49
|
-
ticks: { format: ',s' }
|
50
|
-
},
|
51
|
-
y: { legend: 'Rate (bytes)', ticks: { format: ',s' }}
|
52
|
-
}
|
53
|
-
],
|
54
|
-
right: [
|
55
|
-
name: 'Table',
|
56
|
-
type: 'data/table2',
|
57
|
-
data_source: { name: 'traffic' }
|
58
|
-
]
|
59
|
-
}
|
60
|
-
|
61
|
-
# Configure the web server
|
62
|
-
#
|
63
|
-
opts = {
|
64
|
-
:app_name => 'tut02',
|
65
|
-
:page_title => 'Tutorial03: Hello Database'
|
66
|
-
}
|
67
|
-
|
68
|
-
OMF::Web.register_widget(site_description)
|
69
|
-
OMF::Web.start(opts)
|