ef7007afe7529f68330e1c767ecf7b9f255ba0ad
[unfold.git] / plugins / senslabmap / static / js / senslabmap.js
1 (function($){
2   var SensLabMap = Plugin.extend({
3     init: function(options, element) {
4       this._super(options, element);
5       
6       this.elmt().on('show', this, this.on_show);
7       
8       this.method = query.object;
9       
10       /* Setup query and record handlers */
11       this.listen_query(options.query_uuid);
12       this.listen_query(options.query_all_uuid, 'all');
13
14       /* GUI setup and event binding */
15       this.initialize_map();
16     },
17     
18     initialize_map: function() {
19       this.nodes = [];
20     },
21
22     refresh: function() {
23       console.log("refresh");
24       myrender();
25     },
26     
27     on_show: function(e) {
28       e.data.refresh();
29     },
30     
31     on_all_new_record: function(n) {
32       // format is : [name, x, y, z, uid, state]
33       // state = "Busy", "Alive" or "Down"
34       node = [42, n.x, n.y, n.z, "bb40", "Alive"];
35       this.nodes.push(node);
36     },
37     
38     on_all_query_done: function() {
39       nodes = this.nodes;
40       init();
41       parseNodebox();
42     }
43   });
44   $.plugin('SensLabMap', SensLabMap);
45 })(jQuery);