Move payload type label in Debug window to meta data row

rather than (object) etc at start of actual payload.
This commit is contained in:
dceejay 2015-02-10 16:54:24 +00:00
parent 87a1818486
commit c6157687c9
2 changed files with 7 additions and 3 deletions

View File

@ -187,14 +187,16 @@
var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var topic = (o.topic||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var property = (o.property?o.property:'').replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var payload = (o.msg||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var payload = (o.msg||"()").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
var typ = payload.substring(0,payload.indexOf(')')+1);
payload = payload.substring(payload.indexOf(')')+1);
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'');
msg.innerHTML = '<span class="debug-message-date">'+
getTimestamp()+'</span>'+
'<span class="debug-message-name">['+name+']</span>'+
'<span class="debug-message-topic">'+
(o.topic?topic+' : ':'')+
(o.property?'[msg.'+property+']':'[msg]')+
(o.property?'[msg.'+property+']':'[msg]')+" : "+typ+
'</span>'+'<span class="debug-message-payload">'+
payload+'</span>';
var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5;

View File

@ -99,11 +99,13 @@ module.exports = function(RED) {
seen = null;
} else if (typeof msg.msg === "boolean") {
msg.msg = "(boolean) "+msg.msg.toString();
} else if (typeof msg.msg === "number") {
msg.msg = "(number) "+msg.msg.toString();
} else if (msg.msg === 0) {
msg.msg = "0";
} else if (msg.msg === null || typeof msg.msg === "undefined") {
msg.msg = "(undefined)";
}
} else { msg.msg = "(string) "+msg.msg; }
if (msg.msg.length > debuglength) {
msg.msg = msg.msg.substr(0,debuglength) +" ....";