nutella_framework 0.4.29 → 0.4.30
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.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/framework_components/monitoring-interface/js/d3/ui/ui-connection-view.js +14 -0
- data/framework_components/monitoring-interface/js/view-controller/application-view-controller.js +5 -2
- data/framework_components/monitoring-interface/js/view-controller/instance-view-controller.js +1 -1
- data/framework_components/room-debugger/README.md +3 -0
- data/framework_components/room-debugger/css/bootstrap-theme.css +476 -0
- data/framework_components/room-debugger/css/bootstrap-theme.css.map +1 -0
- data/framework_components/room-debugger/css/bootstrap-theme.min.css +5 -0
- data/framework_components/room-debugger/css/bootstrap.css +6584 -0
- data/framework_components/room-debugger/css/bootstrap.css.map +1 -0
- data/framework_components/room-debugger/css/bootstrap.min.css +5 -0
- data/framework_components/room-debugger/fonts/glyphicons-halflings-regular.eot +0 -0
- data/framework_components/room-debugger/fonts/glyphicons-halflings-regular.svg +288 -0
- data/framework_components/room-debugger/fonts/glyphicons-halflings-regular.ttf +0 -0
- data/framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff +0 -0
- data/framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff2 +0 -0
- data/framework_components/room-debugger/index.html +204 -0
- data/framework_components/room-debugger/js/bootstrap.js +2317 -0
- data/framework_components/room-debugger/js/bootstrap.min.js +7 -0
- data/framework_components/room-debugger/js/jquery.min.js +5 -0
- data/framework_components/room-debugger/js/npm.js +13 -0
- data/framework_components/room-debugger/js/nutella_lib.js +5128 -0
- data/framework_components/room-debugger/main.css +4 -0
- data/framework_components/room-debugger/main.js +145 -0
- data/framework_components/room-debugger/nutella.json +6 -0
- data/framework_components/room-debugger/package.json +14 -0
- data/framework_components/room-debugger/room_places_simulator.js +74 -0
- data/nutella_framework.gemspec +26 -3
- metadata +25 -2
@@ -0,0 +1,145 @@
|
|
1
|
+
var queryParams = NUTELLA.parseURLParameters();
|
2
|
+
var componentId = NUTELLA.parseComponentId();
|
3
|
+
var run_id = queryParams.run_id;
|
4
|
+
var app_id = queryParams.app_id;
|
5
|
+
|
6
|
+
|
7
|
+
// Initialize nutella and interface
|
8
|
+
var nutella = NUTELLA.init(queryParams.broker, app_id, run_id, componentId);
|
9
|
+
$('.navbar-right').append("<li><a>"+queryParams.app_id+"</a></li>")
|
10
|
+
.append("<li><a>"+run_id+"</a></li>");
|
11
|
+
|
12
|
+
//$(window).scroll(function(){
|
13
|
+
// console.log('this');
|
14
|
+
//});
|
15
|
+
|
16
|
+
|
17
|
+
// PUB/SUB -------------------------------------------------------
|
18
|
+
|
19
|
+
|
20
|
+
// Publish
|
21
|
+
$("#publish_frm").submit(function(e) {
|
22
|
+
e.preventDefault();
|
23
|
+
var inputs = $('#publish_frm :input');
|
24
|
+
nutella.net.publish(inputs[0].value, inputs[1].value)
|
25
|
+
});
|
26
|
+
|
27
|
+
|
28
|
+
// Subscribe
|
29
|
+
$("#sub_frm").submit(function(e) {
|
30
|
+
e.preventDefault();
|
31
|
+
var channel = $('#sub_frm :input')[0];
|
32
|
+
$("#sub_list").append('<span class="label label-default">' + channel.value + '</span>').append(" ");
|
33
|
+
nutella.net.subscribe(channel.value, function(message, from){
|
34
|
+
appendMessage(channel.value, message, from);
|
35
|
+
});
|
36
|
+
});
|
37
|
+
|
38
|
+
|
39
|
+
// Unsubscribe
|
40
|
+
$("#sub_frm").on('click', ".label-default", function(e){
|
41
|
+
this.remove();
|
42
|
+
nutella.net.unsubscribe(this.innerText);
|
43
|
+
});
|
44
|
+
|
45
|
+
|
46
|
+
// Append messages to table
|
47
|
+
function appendMessage(channel, message, from) {
|
48
|
+
$("#messages").prepend('<tr><td>' + channel + '</td><td>' + message+ '</td><td>' + JSON.stringify(from) + '</td></tr>');
|
49
|
+
}
|
50
|
+
|
51
|
+
|
52
|
+
// Remove all messages
|
53
|
+
$("#remove_messages").click(function(){
|
54
|
+
console.log("pippo");
|
55
|
+
$("#messages tbody").empty();
|
56
|
+
});
|
57
|
+
|
58
|
+
|
59
|
+
// REQ/RES -------------------------------------------------------
|
60
|
+
|
61
|
+
|
62
|
+
// Request
|
63
|
+
$("#request_frm").submit(function(e) {
|
64
|
+
e.preventDefault();
|
65
|
+
var inputs = $('#request_frm :input');
|
66
|
+
nutella.net.request(inputs[0].value, inputs[1].value, function(res){
|
67
|
+
$("#response").text(res);
|
68
|
+
});
|
69
|
+
});
|
70
|
+
|
71
|
+
|
72
|
+
// Handle request
|
73
|
+
$("#handle_frm").submit(function(e) {
|
74
|
+
e.preventDefault();
|
75
|
+
if ($('#handle_btn').hasClass('btn-danger')) {
|
76
|
+
$('#handle_req_ch').prop('disabled', false);
|
77
|
+
$('#handle_req_cb').prop('disabled', false);
|
78
|
+
$('#handle_btn').removeClass('btn-danger').text('Handle request');
|
79
|
+
} else {
|
80
|
+
$('#handle_req_ch').prop('disabled', true);
|
81
|
+
$('#handle_req_cb').prop('disabled', true);
|
82
|
+
$('#handle_btn').addClass('btn-danger').text('Stop handling request');
|
83
|
+
var channel = $('#handle_req_ch').val();
|
84
|
+
var response = $('#handle_req_cb').val();
|
85
|
+
nutella.net.handle_requests(channel, function(req, from) {
|
86
|
+
return response;
|
87
|
+
});
|
88
|
+
}
|
89
|
+
});
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
// SIM -------------------------------------------------------
|
94
|
+
|
95
|
+
var rp_sim = new RoomPlacesSimulator(nutella);
|
96
|
+
|
97
|
+
|
98
|
+
nutella.location.ready(function() {
|
99
|
+
var resources = nutella.location.resources;
|
100
|
+
var hotspots = resources.filter(function(el){
|
101
|
+
return el.type==='STATIC';
|
102
|
+
}).map(function(el){
|
103
|
+
return el.rid;
|
104
|
+
});
|
105
|
+
var beacons = resources.filter(function(el){
|
106
|
+
return el.model==='IBEACON';
|
107
|
+
}).map(function(el){
|
108
|
+
return el.rid;
|
109
|
+
});
|
110
|
+
var minDistance = resources.filter(function(el){
|
111
|
+
return el.type==='STATIC';
|
112
|
+
}).map(function(el){
|
113
|
+
return el.proximity_range;
|
114
|
+
}).reduce(function(prev, cur){
|
115
|
+
return cur < prev ? cur : prev;
|
116
|
+
}, Infinity);
|
117
|
+
// Update UI
|
118
|
+
$("#beacon_ls").val(beacons.join(', '));
|
119
|
+
$("#hotsp_ls").val(hotspots.join(', '));
|
120
|
+
$("#distance_fr").val(Math.floor(minDistance / 3 * 100) / 100);
|
121
|
+
});
|
122
|
+
|
123
|
+
|
124
|
+
// Start / stop simulator
|
125
|
+
$("#sim_frm").submit(function(e) {
|
126
|
+
e.preventDefault();
|
127
|
+
if ($('#start_sim_btn').hasClass('btn-danger')) {
|
128
|
+
$("#beacon_ls").prop('disabled', false);
|
129
|
+
$("#hotsp_ls").prop('disabled', false);
|
130
|
+
$("#distance_fr").prop('disabled', false);
|
131
|
+
$('#start_sim_btn').removeClass('btn-danger').addClass('btn-success').text('Start simulator');
|
132
|
+
// Stop simulator
|
133
|
+
rp_sim.stop();
|
134
|
+
} else {
|
135
|
+
$("#beacon_ls").prop('disabled', true);
|
136
|
+
$("#hotsp_ls").prop('disabled', true);
|
137
|
+
$("#distance_fr").prop('disabled', true);
|
138
|
+
$('#start_sim_btn').removeClass('btn-success').addClass('btn-danger').text('Stop simulator');
|
139
|
+
// Configure and start simulator
|
140
|
+
rp_sim.setHotspots($("#hotsp_ls").val().split(", "));
|
141
|
+
rp_sim.setBeacons($("#beacon_ls").val().split(", "));
|
142
|
+
rp_sim.setDistance(parseFloat($("#distance_fr").val()));
|
143
|
+
rp_sim.start();
|
144
|
+
}
|
145
|
+
});
|
@@ -0,0 +1,14 @@
|
|
1
|
+
{
|
2
|
+
"name": "room-debugger",
|
3
|
+
"version": "1.0.0",
|
4
|
+
"description": "A debugger to help you build your nutella applications",
|
5
|
+
"main": "app/js/index.js",
|
6
|
+
"repository": "no-repo",
|
7
|
+
"author": "Alessandro Gnoli",
|
8
|
+
"license": "MIT",
|
9
|
+
"dependencies": {
|
10
|
+
"bootstrap": "^3.3.4",
|
11
|
+
"jquery": "^2.1.4",
|
12
|
+
"nutella_lib": "^0.5.10"
|
13
|
+
}
|
14
|
+
}
|
@@ -0,0 +1,74 @@
|
|
1
|
+
var RoomPlacesSimulator = function(nutella) {
|
2
|
+
this.nutella = nutella;
|
3
|
+
this.hotspots = [];
|
4
|
+
this.beacons = [];
|
5
|
+
this.distance = 0.01;
|
6
|
+
};
|
7
|
+
|
8
|
+
|
9
|
+
|
10
|
+
RoomPlacesSimulator.prototype.start = function() {
|
11
|
+
// Assign initial location
|
12
|
+
var hotspots = this.hotspots;
|
13
|
+
this.beacons.forEach((function(e,i) {
|
14
|
+
e.l = hotspots[Math.floor(Math.random()*hotspots.length)];
|
15
|
+
e.d = this.distance -0.1 + Math.random()*0.2;
|
16
|
+
//console.log("Initial location for " + e.b + " set to to " + e.l);
|
17
|
+
if (e.l != 'none')
|
18
|
+
this.publishLocation(e);
|
19
|
+
}).bind(this));
|
20
|
+
// Every second, send an update to the bot
|
21
|
+
// Location of only some beacons is changed though
|
22
|
+
this.interval = setInterval((function() {
|
23
|
+
this.beacons.forEach((function(e,i) {
|
24
|
+
// Change location for a small percentage
|
25
|
+
if(Math.random()>0.93) {
|
26
|
+
e.l = hotspots[Math.floor(Math.random()*hotspots.length)];
|
27
|
+
e.d = this.distance -0.1 + Math.random()*0.2;
|
28
|
+
console.log(e.b + " moved to " + e.l);
|
29
|
+
}
|
30
|
+
if (e.l != 'none')
|
31
|
+
this.publishLocation(e);
|
32
|
+
}).bind(this));
|
33
|
+
}).bind(this), 1000);
|
34
|
+
};
|
35
|
+
|
36
|
+
|
37
|
+
RoomPlacesSimulator.prototype.stop = function() {
|
38
|
+
clearInterval(this.interval);
|
39
|
+
};
|
40
|
+
|
41
|
+
|
42
|
+
|
43
|
+
RoomPlacesSimulator.prototype.setHotspots = function(hotspots) {
|
44
|
+
this.hotspots = hotspots;
|
45
|
+
this.hotspots.push('none');
|
46
|
+
};
|
47
|
+
|
48
|
+
RoomPlacesSimulator.prototype.setBeacons = function(beacons) {
|
49
|
+
beacons.forEach((function(e){
|
50
|
+
this.beacons.push({b: e, l: 'none'});
|
51
|
+
}).bind(this));
|
52
|
+
};
|
53
|
+
|
54
|
+
RoomPlacesSimulator.prototype.setDistance = function(distance) {
|
55
|
+
this.distance = distance;
|
56
|
+
};
|
57
|
+
|
58
|
+
|
59
|
+
// Function to generate location update
|
60
|
+
RoomPlacesSimulator.prototype.publishLocation = function(beacon) {
|
61
|
+
var message = {
|
62
|
+
rid : beacon.b,
|
63
|
+
proximity: {
|
64
|
+
rid: beacon.l,
|
65
|
+
distance: beacon.d
|
66
|
+
}
|
67
|
+
};
|
68
|
+
this.nutella.net.publish('location/resource/update', message);
|
69
|
+
};
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
|
data/nutella_framework.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: nutella_framework 0.4.
|
5
|
+
# stub: nutella_framework 0.4.30 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "nutella_framework"
|
9
|
-
s.version = "0.4.
|
9
|
+
s.version = "0.4.30"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib"]
|
13
13
|
s.authors = ["Alessandro Gnoli"]
|
14
|
-
s.date = "2015-05-
|
14
|
+
s.date = "2015-05-18"
|
15
15
|
s.description = "utella is a framework to create and run RoomApps"
|
16
16
|
s.email = "tebemis@gmail.com"
|
17
17
|
s.executables = ["nutella"]
|
@@ -212,6 +212,29 @@ Gem::Specification.new do |s|
|
|
212
212
|
"framework_components/monitoring-interface/js/view-controller/window-view-controller.js",
|
213
213
|
"framework_components/monitoring-interface/nutella.json",
|
214
214
|
"framework_components/order.json",
|
215
|
+
"framework_components/room-debugger/README.md",
|
216
|
+
"framework_components/room-debugger/css/bootstrap-theme.css",
|
217
|
+
"framework_components/room-debugger/css/bootstrap-theme.css.map",
|
218
|
+
"framework_components/room-debugger/css/bootstrap-theme.min.css",
|
219
|
+
"framework_components/room-debugger/css/bootstrap.css",
|
220
|
+
"framework_components/room-debugger/css/bootstrap.css.map",
|
221
|
+
"framework_components/room-debugger/css/bootstrap.min.css",
|
222
|
+
"framework_components/room-debugger/fonts/glyphicons-halflings-regular.eot",
|
223
|
+
"framework_components/room-debugger/fonts/glyphicons-halflings-regular.svg",
|
224
|
+
"framework_components/room-debugger/fonts/glyphicons-halflings-regular.ttf",
|
225
|
+
"framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff",
|
226
|
+
"framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff2",
|
227
|
+
"framework_components/room-debugger/index.html",
|
228
|
+
"framework_components/room-debugger/js/bootstrap.js",
|
229
|
+
"framework_components/room-debugger/js/bootstrap.min.js",
|
230
|
+
"framework_components/room-debugger/js/jquery.min.js",
|
231
|
+
"framework_components/room-debugger/js/npm.js",
|
232
|
+
"framework_components/room-debugger/js/nutella_lib.js",
|
233
|
+
"framework_components/room-debugger/main.css",
|
234
|
+
"framework_components/room-debugger/main.js",
|
235
|
+
"framework_components/room-debugger/nutella.json",
|
236
|
+
"framework_components/room-debugger/package.json",
|
237
|
+
"framework_components/room-debugger/room_places_simulator.js",
|
215
238
|
"framework_components/room-places-bot/.gitignore",
|
216
239
|
"framework_components/room-places-bot/Gemfile",
|
217
240
|
"framework_components/room-places-bot/README.md",
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nutella_framework
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.30
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Gnoli
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: semantic
|
@@ -475,6 +475,29 @@ files:
|
|
475
475
|
- framework_components/monitoring-interface/js/view-controller/window-view-controller.js
|
476
476
|
- framework_components/monitoring-interface/nutella.json
|
477
477
|
- framework_components/order.json
|
478
|
+
- framework_components/room-debugger/README.md
|
479
|
+
- framework_components/room-debugger/css/bootstrap-theme.css
|
480
|
+
- framework_components/room-debugger/css/bootstrap-theme.css.map
|
481
|
+
- framework_components/room-debugger/css/bootstrap-theme.min.css
|
482
|
+
- framework_components/room-debugger/css/bootstrap.css
|
483
|
+
- framework_components/room-debugger/css/bootstrap.css.map
|
484
|
+
- framework_components/room-debugger/css/bootstrap.min.css
|
485
|
+
- framework_components/room-debugger/fonts/glyphicons-halflings-regular.eot
|
486
|
+
- framework_components/room-debugger/fonts/glyphicons-halflings-regular.svg
|
487
|
+
- framework_components/room-debugger/fonts/glyphicons-halflings-regular.ttf
|
488
|
+
- framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff
|
489
|
+
- framework_components/room-debugger/fonts/glyphicons-halflings-regular.woff2
|
490
|
+
- framework_components/room-debugger/index.html
|
491
|
+
- framework_components/room-debugger/js/bootstrap.js
|
492
|
+
- framework_components/room-debugger/js/bootstrap.min.js
|
493
|
+
- framework_components/room-debugger/js/jquery.min.js
|
494
|
+
- framework_components/room-debugger/js/npm.js
|
495
|
+
- framework_components/room-debugger/js/nutella_lib.js
|
496
|
+
- framework_components/room-debugger/main.css
|
497
|
+
- framework_components/room-debugger/main.js
|
498
|
+
- framework_components/room-debugger/nutella.json
|
499
|
+
- framework_components/room-debugger/package.json
|
500
|
+
- framework_components/room-debugger/room_places_simulator.js
|
478
501
|
- framework_components/room-places-bot/.gitignore
|
479
502
|
- framework_components/room-places-bot/Gemfile
|
480
503
|
- framework_components/room-places-bot/README.md
|