Towards MKWS-375.
[mkws-moved-to-github.git] / src / mkws-widget-main.js
index 5438348..2a68283 100644 (file)
@@ -25,7 +25,7 @@ mkws.registerWidgetType('targets', function() {
       cur.diagnostic = data[i].diagnostic;
       cur.message = data[i].message;
       cur.records = data[i].records;
-      cur.state = data[i].state;
+      cur.state = data[i].state.replace(/^Client_/, '');
       cleandata.push(cur);
     }
 
@@ -114,7 +114,13 @@ mkws.registerWidgetType('records', function() {
   var that = this;
   var team = this.team;
 
+  this.team.queue("searchtriggered").subscribe(function() {
+    var op = that.config.newsearch_opacity;
+    if (op !== undefined) { that.node.fadeTo(500, op); }
+  });
+
   this.team.queue("records").subscribe(function(data) {
+    that.node.css('opacity', 1);
     for (var i = 0; i < data.hits.length; i++) {
       var hit = data.hits[i];
       hit.detailLinkId = team.recordElementId(hit.recid[0]);
@@ -259,7 +265,7 @@ mkws.registerWidgetType('ranking', function() {
     var cur = {};
     var opt = this.config.sort_options[i];
     cur.key = opt[0];
-    cur.label = opt.length == 1 ? opt[0] : opt[1];
+    cur.label = opt.length == 1 ? opt[0] : mkws.M(opt[1]);
     if (order == cur.key || order == cur.label) cur.selected = true;
     output.sort.push(cur);
   }
@@ -378,6 +384,22 @@ mkws.registerWidgetType('progress', function() {
 });
 
 
+mkws.registerWidgetType('waiting', function() {
+  var that = this;
+
+  this.node.css("visibility", "hidden");
+  var src = this.config.src || "http://mkws.indexdata.com/progress.gif";
+  this.node.html('<img src="' + src + '"/>');
+
+  this.team.queue("searchtriggered").subscribe(function(data) {
+    that.node.css("visibility", "visible");
+  });
+  this.team.queue("complete").subscribe(function(n) {
+    that.node.css("visibility", "hidden");
+  });
+});
+
+
 // Some elements have mkws* classes that makes them appear as widgets
 // -- for example, because we want to style them using CSS -- but have
 // no actual functionality. We register these to prevent ignorable