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>'+
'<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" id="debug-tab-view-table" href="#"><span data-i18n="">table</span></a> '+
'</span>'+
// '<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" id="debug-tab-view-table" href="#"><span data-i18n="">table</span></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>');
@ -230,12 +230,6 @@
}
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 topic = sanitize((o.topic||"").toString());
var property = sanitize(o.property?o.property:'');
@ -244,10 +238,17 @@
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":""))):"");
msg.innerHTML = '<span class="debug-message-date">'+
getTimestamp()+'</span>'+
(name?'<span class="debug-message-name">'+name:'')+
'</span>';
$('<span class="debug-message-date">'+ getTimestamp()+'</span>').appendTo(msg);
if (sourceNode) {
$('<a>',{href:"#",class:"debug-message-name"}).html('node: '+sourceNode.id)
.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
if (o.hasOwnProperty("type") && (o.type === "function")) {
var errorLvlType = 'error';
@ -257,13 +258,12 @@
errorLvlType = 'warn';
}
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 {
msg.innerHTML += '<span class="debug-message-topic">'+
$('<span class="debug-message-topic">'+
(o.topic?topic+' : ':'')+
(o.property?'msg.'+property:'msg')+" : "+format+
'</span>';
'</span>').appendTo(msg);
}
if (format === 'Object' || /^array/.test(format) || format === 'boolean' || format === 'number' ) {
payload = JSON.parse(payload);

View File

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

View File

@ -20,10 +20,10 @@
top: 42px;
left: 0px;
right: 0px;
background: #fff;
background: #f9f9f9;
padding: 10px;
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 {
text-align: right;