2 var SensLabMap = Plugin.extend({
3 init: function(options, element) {
4 this._super(options, element);
6 this.elmt().on('show', this, this.on_show);
8 var query = manifold.query_store.find_analyzed_query(options.query_uuid);
9 this.method = query.object;
10 this.key = manifold.metadata.get_key(this.method);
12 /* Setup query and record handlers */
13 this.listen_query(options.query_uuid);
14 this.listen_query(options.query_all_uuid, 'all');
20 on_show: function(e) {
24 on_all_new_record: function(node) {
25 Senslab.normalize(node);
26 if (node.normalized) {
28 if ($.inArray(site, this.sites) == -1) {
29 this.sites.push(site);
30 this.nodes[site] = [];
32 this.nodes[site].push(node);
34 // xxx would need a smarter way to report these only on nodes that deserve it
35 // these messages are all over the place in a PL setup and tend to hide helpful signal
36 // console.warn("node has no site:");
37 // console.warn(node);
41 on_all_query_done: function() {
42 var uuid = this.options.query_uuid;
45 Senslab.createMaps($("#maps-container"), this.sites, this.nodes);
46 Senslab.notify = function(node) {
47 manifold.raise_event(uuid, node.selected ? SET_ADD : SET_REMOVED, node[key]);
51 $.plugin('SensLabMap', SensLabMap);