From 5c2e9d27f81778d7d5e98c9a9d486b0968a97c86 Mon Sep 17 00:00:00 2001
From: Anthony Garcia <anthony.garcia@inria.fr>
Date: Fri, 27 Sep 2013 19:11:24 +0200
Subject: [PATCH] first try to display dynamic positions, not tested yet

---
 plugins/senslabmap/static/js/senslabmap.js | 40 ++++++----------------
 1 file changed, 10 insertions(+), 30 deletions(-)

diff --git a/plugins/senslabmap/static/js/senslabmap.js b/plugins/senslabmap/static/js/senslabmap.js
index 71de05a5..ef7007af 100644
--- a/plugins/senslabmap/static/js/senslabmap.js
+++ b/plugins/senslabmap/static/js/senslabmap.js
@@ -16,11 +16,7 @@
     },
     
     initialize_map: function() {
-      console.log("init toto");
-      // TODO: this is static, retrieve directly nodes
-      nodes = nodes_gre;
-      init();
-      parseNodebox();
+      this.nodes = [];
     },
 
     refresh: function() {
@@ -29,36 +25,20 @@
     },
     
     on_show: function(e) {
-      /* GUI setup and event binding */
       e.data.refresh();
     },
     
-    on_all_new_record: function(record) {
-      console.log("All New Record : " + record);
-    },
-    
-    on_new_record: function(record) {
-      console.log("New Record : " + record);
-    },
-
-    on_query_in_progress: function()
-    {
-      console.log('on_query_in_progress');
+    on_all_new_record: function(n) {
+      // format is : [name, x, y, z, uid, state]
+      // state = "Busy", "Alive" or "Down"
+      node = [42, n.x, n.y, n.z, "bb40", "Alive"];
+      this.nodes.push(node);
     },
     
-    on_query_done: function()
-    {
-      console.log('on_query_done');
-    },
-
-    on_all_query_in_progress: function()
-    {
-      console.log('on_all_query_in_progress');
-    },
-    
-    on_all_query_done: function()
-    {
-      console.log('on_all_query_done');
+    on_all_query_done: function() {
+      nodes = this.nodes;
+      init();
+      parseNodebox();
     }
   });
   $.plugin('SensLabMap', SensLabMap);
-- 
2.47.0