X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fmkws-widget-main.js;h=91c2d9311ca8e48a0ac75087e895ed8087bddab6;hb=9d552877ef9bfbb92887942b9ac1870ddd12ba58;hp=03eba2ead21cf36686b9f77cbda1e9b92516c301;hpb=86229ffbb4ef43e4f028c1f59fa93dc5b2285770;p=mkws-moved-to-github.git
diff --git a/src/mkws-widget-main.js b/src/mkws-widget-main.js
index 03eba2e..91c2d93 100644
--- a/src/mkws-widget-main.js
+++ b/src/mkws-widget-main.js
@@ -6,43 +6,34 @@
mkws.registerWidgetType('Targets', function() {
if (!this.config.show_switch) return;
var that = this;
- var M = mkws.M;
this.node.html('No information available yet.');
this.node.css("display", "none");
this.team.queue("targets").subscribe(function(data) {
- var table ='
' +
- '' + M('Target ID') + ' | ' +
- '' + M('Hits') + ' | ' +
- '' + M('Diags') + ' | ' +
- '' + M('Records') + ' | ' +
- '' + M('State') + ' | ' +
- '
';
-
+ // There is a bug in pz2.js
+ var cleandata = [];
for (var i = 0; i < data.length; i++) {
- table += "" + data[i].id +
- " | " + data[i].hits +
- " | " + data[i].diagnostic +
- " | " + data[i].records +
- " | " + data[i].state + " |
";
+ var cur = {};
+ cur.id = data[i].id;
+ cur.hits = data[i].hits;
+ cur.diagnostic = data[i].diagnostic;
+ cur.records = data[i].records;
+ cur.state = data[i].state;
+ cleandata.push(cur);
}
- table += '
';
- that.node.html(table);
+ var template = that.team.loadTemplate(that.config.template || "Targets");
+ that.node.html(template({data: cleandata}));
});
});
mkws.registerWidgetType('Stat', function() {
var that = this;
- var M = mkws.M;
-
this.team.queue("stat").subscribe(function(data) {
- that.node.html(' -- ' +
- '' + M('Active clients') + ': ' + data.activeclients + '/' + data.clients + '' +
- ' -- ' +
- M('Retrieved records') + ': ' + data.records + '/' + data.hits);
+ var template = that.team.loadTemplate(that.config.template || "Stat");
+ that.node.html(template(data));
});
});
@@ -134,7 +125,8 @@ mkws.registerWidgetType('Records', function() {
}
}
var template = team.loadTemplate(that.config.template || "Records");
- that.node.html(template({"hits": data.hits}));
+ var targs = $.extend({}, {"hits": data.hits}, that.config.template_vars);
+ that.node.html(template(targs));
});
that.autosearch();
@@ -410,7 +402,7 @@ mkws.registerWidgetType('Config', function() {
var c = this.config;
for (var name in c) {
if (c.hasOwnProperty(name)) {
- this.team.config()[name] = c[name];
+ this.team.config[name] = c[name];
this.log(this + " copied property " + name + "='" + c[name] + "' up to team");
}
}
@@ -428,7 +420,7 @@ mkws.registerWidgetType('Progress', function() {
s += '';
s += '';
}
- s += '█';
+ s += '█';
}
s += '';
that.node.html(s);
@@ -445,6 +437,5 @@ mkws.registerWidgetType('Progress', function() {
mkws.registerWidgetType('Query', function() {});
mkws.registerWidgetType('MOTDContainer', function() {});
mkws.registerWidgetType('Button', function() {});
-mkws.registerWidgetType('Popup', function() {});