X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fsenslabmap%2Fstatic%2Fjs%2Fsenslabmap.js;h=a306219361a857b7e348b962cd286d1c53d3991d;hb=fd13b08e5ae01e312431803eb1faf38a1589c4b9;hp=3b92490b57b3332009a54c9b19a8483d5c5c263d;hpb=54cf44ac08f8b60dd315a0fc5ced1cb6604aa49a;p=myslice.git diff --git a/plugins/senslabmap/static/js/senslabmap.js b/plugins/senslabmap/static/js/senslabmap.js index 3b92490b..a3062193 100644 --- a/plugins/senslabmap/static/js/senslabmap.js +++ b/plugins/senslabmap/static/js/senslabmap.js @@ -4,8 +4,10 @@ this._super(options, element); this.elmt().on('show', this, this.on_show); - + + var query = manifold.query_store.find_analyzed_query(options.query_uuid); this.method = query.object; + this.key = manifold.metadata.get_key(this.method); /* Setup query and record handlers */ this.listen_query(options.query_uuid); @@ -35,16 +37,15 @@ }, on_all_query_done: function() { - var - self = this, - maps = {}, - $container = $('#maps-container'); - - $.each(this.sites, function(i, site) { - var $div = $("
").appendTo($container); - maps[site] = new Senslab.Map($div); - maps[site].addNodes(self.nodes[site]); - }); + var self = this; + + Senslab.createMaps($('#maps-container'), this.sites, this.nodes); + Senslab.notify = function(node) { + manifold.raise_event(self.options.query_uuid, + node.boot_state == "Alive" ? SET_REMOVED : SET_ADD, + node[self.key] + ); + } } }); $.plugin('SensLabMap', SensLabMap);