diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 04922d658..46701e1fc 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -2405,7 +2405,6 @@ RED.view = (function() { node.highlighted = true; node.dirty = true; RED.workspaces.show(node.z); - RED.view.redraw(); var screenSize = [$("#chart").width(),$("#chart").height()]; var scrollPos = [$("#chart").scrollLeft(),$("#chart").scrollTop()]; @@ -2419,17 +2418,22 @@ RED.view = (function() { },200); } - var flash = 22; - var flashFunc = function() { - flash--; - node.highlighted = !node.highlighted; - node.dirty = true; - RED.view.redraw(); - if (flash >= 0) { - setTimeout(flashFunc,100); + if (!node._flashing) { + node._flashing = true; + var flash = 22; + var flashFunc = function() { + flash--; + node.highlighted = !node.highlighted; + node.dirty = true; + RED.view.redraw(); + if (flash >= 0) { + setTimeout(flashFunc,100); + } else { + delete node._flashing; + } } + flashFunc(); } - flashFunc(); } else if (node._def.category === 'config') { RED.sidebar.config.show(id); } diff --git a/nodes/core/core/58-debug.html b/nodes/core/core/58-debug.html index 7fb3429d1..241ab4029 100644 --- a/nodes/core/core/58-debug.html +++ b/nodes/core/core/58-debug.html @@ -44,7 +44,6 @@
Optionally can show the complete msg
object, and send messages to the console log.
In addition any calls to node.warn or node.error will appear here.
- - + diff --git a/nodes/core/core/58-debug.js b/nodes/core/core/58-debug.js index be780c7ba..f321ad536 100644 --- a/nodes/core/core/58-debug.js +++ b/nodes/core/core/58-debug.js @@ -82,6 +82,9 @@ module.exports = function(RED) { } else if (msg.msg instanceof Buffer) { msg.format = "buffer ["+msg.msg.length+"]"; msg.msg = msg.msg.toString('hex'); + if (msg.msg.length > debuglength) { + msg.msg = msg.msg.substring(0,debuglength); + } } else if (msg.msg && typeof msg.msg === 'object') { var seen = []; try { @@ -95,6 +98,12 @@ module.exports = function(RED) { } if (isArray || (msg.format === "Object")) { msg.msg = JSON.stringify(msg.msg, function(key, value) { + if (key[0] === '_' && key !== "_msgid") { + return undefined; + } + if (key === '_req' || key === '_res') { + return "[internal]" + } if (typeof value === 'object' && value !== null) { if (seen.indexOf(value) !== -1) { return "[circular]"; } seen.push(value); @@ -123,9 +132,9 @@ module.exports = function(RED) { msg.msg = msg.msg; } - if (msg.msg.length > debuglength) { - msg.msg = msg.msg.substr(0,debuglength) +" ...."; - } + // if (msg.msg.length > debuglength) { + // msg.msg = msg.msg.substr(0,debuglength) +" ...."; + // } RED.comms.publish("debug",msg); } diff --git a/nodes/core/core/lib/debug/debug-utils.js b/nodes/core/core/lib/debug/debug-utils.js new file mode 100644 index 000000000..3db4b8c36 --- /dev/null +++ b/nodes/core/core/lib/debug/debug-utils.js @@ -0,0 +1,157 @@ + +RED.debug = (function() { + function buildMessageElement(obj,topLevel) { + var i; + var e; + var entryObj; + var header; + var headerHead; + var value; + var element = $('').toggleClass('collapsed',topLevel); + if (Array.isArray(obj)) { + var length = Math.min(obj.length,10); + if (!topLevel) { + header = $('').html('array['+obj.length+']').appendTo(element); + } else { + header = $('').appendTo(element); + if (length > 0) { + $(' ').prependTo(header); + header.addClass("debug-message-expandable"); + header.click(function(e) { + $(this).parent().toggleClass('collapsed'); + e.preventDefault(); + }); + } + $('').html('array['+obj.length+']').appendTo(header); + headerHead = $('').appendTo(header); + $('[ ').appendTo(headerHead); + } + + + for (i=0;i').html('array['+value.length+']').appendTo(headerHead); + } else if (value === null) { + $(' ').appendTo(headerHead); + } else if (typeof value === 'object') { + $(' ').appendTo(headerHead); + } else if (typeof value === 'string') { + $('').text('"'+value+'"').appendTo(headerHead); + } else { + $('').text(""+value).appendTo(headerHead); + } + if (i < length -1) { + $(', ').appendTo(headerHead); + } + } + entryObj = $('').appendTo(element); + header = $('').appendTo(entryObj); + if (typeof obj[i] === 'object' && obj[i] !== null) { + $(' ').appendTo(header); + header.addClass("debug-message-expandable"); + header.click(function(e) { + $(this).parent().toggleClass('collapsed'); + e.preventDefault(); + }); + } + $('').text(i).appendTo(header); + $(': ').appendTo(entryObj); + e = $('').appendTo(entryObj); + buildMessageElement(obj[i],false).appendTo(e); + } + if (length < obj.length) { + if (topLevel) { + $(' ...').appendTo(headerHead); + } + $(' ').appendTo(element); + } + if (topLevel) { + if (length === 0) { + $(' ').appendTo(headerHead); + } + $(' ]').appendTo(headerHead); + } + } else if (obj === null || obj === undefined) { + $(' ').appendTo(element); + } else if (typeof obj === 'object') { + var keys = Object.keys(obj); + if (topLevel) { + header = $('').appendTo(element); + if (keys.length > 0) { + $(' ').prependTo(header); + header.addClass("debug-message-expandable"); + header.click(function(e) { + $(this).parent().toggleClass('collapsed'); + e.preventDefault(); + }); + } + } else { + header = $('').html('object').appendTo(element); + } + if (topLevel) { + $('').html('object').appendTo(header); + headerHead = $('').appendTo(header); + $('{ ').appendTo(headerHead); + } + for (i=0;i').text(keys[i]).appendTo(headerHead); + $(': ').appendTo(headerHead); + value = obj[keys[i]]; + if (Array.isArray(value)) { + $('').html('array['+value.length+']').appendTo(headerHead); + } else if (value === null) { + $(' ').appendTo(headerHead); + } else if (typeof value === 'object') { + $(' ').appendTo(headerHead); + } else if (typeof value === 'string') { + $('').text('"'+value+'"').appendTo(headerHead); + } else { + $('').text(""+value).appendTo(headerHead); + } + if (i < keys.length -1) { + $(', ').appendTo(headerHead); + } + } + if (i === 5) { + $(' ...').appendTo(headerHead); + } + } + entryObj = $('').appendTo(element); + var entryHeader = $('').appendTo(entryObj); + if (typeof obj[keys[i]] === 'object' && obj[keys[i]] !== null) { + $(' ').appendTo(entryHeader); + entryHeader.addClass("debug-message-expandable"); + entryHeader.click(function(e) { + $(this).parent().toggleClass('collapsed'); + e.preventDefault(); + }); + } + $('').text(keys[i]).appendTo(entryHeader); + $(': ').appendTo(entryHeader); + e = $('').appendTo(entryObj); + buildMessageElement(obj[keys[i]],false).appendTo(e); + } + if (keys.length === 0) { + $('').text("empty").appendTo(element); + } + if (topLevel) { + if (keys.length === 0) { + $(' ').appendTo(headerHead); + } + $(' }').appendTo(headerHead); + } + } else if (typeof obj === 'string') { + $('').text('"'+obj+'"').appendTo(element); + } else { + $('').text(""+obj).appendTo(element); + } + return element; + } + return { + buildMessageElement: buildMessageElement + } +})(); diff --git a/nodes/core/core/lib/debug/debug.js b/nodes/core/core/lib/debug/debug.js index 7c71621e6..57311e859 100644 --- a/nodes/core/core/lib/debug/debug.js +++ b/nodes/core/core/lib/debug/debug.js @@ -89,67 +89,4 @@ $(function() { $("#debug-content").append(msg); $("#debug-content").scrollTop($("#debug-content")[0].scrollHeight); },false); - - function buildMessageElement(obj,topLevel) { - var i; - var e; - var entryObj; - var header; - var element = $('').toggleClass('collapsed',topLevel); - if (Array.isArray(obj)) { - $('').html('Array['+obj.length+']').appendTo(element); - var length = Math.min(obj.length,10); - for (i=0;i