pulse_meter-dygraphs_visualizer 0.4.21 → 0.4.22
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Procfile +1 -1
- data/Rakefile +36 -13
- data/examples/basic_sensor_data.rb +3 -3
- data/lib/pulse_meter/dygraphs_visualize/coffee/application.coffee +0 -23
- data/lib/pulse_meter/dygraphs_visualize/coffee/presenters/widget.coffee +25 -1
- data/lib/pulse_meter/dygraphs_visualize/public/js/application.js +101 -92
- data/lib/pulse_meter/dygraphs_visualize/public/js/dygraph-combined.js +6 -2
- data/package.json +10 -0
- data/pulse_meter-dygraphs_visualizer.gemspec +1 -3
- metadata +3 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1d31aec95a53a78b4820805e035a9d1c1d10164
|
4
|
+
data.tar.gz: 2aeb9c3528fd6a103af9180379df8b4116270713
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d49cb50fe390c5862b9c7a8b6e4623a0266f2cef6afa54e382cb216912e8b0ff04f83eab660c0af0d24adc0bdcac3cc17108384e67d774c3c19d483e9815a787
|
7
|
+
data.tar.gz: 0a5816501bf62f0f0e87b7dc3ddae30ec9df45965a4e6b3647e0e515a1fde61b1dd48b20c0b9efbd2caf3f4eaa40b3a82bd09ad43345ab76d065a006afa510dd
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.3.
|
1
|
+
2.3.1
|
data/Procfile
CHANGED
data/Rakefile
CHANGED
@@ -1,10 +1,7 @@
|
|
1
1
|
#!/usr/bin/env rake
|
2
2
|
require 'bundler/gem_tasks'
|
3
|
-
require 'coffee-script'
|
4
3
|
require 'listen'
|
5
4
|
require 'rspec/core/rake_task'
|
6
|
-
require 'sprockets'
|
7
|
-
require 'tilt'
|
8
5
|
require 'yard'
|
9
6
|
require 'yard/rake/yardoc_task'
|
10
7
|
|
@@ -12,19 +9,44 @@ RSpec::Core::RakeTask.new(:spec)
|
|
12
9
|
|
13
10
|
YARD::Rake::YardocTask.new(:yard)
|
14
11
|
|
15
|
-
ROOT = File.dirname(__FILE__)
|
16
|
-
|
17
12
|
task :default => :spec
|
18
13
|
|
14
|
+
STDOUT.sync = true
|
15
|
+
|
19
16
|
namespace :coffee do
|
20
|
-
COFFEE_PATH = "
|
17
|
+
COFFEE_PATH = "lib/pulse_meter/dygraphs_visualize/coffee"
|
18
|
+
COFFEE_FILES = %w{
|
19
|
+
extensions
|
20
|
+
models/page_info
|
21
|
+
models/widget
|
22
|
+
models/dinamic_widget
|
23
|
+
models/sensor_info
|
24
|
+
collections/page_info_list
|
25
|
+
collections/sensor_info_list
|
26
|
+
collections/widget_list
|
27
|
+
presenters/widget
|
28
|
+
presenters/timeline
|
29
|
+
presenters/series
|
30
|
+
presenters/line
|
31
|
+
presenters/stack
|
32
|
+
views/page_title
|
33
|
+
views/page_titles
|
34
|
+
views/sensor_info_list
|
35
|
+
views/dynamic_chart
|
36
|
+
views/dynamic_widget
|
37
|
+
views/widget_chart
|
38
|
+
views/widget
|
39
|
+
views/widget_list
|
40
|
+
router
|
41
|
+
application
|
42
|
+
}.map{|f| "#{COFFEE_PATH}/#{f}.coffee"}.join(" ")
|
43
|
+
APP_JS = "lib/pulse_meter/dygraphs_visualize/public/js/application.js"
|
44
|
+
COFFEE_SCRIPT = "node_modules/coffee-script/bin/coffee"
|
21
45
|
|
22
46
|
def compile_js
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
data = env['application.coffee']
|
27
|
-
open("#{ROOT}/lib/pulse_meter/dygraphs_visualize/public/js/application.js", "w").write(data)
|
47
|
+
command = "cat #{COFFEE_FILES} | #{COFFEE_SCRIPT} --compile --bare --stdio > #{APP_JS}"
|
48
|
+
puts "running #{command}"
|
49
|
+
system(command)
|
28
50
|
puts "application.js compiled"
|
29
51
|
end
|
30
52
|
|
@@ -35,13 +57,15 @@ namespace :coffee do
|
|
35
57
|
|
36
58
|
desc "Watch coffee files and recomplile them immediately"
|
37
59
|
task :watch do
|
38
|
-
Listen.to(COFFEE_PATH) do |modified, added, removed|
|
60
|
+
listener = Listen.to(COFFEE_PATH) do |modified, added, removed|
|
39
61
|
puts "Modified: #{modified}" unless modified.empty?
|
40
62
|
puts "Added: #{added}" unless added.empty?
|
41
63
|
puts "Removed: #{removed}" unless removed.empty?
|
42
64
|
puts "Recompiling..."
|
43
65
|
compile_js
|
44
66
|
end
|
67
|
+
listener.start
|
68
|
+
sleep
|
45
69
|
end
|
46
70
|
end
|
47
71
|
|
@@ -51,4 +75,3 @@ namespace :yard do
|
|
51
75
|
system 'open', "#{ROOT}/doc/index.html"
|
52
76
|
end
|
53
77
|
end
|
54
|
-
|
@@ -1,7 +1,7 @@
|
|
1
1
|
$: << File.join(File.absolute_path(__FILE__), '..', 'lib')
|
2
2
|
|
3
3
|
require "pulse_meter_core"
|
4
|
-
|
4
|
+
|
5
5
|
PulseMeter.redis = Redis.new
|
6
6
|
|
7
7
|
cfg = PulseMeter::Sensor::Configuration.new(
|
@@ -80,9 +80,9 @@ cfg = PulseMeter::Sensor::Configuration.new(
|
|
80
80
|
while true
|
81
81
|
sleep(Random.rand)
|
82
82
|
STDERR.puts "tick"
|
83
|
-
cfg.lama_count(
|
83
|
+
cfg.lama_count(Random.rand(10_000_000))
|
84
84
|
cfg.lama_count_1min(10)
|
85
|
-
cfg.rhino_count(
|
85
|
+
cfg.rhino_count(-Random.rand(10_000))
|
86
86
|
cfg.lama_average_age(Random.rand(50))
|
87
87
|
cfg.rhino_average_age(Random.rand(100))
|
88
88
|
|
@@ -1,26 +1,3 @@
|
|
1
|
-
#= require extensions
|
2
|
-
#= require models/page_info
|
3
|
-
#= require models/widget
|
4
|
-
#= require models/dinamic_widget
|
5
|
-
#= require models/sensor_info
|
6
|
-
#= require collections/page_info_list
|
7
|
-
#= require collections/sensor_info_list
|
8
|
-
#= require collections/widget_list
|
9
|
-
#= require presenters/widget
|
10
|
-
#= require presenters/timeline
|
11
|
-
#= require presenters/series
|
12
|
-
#= require presenters/line
|
13
|
-
#= require presenters/stack
|
14
|
-
#= require views/page_title
|
15
|
-
#= require views/page_titles
|
16
|
-
#= require views/sensor_info_list
|
17
|
-
#= require views/dynamic_chart
|
18
|
-
#= require views/dynamic_widget
|
19
|
-
#= require views/widget_chart
|
20
|
-
#= require views/widget
|
21
|
-
#= require views/widget_list
|
22
|
-
#= require router
|
23
|
-
|
24
1
|
document.startApp = ->
|
25
2
|
pageInfos = new PageInfoList
|
26
3
|
pageTitlesApp = new PageTitlesView(pageInfos)
|
@@ -14,7 +14,7 @@ class WidgetPresenter
|
|
14
14
|
(new Date).getTimezoneOffset() * 60000
|
15
15
|
else
|
16
16
|
0
|
17
|
-
|
17
|
+
|
18
18
|
options: -> {
|
19
19
|
labelsDiv: @legendEl
|
20
20
|
labelsSeparateLines: false
|
@@ -25,6 +25,14 @@ class WidgetPresenter
|
|
25
25
|
strokeWidth: 2
|
26
26
|
strokeBorderWidth: 1
|
27
27
|
highlightCircleSize: 5
|
28
|
+
|
29
|
+
axisLabelWidth: 80
|
30
|
+
|
31
|
+
axes:
|
32
|
+
y:
|
33
|
+
valueFormatter: (x) -> x
|
34
|
+
axisLabelFormatter: (x) => @formatValueLabel(x)
|
35
|
+
|
28
36
|
}
|
29
37
|
|
30
38
|
mergedOptions: ->
|
@@ -42,6 +50,22 @@ class WidgetPresenter
|
|
42
50
|
|
43
51
|
data: -> new google.visualization.DataTable
|
44
52
|
|
53
|
+
formatValueLabel: (v) ->
|
54
|
+
sign = if v < 0 then "-" else ""
|
55
|
+
absv = Math.abs(v)
|
56
|
+
if absv >= 1000000000
|
57
|
+
v.toPrecision(4)
|
58
|
+
else
|
59
|
+
if absv >= 1000000
|
60
|
+
"#{sign}#{Math.floor(absv / 1000000)}kk"
|
61
|
+
else
|
62
|
+
if absv >= 1000
|
63
|
+
"#{sign}#{Math.floor(absv / 1000)}k"
|
64
|
+
else
|
65
|
+
v
|
66
|
+
|
67
|
+
|
68
|
+
|
45
69
|
draw: ->
|
46
70
|
@chart.draw @data(), @mergedOptions()
|
47
71
|
|
@@ -1,3 +1,7 @@
|
|
1
|
+
// Generated by CoffeeScript 1.11.0
|
2
|
+
var AppRouter, DynamicChartView, DynamicWidget, DynamicWidgetView, LinePresenter, PageInfo, PageInfoList, PageTitleView, PageTitlesView, SensorInfo, SensorInfoList, SensorInfoListView, SeriesPresenter, StackPresenter, TimelinePresenter, Widget, WidgetChartView, WidgetList, WidgetListView, WidgetPresenter, WidgetView,
|
3
|
+
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
4
|
+
hasProp = {}.hasOwnProperty;
|
1
5
|
|
2
6
|
String.prototype.capitalize = function() {
|
3
7
|
return this.charAt(0).toUpperCase() + this.slice(1);
|
@@ -17,7 +21,7 @@ Number.prototype.humanize = function() {
|
|
17
21
|
res = "";
|
18
22
|
s = interval % 60;
|
19
23
|
if (s > 0) {
|
20
|
-
res =
|
24
|
+
res = s + " s";
|
21
25
|
}
|
22
26
|
interval = (interval - s) / 60;
|
23
27
|
if (!(interval > 0)) {
|
@@ -25,7 +29,7 @@ Number.prototype.humanize = function() {
|
|
25
29
|
}
|
26
30
|
m = interval % 60;
|
27
31
|
if (m > 0) {
|
28
|
-
res = (
|
32
|
+
res = (m + " m " + res).strip();
|
29
33
|
}
|
30
34
|
interval = (interval - m) / 60;
|
31
35
|
if (!(interval > 0)) {
|
@@ -33,19 +37,17 @@ Number.prototype.humanize = function() {
|
|
33
37
|
}
|
34
38
|
h = interval % 24;
|
35
39
|
if (h > 0) {
|
36
|
-
res = (
|
40
|
+
res = (h + " h " + res).strip();
|
37
41
|
}
|
38
42
|
d = (interval - h) / 24;
|
39
43
|
if (d > 0) {
|
40
|
-
return (
|
44
|
+
return (d + " d " + res).strip();
|
41
45
|
} else {
|
42
46
|
return res;
|
43
47
|
}
|
44
48
|
};
|
45
|
-
var PageInfo;
|
46
49
|
|
47
50
|
PageInfo = Backbone.Model.extend({});
|
48
|
-
var Widget;
|
49
51
|
|
50
52
|
Widget = Backbone.Model.extend({
|
51
53
|
initialize: function() {
|
@@ -76,7 +78,7 @@ Widget = Backbone.Model.extend({
|
|
76
78
|
url: function() {
|
77
79
|
var timespan, url;
|
78
80
|
timespan = this.timespan();
|
79
|
-
url =
|
81
|
+
url = (this.collection.url()) + "/" + (this.get('id')) + "?";
|
80
82
|
if (!_.isNaN(timespan)) {
|
81
83
|
url += "×pan=" + timespan;
|
82
84
|
}
|
@@ -112,26 +114,30 @@ Widget = Backbone.Model.extend({
|
|
112
114
|
return this.updating = false;
|
113
115
|
},
|
114
116
|
forceUpdate: function() {
|
115
|
-
var xhr
|
116
|
-
_this = this;
|
117
|
+
var xhr;
|
117
118
|
if (this.updating) {
|
118
119
|
return;
|
119
120
|
}
|
120
121
|
this.updating = true;
|
121
122
|
xhr = this.fetch({
|
122
|
-
success: function(
|
123
|
-
return
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
return _this.updating = false;
|
128
|
-
});
|
129
|
-
return xhr.fail(function(xhr, textStatus, errorThrown) {
|
130
|
-
return console.log("xhr fail", _this.get('id'), textStatus, errorThrown);
|
123
|
+
success: (function(_this) {
|
124
|
+
return function(model, response) {
|
125
|
+
return _this.trigger('redraw');
|
126
|
+
};
|
127
|
+
})(this)
|
131
128
|
});
|
129
|
+
xhr.always((function(_this) {
|
130
|
+
return function() {
|
131
|
+
return _this.updating = false;
|
132
|
+
};
|
133
|
+
})(this));
|
134
|
+
return xhr.fail((function(_this) {
|
135
|
+
return function(xhr, textStatus, errorThrown) {
|
136
|
+
return console.log("xhr fail", _this.get('id'), textStatus, errorThrown);
|
137
|
+
};
|
138
|
+
})(this));
|
132
139
|
}
|
133
140
|
});
|
134
|
-
var DynamicWidget;
|
135
141
|
|
136
142
|
DynamicWidget = Backbone.Model.extend({
|
137
143
|
setStartTime: function(startTime) {
|
@@ -159,7 +165,7 @@ DynamicWidget = Backbone.Model.extend({
|
|
159
165
|
url: function() {
|
160
166
|
var timespan, url;
|
161
167
|
timespan = this.timespan();
|
162
|
-
url =
|
168
|
+
url = ROOT + "dynamic_widget?" + (this.sensorArgs()) + "&type=" + (this.get('type'));
|
163
169
|
if ((timespan != null) && !_.isNaN(timespan)) {
|
164
170
|
url += "×pan=" + timespan;
|
165
171
|
}
|
@@ -179,10 +185,8 @@ DynamicWidget = Backbone.Model.extend({
|
|
179
185
|
});
|
180
186
|
}
|
181
187
|
});
|
182
|
-
var SensorInfo;
|
183
188
|
|
184
189
|
SensorInfo = Backbone.Model.extend({});
|
185
|
-
var PageInfoList;
|
186
190
|
|
187
191
|
PageInfoList = Backbone.Collection.extend({
|
188
192
|
model: PageInfo,
|
@@ -207,7 +211,6 @@ PageInfoList = Backbone.Collection.extend({
|
|
207
211
|
});
|
208
212
|
}
|
209
213
|
});
|
210
|
-
var SensorInfoList;
|
211
214
|
|
212
215
|
SensorInfoList = Backbone.Collection.extend({
|
213
216
|
model: SensorInfo,
|
@@ -215,35 +218,33 @@ SensorInfoList = Backbone.Collection.extend({
|
|
215
218
|
return ROOT + 'sensors';
|
216
219
|
}
|
217
220
|
});
|
218
|
-
var WidgetList;
|
219
221
|
|
220
222
|
WidgetList = Backbone.Collection.extend({
|
221
223
|
model: Widget,
|
222
|
-
setContext: function(
|
223
|
-
this.pageInfos =
|
224
|
+
setContext: function(pageInfos1) {
|
225
|
+
this.pageInfos = pageInfos1;
|
224
226
|
},
|
225
227
|
url: function() {
|
226
228
|
return ROOT + 'pages/' + this.pageInfos.selected().id + '/widgets';
|
227
229
|
},
|
228
230
|
startPolling: function() {
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
231
|
+
return setInterval((function(_this) {
|
232
|
+
return function() {
|
233
|
+
if (_this.pageInfos.selected()) {
|
234
|
+
return _this.each(function(w) {
|
235
|
+
return w.refetch();
|
236
|
+
});
|
237
|
+
}
|
238
|
+
};
|
239
|
+
})(this), 200);
|
237
240
|
}
|
238
241
|
});
|
239
|
-
var WidgetPresenter;
|
240
242
|
|
241
243
|
WidgetPresenter = (function() {
|
242
|
-
|
243
|
-
|
244
|
-
this.
|
245
|
-
this.
|
246
|
-
this.el = el;
|
244
|
+
function WidgetPresenter(pageInfos1, model1, el1) {
|
245
|
+
this.pageInfos = pageInfos1;
|
246
|
+
this.model = model1;
|
247
|
+
this.el = el1;
|
247
248
|
this.chartEl = this.el.find('#chart')[0];
|
248
249
|
this.legendEl = this.el.find('#legend')[0];
|
249
250
|
this.chart = new Dygraph.GVizChart(this.chartEl);
|
@@ -276,6 +277,19 @@ WidgetPresenter = (function() {
|
|
276
277
|
strokeWidth: 2,
|
277
278
|
strokeBorderWidth: 1,
|
278
279
|
highlightCircleSize: 5
|
280
|
+
},
|
281
|
+
axisLabelWidth: 80,
|
282
|
+
axes: {
|
283
|
+
y: {
|
284
|
+
valueFormatter: function(x) {
|
285
|
+
return x;
|
286
|
+
},
|
287
|
+
axisLabelFormatter: (function(_this) {
|
288
|
+
return function(x) {
|
289
|
+
return _this.formatValueLabel(x);
|
290
|
+
};
|
291
|
+
})(this)
|
292
|
+
}
|
279
293
|
}
|
280
294
|
};
|
281
295
|
};
|
@@ -290,6 +304,25 @@ WidgetPresenter = (function() {
|
|
290
304
|
return new google.visualization.DataTable;
|
291
305
|
};
|
292
306
|
|
307
|
+
WidgetPresenter.prototype.formatValueLabel = function(v) {
|
308
|
+
var absv, sign;
|
309
|
+
sign = v < 0 ? "-" : "";
|
310
|
+
absv = Math.abs(v);
|
311
|
+
if (absv >= 1000000000) {
|
312
|
+
return v.toPrecision(4);
|
313
|
+
} else {
|
314
|
+
if (absv >= 1000000) {
|
315
|
+
return "" + sign + (Math.floor(absv / 1000000)) + "kk";
|
316
|
+
} else {
|
317
|
+
if (absv >= 1000) {
|
318
|
+
return "" + sign + (Math.floor(absv / 1000)) + "k";
|
319
|
+
} else {
|
320
|
+
return v;
|
321
|
+
}
|
322
|
+
}
|
323
|
+
}
|
324
|
+
};
|
325
|
+
|
293
326
|
WidgetPresenter.prototype.draw = function() {
|
294
327
|
return this.chart.draw(this.data(), this.mergedOptions());
|
295
328
|
};
|
@@ -302,19 +335,15 @@ WidgetPresenter.create = function(pageInfos, model, el) {
|
|
302
335
|
var presenterClass, type;
|
303
336
|
type = model.get('type');
|
304
337
|
if ((type != null) && type.match(/^\w+$/)) {
|
305
|
-
presenterClass = eval(
|
338
|
+
presenterClass = eval((type.capitalize()) + "Presenter");
|
306
339
|
return new presenterClass(pageInfos, model, el);
|
307
340
|
} else {
|
308
341
|
return null;
|
309
342
|
}
|
310
343
|
};
|
311
|
-
var TimelinePresenter,
|
312
|
-
__hasProp = {}.hasOwnProperty,
|
313
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
314
|
-
|
315
|
-
TimelinePresenter = (function(_super) {
|
316
344
|
|
317
|
-
|
345
|
+
TimelinePresenter = (function(superClass) {
|
346
|
+
extend(TimelinePresenter, superClass);
|
318
347
|
|
319
348
|
function TimelinePresenter() {
|
320
349
|
return TimelinePresenter.__super__.constructor.apply(this, arguments);
|
@@ -339,13 +368,9 @@ TimelinePresenter = (function(_super) {
|
|
339
368
|
return TimelinePresenter;
|
340
369
|
|
341
370
|
})(WidgetPresenter);
|
342
|
-
var SeriesPresenter,
|
343
|
-
__hasProp = {}.hasOwnProperty,
|
344
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
345
371
|
|
346
|
-
SeriesPresenter = (function(
|
347
|
-
|
348
|
-
__extends(SeriesPresenter, _super);
|
372
|
+
SeriesPresenter = (function(superClass) {
|
373
|
+
extend(SeriesPresenter, superClass);
|
349
374
|
|
350
375
|
function SeriesPresenter() {
|
351
376
|
return SeriesPresenter.__super__.constructor.apply(this, arguments);
|
@@ -363,7 +388,7 @@ SeriesPresenter = (function(_super) {
|
|
363
388
|
|
364
389
|
SeriesPresenter.prototype.valuesTitle = function() {
|
365
390
|
if (this.get('valuesTitle')) {
|
366
|
-
return
|
391
|
+
return (this.get('valuesTitle')) + " / " + (this.humanizedInterval());
|
367
392
|
} else {
|
368
393
|
return this.humanizedInterval();
|
369
394
|
}
|
@@ -382,13 +407,9 @@ SeriesPresenter = (function(_super) {
|
|
382
407
|
return SeriesPresenter;
|
383
408
|
|
384
409
|
})(TimelinePresenter);
|
385
|
-
var LinePresenter,
|
386
|
-
__hasProp = {}.hasOwnProperty,
|
387
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
388
|
-
|
389
|
-
LinePresenter = (function(_super) {
|
390
410
|
|
391
|
-
|
411
|
+
LinePresenter = (function(superClass) {
|
412
|
+
extend(LinePresenter, superClass);
|
392
413
|
|
393
414
|
function LinePresenter() {
|
394
415
|
return LinePresenter.__super__.constructor.apply(this, arguments);
|
@@ -397,13 +418,9 @@ LinePresenter = (function(_super) {
|
|
397
418
|
return LinePresenter;
|
398
419
|
|
399
420
|
})(SeriesPresenter);
|
400
|
-
var StackPresenter,
|
401
|
-
__hasProp = {}.hasOwnProperty,
|
402
|
-
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; };
|
403
421
|
|
404
|
-
StackPresenter = (function(
|
405
|
-
|
406
|
-
__extends(StackPresenter, _super);
|
422
|
+
StackPresenter = (function(superClass) {
|
423
|
+
extend(StackPresenter, superClass);
|
407
424
|
|
408
425
|
function StackPresenter() {
|
409
426
|
return StackPresenter.__super__.constructor.apply(this, arguments);
|
@@ -412,7 +429,6 @@ StackPresenter = (function(_super) {
|
|
412
429
|
return StackPresenter;
|
413
430
|
|
414
431
|
})(SeriesPresenter);
|
415
|
-
var PageTitleView;
|
416
432
|
|
417
433
|
PageTitleView = Backbone.View.extend({
|
418
434
|
tagName: 'li',
|
@@ -430,11 +446,10 @@ PageTitleView = Backbone.View.extend({
|
|
430
446
|
}
|
431
447
|
}
|
432
448
|
});
|
433
|
-
var PageTitlesView;
|
434
449
|
|
435
450
|
PageTitlesView = Backbone.View.extend({
|
436
|
-
initialize: function(
|
437
|
-
this.pageInfos =
|
451
|
+
initialize: function(pageInfos1) {
|
452
|
+
this.pageInfos = pageInfos1;
|
438
453
|
return this.pageInfos.bind('reset', this.render, this);
|
439
454
|
},
|
440
455
|
addOne: function(pageInfo) {
|
@@ -450,7 +465,6 @@ PageTitlesView = Backbone.View.extend({
|
|
450
465
|
return this.pageInfos.each(this.addOne);
|
451
466
|
}
|
452
467
|
});
|
453
|
-
var SensorInfoListView;
|
454
468
|
|
455
469
|
SensorInfoListView = Backbone.View.extend({
|
456
470
|
tagName: 'div',
|
@@ -480,7 +494,6 @@ SensorInfoListView = Backbone.View.extend({
|
|
480
494
|
});
|
481
495
|
}
|
482
496
|
});
|
483
|
-
var DynamicChartView;
|
484
497
|
|
485
498
|
DynamicChartView = Backbone.View.extend({
|
486
499
|
initialize: function(options) {
|
@@ -583,7 +596,6 @@ DynamicChartView = Backbone.View.extend({
|
|
583
596
|
return this.widget.forceUpdate();
|
584
597
|
}
|
585
598
|
});
|
586
|
-
var DynamicWidgetView;
|
587
599
|
|
588
600
|
DynamicWidgetView = Backbone.View.extend({
|
589
601
|
tagName: 'div',
|
@@ -645,7 +657,6 @@ DynamicWidgetView = Backbone.View.extend({
|
|
645
657
|
return this.chartView.update();
|
646
658
|
}
|
647
659
|
});
|
648
|
-
var WidgetChartView;
|
649
660
|
|
650
661
|
WidgetChartView = Backbone.View.extend({
|
651
662
|
tagName: 'div',
|
@@ -662,7 +673,6 @@ WidgetChartView = Backbone.View.extend({
|
|
662
673
|
return this.presenter = WidgetPresenter.create(this.pageInfos, this.model, this.$el);
|
663
674
|
}
|
664
675
|
});
|
665
|
-
var WidgetView;
|
666
676
|
|
667
677
|
WidgetView = Backbone.View.extend({
|
668
678
|
tagName: 'div',
|
@@ -762,7 +772,6 @@ WidgetView = Backbone.View.extend({
|
|
762
772
|
}
|
763
773
|
}
|
764
774
|
});
|
765
|
-
var WidgetListView;
|
766
775
|
|
767
776
|
WidgetListView = Backbone.View.extend({
|
768
777
|
initialize: function(options) {
|
@@ -771,28 +780,28 @@ WidgetListView = Backbone.View.extend({
|
|
771
780
|
return this.widgetList.bind('reset', this.render, this);
|
772
781
|
},
|
773
782
|
render: function() {
|
774
|
-
var container
|
775
|
-
_this = this;
|
783
|
+
var container;
|
776
784
|
container = $('#widgets');
|
777
785
|
container.empty();
|
778
|
-
return this.widgetList.each(function(
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
786
|
+
return this.widgetList.each((function(_this) {
|
787
|
+
return function(w) {
|
788
|
+
var view;
|
789
|
+
view = new WidgetView({
|
790
|
+
pageInfos: _this.pageInfos,
|
791
|
+
model: w
|
792
|
+
});
|
793
|
+
view.render();
|
794
|
+
container.append(view.el);
|
795
|
+
return view.renderChart();
|
796
|
+
};
|
797
|
+
})(this));
|
788
798
|
}
|
789
799
|
});
|
790
|
-
var AppRouter;
|
791
800
|
|
792
801
|
AppRouter = Backbone.Router.extend({
|
793
|
-
initialize: function(
|
794
|
-
this.pageInfos =
|
795
|
-
this.widgetList =
|
802
|
+
initialize: function(pageInfos1, widgetList1) {
|
803
|
+
this.pageInfos = pageInfos1;
|
804
|
+
this.widgetList = widgetList1;
|
796
805
|
},
|
797
806
|
routes: {
|
798
807
|
'pages/:id': 'getPage',
|