From 5feb07583bb355e53c307829b84e488d0e27c6e8 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 12 May 2017 10:19:50 +0100 Subject: [PATCH] Don't include msg. in debug message copied paths --- editor/js/ui/utils.js | 16 +++++++++------- nodes/core/core/lib/debug/debug-utils.js | 2 +- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/editor/js/ui/utils.js b/editor/js/ui/utils.js index 6fcfc35e0..a3c42d659 100644 --- a/editor/js/ui/utils.js +++ b/editor/js/ui/utils.js @@ -79,11 +79,13 @@ RED.utils = (function() { } var tools = $('').appendTo(obj); var copyTools = $('').appendTo(tools); - var copyPath = $('').appendTo(copyTools).click(function(e) { - e.preventDefault(); - e.stopPropagation(); - RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath"); - }) + if (!!key) { + var copyPath = $('').appendTo(copyTools).click(function(e) { + e.preventDefault(); + e.stopPropagation(); + RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath"); + }) + } var copyPayload = $('').appendTo(copyTools).click(function(e) { e.preventDefault(); e.stopPropagation(); @@ -195,7 +197,7 @@ RED.utils = (function() { var headerHead; var value; var strippedKey; - if (path && rootPath) { + if (path !== undefined && rootPath !== undefined) { strippedKey = path.substring(rootPath.length+(path[rootPath.length]==="."?1:0)); } var element = $(''); @@ -386,7 +388,7 @@ RED.utils = (function() { var row = $('').appendTo(element); var newPath = path; if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) { - newPath += "."+keys[i]; + newPath += (newPath.length > 0?".":"")+keys[i]; } else { newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]" } diff --git a/nodes/core/core/lib/debug/debug-utils.js b/nodes/core/core/lib/debug/debug-utils.js index e4bd6b537..b10d6334f 100644 --- a/nodes/core/core/lib/debug/debug-utils.js +++ b/nodes/core/core/lib/debug/debug-utils.js @@ -250,7 +250,7 @@ RED.debug = (function() { } } var el = $('').appendTo(msg); - var path = (o.property?'msg.'+property:'msg'); + var path = o.property||''; RED.utils.createObjectElement(payload,/*true*/null,format,false,path,sourceNode&&sourceNode.id,path).appendTo(el); var atBottom = (sbc.scrollHeight-messageList.height()-sbc.scrollTop) < 5; var m = {