1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Improve debug message meta data contrast and legibility

This commit is contained in:
Nick O'Leary 2016-11-16 15:05:04 +00:00
parent be18cc9f2d
commit 1fd87bf664
2 changed files with 14 additions and 16 deletions

View File

@ -51,24 +51,21 @@
border-right: 8px solid #eee; border-right: 8px solid #eee;
padding: 2px; padding: 2px;
} }
.debug-message-date { .debug-message-meta {
background: #fff; background: #fff;
font-size: 9px; font-size: 10px;
color: #aaa; color: #777;
}
.debug-message-date {
padding: 1px 5px 1px 1px; padding: 1px 5px 1px 1px;
} }
.debug-message-topic { .debug-message-topic {
display: block; display: block;
background: #fff;
padding: 1px;
font-size: 10px;
color: #a66; color: #a66;
} }
.debug-message-name { .debug-message-name {
background: #fff;
padding: 1px 5px; padding: 1px 5px;
font-size: 9px; color: #777;
color: #aac;
} }
.debug-message-payload { .debug-message-payload {
display: block; display: block;

View File

@ -202,16 +202,17 @@ RED.debug = (function() {
var format = sanitize((o.format||"").toString()); var format = sanitize((o.format||"").toString());
msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'') + msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'') +
((sourceNode&&sourceNode.z)?((" debug-message-flow-"+sourceNode.z+((filter&&(activeWorkspace!==sourceNode.z))?" hide":""))):""); ((sourceNode&&sourceNode.z)?((" debug-message-flow-"+sourceNode.z+((filter&&(activeWorkspace!==sourceNode.z))?" hide":""))):"");
$('<span class="debug-message-date">'+ getTimestamp()+'</span>').appendTo(msg); var metaRow = $('<div class="debug-message-meta"></div>').appendTo(msg);
$('<span class="debug-message-date">'+ getTimestamp()+'</span>').appendTo(metaRow);
if (sourceNode) { if (sourceNode) {
$('<a>',{href:"#",class:"debug-message-name"}).html('node: '+sourceNode.id) $('<a>',{href:"#",class:"debug-message-name"}).html('node: '+sourceNode.id)
.appendTo(msg) .appendTo(metaRow)
.click(function(evt) { .click(function(evt) {
evt.preventDefault(); evt.preventDefault();
config.messageSourceClick(sourceNode.id); config.messageSourceClick(sourceNode.id);
}); });
} else if (name) { } else if (name) {
$('<span class="debug-message-name">'+name+'</span>').appendTo(msg); $('<span class="debug-message-name">'+name+'</span>').appendTo(metaRow);
} }
// NOTE: relying on function error to have a "type" that all other msgs don't // NOTE: relying on function error to have a "type" that all other msgs don't
if (o.hasOwnProperty("type") && (o.type === "function")) { if (o.hasOwnProperty("type") && (o.type === "function")) {
@ -222,12 +223,12 @@ RED.debug = (function() {
errorLvlType = 'warn'; errorLvlType = 'warn';
} }
$(msg).addClass('debug-message-level-' + errorLvl); $(msg).addClass('debug-message-level-' + errorLvl);
$('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(msg); $('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(metaRow);
} else { } else {
$('<span class="debug-message-topic">'+ $('<span class="debug-message-topic">'+
(o.topic?topic+' : ':'')+ (o.topic?topic+' : ':'')+
(o.property?'msg.'+property:'msg')+" : "+format+ (o.property?'msg.'+property:'msg')+" : "+format+
'</span>').appendTo(msg); '</span>').appendTo(metaRow);
} }
if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number'||/error/i.test(format) ) { if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number'||/error/i.test(format) ) {
payload = JSON.parse(payload); payload = JSON.parse(payload);