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

Make debug message node id clickable

This commit is contained in:
Nick O'Leary 2016-10-26 22:08:28 +01:00
parent 1c905da8c2
commit a35ce22218
3 changed files with 24 additions and 22 deletions

View File

@ -105,10 +105,10 @@
var footerToolbar = $('<div>'+ var footerToolbar = $('<div>'+
'<span class="button-group">'+ // '<span class="button-group">'+
'<a class="sidebar-footer-button-toggle text-button selected" id="debug-tab-view-list" href="#"><span data-i18n="">list</span></a>'+ // '<a class="sidebar-footer-button-toggle text-button selected" id="debug-tab-view-list" href="#"><span data-i18n="">list</span></a>'+
'<a class="sidebar-footer-button-toggle text-button" id="debug-tab-view-table" href="#"><span data-i18n="">table</span></a> '+ // '<a class="sidebar-footer-button-toggle text-button" id="debug-tab-view-table" href="#"><span data-i18n="">table</span></a> '+
'</span>'+ // '</span>'+
'<span class="button-group"><a id="debug-tab-open" title="open in new window" class="sidebar-footer-button" href="#"><i class="fa fa-desktop"></i></a></span> ' + '<span class="button-group"><a id="debug-tab-open" title="open in new window" class="sidebar-footer-button" href="#"><i class="fa fa-desktop"></i></a></span> ' +
'</div>'); '</div>');
@ -230,12 +230,6 @@
} }
RED.view.redraw(); RED.view.redraw();
}; };
$(msg).click(function() {
var node = RED.nodes.node(o.id) || RED.nodes.node(o.z);
if (node) {
RED.view.reveal(node.id);
}
});
var name = sanitize(((o.name?o.name:o.id)||"").toString()); var name = sanitize(((o.name?o.name:o.id)||"").toString());
var topic = sanitize((o.topic||"").toString()); var topic = sanitize((o.topic||"").toString());
var property = sanitize(o.property?o.property:''); var property = sanitize(o.property?o.property:'');
@ -244,10 +238,17 @@
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&&(RED.workspaces.active()!==sourceNode.z))?" hide":""))):""); ((sourceNode&&sourceNode.z)?((" debug-message-flow-"+sourceNode.z+((filter&&(RED.workspaces.active()!==sourceNode.z))?" hide":""))):"");
msg.innerHTML = '<span class="debug-message-date">'+ $('<span class="debug-message-date">'+ getTimestamp()+'</span>').appendTo(msg);
getTimestamp()+'</span>'+ if (sourceNode) {
(name?'<span class="debug-message-name">'+name:'')+ $('<a>',{href:"#",class:"debug-message-name"}).html('node: '+sourceNode.id)
'</span>'; .appendTo(msg)
.click(function(evt) {
evt.preventDefault();
RED.view.reveal(sourceNode.id);
});
} else if (name) {
$('<span class="debug-message-name">'+name+'</span>').appendTo(msg);
}
// 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")) {
var errorLvlType = 'error'; var errorLvlType = 'error';
@ -257,13 +258,12 @@
errorLvlType = 'warn'; errorLvlType = 'warn';
} }
msg.className = 'debug-message debug-message-level-' + errorLvl; msg.className = 'debug-message debug-message-level-' + errorLvl;
msg.innerHTML += '<span class="debug-message-topic">function : (' + errorLvlType + ')</span>'; $('<span class="debug-message-topic">function : (' + errorLvlType + ')</span>').appendTo(msg);
} else { } else {
msg.innerHTML += '<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>';
} }
if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number' ) { if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number' ) {
payload = JSON.parse(payload); payload = JSON.parse(payload);

View File

@ -19,6 +19,7 @@ RED.debug = (function() {
header.addClass("debug-message-expandable"); header.addClass("debug-message-expandable");
header.click(function(e) { header.click(function(e) {
$(this).parent().toggleClass('collapsed'); $(this).parent().toggleClass('collapsed');
//e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
} }
@ -26,8 +27,6 @@ RED.debug = (function() {
headerHead = $('<span class="debug-message-object-header"></span>').appendTo(header); headerHead = $('<span class="debug-message-object-header"></span>').appendTo(header);
$('<span>[ </span>').appendTo(headerHead); $('<span>[ </span>').appendTo(headerHead);
} }
for (i=0;i<length;i++) { for (i=0;i<length;i++) {
if (topLevel) { if (topLevel) {
value = obj[i]; value = obj[i];
@ -57,6 +56,7 @@ RED.debug = (function() {
header.addClass("debug-message-expandable"); header.addClass("debug-message-expandable");
header.click(function(e) { header.click(function(e) {
$(this).parent().toggleClass('collapsed'); $(this).parent().toggleClass('collapsed');
//e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
} }
@ -92,6 +92,7 @@ RED.debug = (function() {
header.addClass("debug-message-expandable"); header.addClass("debug-message-expandable");
header.click(function(e) { header.click(function(e) {
$(this).parent().toggleClass('collapsed'); $(this).parent().toggleClass('collapsed');
//e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
} }
@ -143,6 +144,7 @@ RED.debug = (function() {
entryHeader.addClass("debug-message-expandable"); entryHeader.addClass("debug-message-expandable");
entryHeader.click(function(e) { entryHeader.click(function(e) {
$(this).parent().toggleClass('collapsed'); $(this).parent().toggleClass('collapsed');
//e.stopPropagation();
e.preventDefault(); e.preventDefault();
}); });
} }

View File

@ -20,10 +20,10 @@
top: 42px; top: 42px;
left: 0px; left: 0px;
right: 0px; right: 0px;
background: #fff; background: #f9f9f9;
padding: 10px; padding: 10px;
border-bottom: 1px solid #ddd; border-bottom: 1px solid #ddd;
box-shadow: 0 4px 8px rgba(0,0,0,0.1); box-shadow: 0 2px 6px rgba(0,0,0,0.1);
} }
.debug-filter-row { .debug-filter-row {
text-align: right; text-align: right;