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

Don't include msg. in debug message copied paths

This commit is contained in:
Nick O'Leary 2017-05-12 10:19:50 +01:00
parent 5388002f54
commit 5feb07583b
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
2 changed files with 10 additions and 8 deletions

View File

@ -79,11 +79,13 @@ RED.utils = (function() {
} }
var tools = $('<span class="debug-message-tools"></span>').appendTo(obj); var tools = $('<span class="debug-message-tools"></span>').appendTo(obj);
var copyTools = $('<span class="debug-message-tools-copy button-group"></span>').appendTo(tools); var copyTools = $('<span class="debug-message-tools-copy button-group"></span>').appendTo(tools);
if (!!key) {
var copyPath = $('<button class="editor-button editor-button-small"><i class="fa fa-terminal"></i></button>').appendTo(copyTools).click(function(e) { var copyPath = $('<button class="editor-button editor-button-small"><i class="fa fa-terminal"></i></button>').appendTo(copyTools).click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath"); RED.clipboard.copyText(key,copyPath,"clipboard.copyMessagePath");
}) })
}
var copyPayload = $('<button class="editor-button editor-button-small"><i class="fa fa-clipboard"></i></button>').appendTo(copyTools).click(function(e) { var copyPayload = $('<button class="editor-button editor-button-small"><i class="fa fa-clipboard"></i></button>').appendTo(copyTools).click(function(e) {
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -195,7 +197,7 @@ RED.utils = (function() {
var headerHead; var headerHead;
var value; var value;
var strippedKey; var strippedKey;
if (path && rootPath) { if (path !== undefined && rootPath !== undefined) {
strippedKey = path.substring(rootPath.length+(path[rootPath.length]==="."?1:0)); strippedKey = path.substring(rootPath.length+(path[rootPath.length]==="."?1:0));
} }
var element = $('<span class="debug-message-element"></span>'); var element = $('<span class="debug-message-element"></span>');
@ -386,7 +388,7 @@ RED.utils = (function() {
var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element); var row = $('<div class="debug-message-object-entry collapsed"></div>').appendTo(element);
var newPath = path; var newPath = path;
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) { if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) {
newPath += "."+keys[i]; newPath += (newPath.length > 0?".":"")+keys[i];
} else { } else {
newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]" newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]"
} }

View File

@ -250,7 +250,7 @@ RED.debug = (function() {
} }
} }
var el = $('<span class="debug-message-payload"></span>').appendTo(msg); var el = $('<span class="debug-message-payload"></span>').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); 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 atBottom = (sbc.scrollHeight-messageList.height()-sbc.scrollTop) < 5;
var m = { var m = {