X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fsenslabmap%2Fstatic%2Fjs%2Fsenslabmap.js;h=e6a64b5814fc59e9789e6c25896f2db4c5cea5ce;hb=91dec1137db6f3b461ab40542f06b5fa93a2efa5;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..e6a64b58 100644 --- a/plugins/senslabmap/static/js/senslabmap.js +++ b/plugins/senslabmap/static/js/senslabmap.js @@ -1,11 +1,14 @@ (function($){ var SensLabMap = Plugin.extend({ init: function(options, element) { + this.classname="senslabmap"; 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); @@ -29,22 +32,21 @@ } this.nodes[site].push(node); } else { - console.warn("node has no site:"); - console.warn(node); +// xxx would need a smarter way to report these only on nodes that deserve it +// these messages are all over the place in a PL setup and tend to hide helpful signal +// console.warn("node has no site:"); +// console.warn(node); } }, 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 uuid = this.options.query_uuid; + var key = this.key + + Senslab.createMaps($("#maps-container"), this.sites, this.nodes); + Senslab.notify = function(node) { + manifold.raise_event(uuid, node.selected ? SET_ADD : SET_REMOVED, node[key]); + } } }); $.plugin('SensLabMap', SensLabMap);