X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fsenslabmap%2Fstatic%2Fjs%2Fsenslabmap.js;h=3303c3af06c56d76813d141ce93b62b93b4d18a6;hb=c53dc9c19c4b4832d1258cb392774909b6d9a755;hp=6ba92eeac9bcc9968fd1d617acf90719ea6eaff2;hpb=d9f4308af59ebad956edf64c1051694d5322251e;p=myslice.git diff --git a/plugins/senslabmap/static/js/senslabmap.js b/plugins/senslabmap/static/js/senslabmap.js index 6ba92eea..3303c3af 100644 --- a/plugins/senslabmap/static/js/senslabmap.js +++ b/plugins/senslabmap/static/js/senslabmap.js @@ -15,40 +15,35 @@ this.nodes = {}; }, - refresh: function() { - console.log("refresh"); - }, - on_show: function(e) { e.data.refresh(); }, on_all_new_record: function(node) { Senslab.normalize(node); - var site = node.site; - if (site) { + if (node.normalized) { + var site = node.site; if ($.inArray(site, this.sites) == -1) { this.sites.push(site); this.nodes[site] = []; } this.nodes[site].push(node); } else { + console.warn("node has no site:"); console.warn(node); - console.warn("-> has no site"); } }, 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.component_id + ); + } } }); $.plugin('SensLabMap', SensLabMap);