add archive variable to desactivate the socket listening for the static timeLines
authorrougeronj
Fri, 23 Jan 2015 00:43:54 +0100
changeset 128 9f2334598088
parent 127 0386fb9efe27
child 129 7181e1f28eb0
add archive variable to desactivate the socket listening for the static timeLines
client/annotviz/app/annotsvizview.html
client/annotviz/app/js/annotstimeline.js
client/annotviz/app/js/annotsvizview.js
client/annotviz/app/js/utils.js
--- a/client/annotviz/app/annotsvizview.html	Fri Jan 23 00:10:09 2015 +0100
+++ b/client/annotviz/app/annotsvizview.html	Fri Jan 23 00:43:54 2015 +0100
@@ -26,8 +26,8 @@
 
 	    var pianorollChannel  = 'PIANOROLL';
 	    var annotationChannel = 'ANNOT';
-	    var eventCode = 'atelier2';
-	    var serverUrl = "http://172.16.0.20:8080";
+	    var eventCode = 'test_1';
+	    var serverUrl = "http://localhost:8080";
 	    var wsUri;
 	    
 	    if (window.location.protocol === 'file:') {
@@ -45,7 +45,6 @@
 	    	logger: logger
 	    });
 
-
         var annotsvizview = new annotviz.AnnotsVizView({
         	urlCategories: serverUrl + "/p/api/v1/event/" + eventCode,
         	logger: logger,
@@ -53,7 +52,9 @@
         	wsPianoroll: new annotviz.WsWrapper(wsUriPianoroll, logger),
         	wsAnnot: new annotviz.WsWrapper(wsUriAnnotation, logger),
         	timeBegin: 1421919000000,
-        	timeEnd: 1421951400000
+        	timeEnd: 1421951400000,
+        	eventCode: eventCode,
+            channel: annotationChannel
         });
 
 
--- a/client/annotviz/app/js/annotstimeline.js	Fri Jan 23 00:10:09 2015 +0100
+++ b/client/annotviz/app/js/annotstimeline.js	Fri Jan 23 00:43:54 2015 +0100
@@ -20,7 +20,8 @@
     serverUrl: 'http://127.0.0.1:8080',
     channel: 'ANNOT',
     maxPages: 1000,
-    showClockGraphics: true
+    showClockGraphics: true,
+    archive: false
 };
 
 
@@ -45,6 +46,7 @@
     this.annotCategories = opts.annotCategories;
 	this.startTs = options.startTs || Date.now();
     this.showClockGraphics = opts.showClockGraphics;
+    this.archive = opts.archive;
     
     this.circleX = opts.circleX || (this.width/2);
     this.circleY = opts.circleY || (this.height/2);
@@ -94,8 +96,6 @@
             { name: 'event_code', op: '==', val: eventCode} //eventcode
         ];
 
-        console.log(JSON.stringify({filters:filters}));
-
         url = url + '?q=' + JSON.stringify({filters:filters});
 
         var totalPage = 1;
@@ -107,7 +107,6 @@
                 var data = res.target.json;
                 /*jshint -W069 */
                 totalPage = Math.min(maxPages,parseInt(data['total_pages']));
-                console.log('DATA', data);
                 data.objects.forEach(function(annotation) {
                     _this.addAnnot(annotation);
                 });
@@ -234,15 +233,19 @@
     }
 
     this.init = function() {
-        ws.message(function(data) {
-            _this.addAnnot(data);
-        });
+    	if (!this.archive){
+	        ws.message(function(data) {
+	            _this.addAnnot(data);
+	        });
+    	}
 
     	if (this.showClockGraphics){this.initClockGraphics();}
     };
 
 
     this.start = function() {
+    	this.startTs = Date.now();
+        loadArchives();
     };
 
     this.refresh = function() {
@@ -250,7 +253,6 @@
     };
 
     this.stop = function(){
-    	console.log(this.cells);
     };
 
     return this;
--- a/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 00:10:09 2015 +0100
+++ b/client/annotviz/app/js/annotsvizview.js	Fri Jan 23 00:43:54 2015 +0100
@@ -32,6 +32,7 @@
 	this.height= opts.height;
     this.timeBegin = opts.timeBegin;
     this.timeEnd = opts.timeEnd;
+    this.annotCategories = [];
     
     Utils.getAnnotCategories(opts.urlCategories, this.annotCategories);
     
@@ -39,6 +40,8 @@
 	var wsAnnot = opts.wsAnnot;
 	var stageView = opts.stageView;
 	var currentTime = Date.now() + 3600*1000;
+	var eventCode = opts.eventCode;
+    var channel = opts.channel;
 
 	stageView.registerComponent(this);
 
@@ -56,14 +59,15 @@
         intervalHeight: 10,
         maxCellHeight: 70,
         radius: 200,
+        eventCode: eventCode,
+        channel: channel,
         annotCategories: this.annotCategories
     });
 	
     
     var timeLineDay1 = new AnnotsTimeLine.AnnotsTimeLine({
     	stageView : stageView,
-        logger: logger,
-        ws: new annotviz.WsWrapper(wsUriAnnotation, logger),
+        archive: true,
         xInit: 0,
         yInit: 0,
         width: 1024 - 200 - 200,
@@ -77,6 +81,8 @@
         maxCellHeight: (timeLineDay2.radius - timeLineDay2.radius*2/3)/4,
         radius: timeLineDay2.radius*2/3,
         annotCategories: this.annotCategories,
+        eventCode: eventCode,
+        channel: channel,
         showClockGraphics:false
     });
     
@@ -152,8 +158,6 @@
 		.endFill();
 	this.container.addChild(limiters);
 
-//	var doubleRollV = new DoubleRoll.DoubleRoll({});
-
 	this.init = function(){
 	};
 
--- a/client/annotviz/app/js/utils.js	Fri Jan 23 00:10:09 2015 +0100
+++ b/client/annotviz/app/js/utils.js	Fri Jan 23 00:43:54 2015 +0100
@@ -40,6 +40,9 @@
             }
             var categoriesJson = session.categories_json;
             annotCat.order = categoriesJson.order;
+            if (typeof(annotCat.order['default']) === 'undefined'){
+            	annotCat.order.push('default');
+            }
 			var catList = _.clone(categoriesJson.categories);
 			while(catList.length > 0) {
 				var cat = catList.pop();
@@ -58,8 +61,6 @@
             annotCat.defaultColor = categoriesJson.defaultColor || "#536991";
             annotCategories.push(annotCat);
         });
-        console.log(annotCategories);
-        annotCategories[0].order.push("default");
     });
 
     jsonLoader.load();