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

Fix diff view node properties table rendering

This commit is contained in:
Nick O'Leary 2017-07-26 07:47:19 -07:00
parent 1c0e794f87
commit 0f93929544
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
3 changed files with 23 additions and 11 deletions

View File

@ -587,7 +587,8 @@ RED.diff = (function() {
if (localNode) { if (localNode) {
localCell.addClass("node-diff-node-unchanged"); localCell.addClass("node-diff-node-unchanged");
$('<span class="node-diff-status"></span>').appendTo(localCell); $('<span class="node-diff-status"></span>').appendTo(localCell);
RED.utils.createObjectElement(localNode.id).appendTo(localCell); element = $('<span class="node-diff-element"></span>').appendTo(localCell);
RED.utils.createObjectElement(localNode.id).appendTo(element);
} else { } else {
localCell.addClass("node-diff-empty"); localCell.addClass("node-diff-empty");
} }
@ -596,7 +597,8 @@ RED.diff = (function() {
remoteCell.addClass("node-diff-node-unchanged"); remoteCell.addClass("node-diff-node-unchanged");
if (remoteNode) { if (remoteNode) {
$('<span class="node-diff-status"></span>').appendTo(remoteCell); $('<span class="node-diff-status"></span>').appendTo(remoteCell);
RED.utils.createObjectElement(remoteNode.id).appendTo(remoteCell); element = $('<span class="node-diff-element"></span>').appendTo(remoteCell);
RED.utils.createObjectElement(remoteNode.id).appendTo(element);
} else { } else {
remoteCell.addClass("node-diff-empty"); remoteCell.addClass("node-diff-empty");
} }
@ -628,7 +630,8 @@ RED.diff = (function() {
if (localNode) { if (localNode) {
localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged")); localCell.addClass("node-diff-node-"+(localChanged?"changed":"unchanged"));
$('<span class="node-diff-status">'+(localChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(localCell); $('<span class="node-diff-status">'+(localChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(localCell);
RED.utils.createObjectElement({x:localNode.x,y:localNode.y}).appendTo(localCell); element = $('<span class="node-diff-element"></span>').appendTo(localCell);
RED.utils.createObjectElement({x:localNode.x,y:localNode.y}).appendTo(element);
} else { } else {
localCell.addClass("node-diff-empty"); localCell.addClass("node-diff-empty");
} }
@ -638,7 +641,8 @@ RED.diff = (function() {
remoteCell.addClass("node-diff-node-"+(remoteChanged?"changed":"unchanged")); remoteCell.addClass("node-diff-node-"+(remoteChanged?"changed":"unchanged"));
if (remoteNode) { if (remoteNode) {
$('<span class="node-diff-status">'+(remoteChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(remoteCell); $('<span class="node-diff-status">'+(remoteChanged?'<i class="fa fa-square"></i>':'')+'</span>').appendTo(remoteCell);
RED.utils.createObjectElement({x:remoteNode.x,y:remoteNode.y}).appendTo(remoteCell); element = $('<span class="node-diff-element"></span>').appendTo(remoteCell);
RED.utils.createObjectElement({x:remoteNode.x,y:remoteNode.y}).appendTo(element);
} else { } else {
remoteCell.addClass("node-diff-empty"); remoteCell.addClass("node-diff-empty");
} }
@ -742,7 +746,8 @@ RED.diff = (function() {
localCell.addClass("node-diff-node-conflict"); localCell.addClass("node-diff-node-conflict");
$('<span class="node-diff-status"><i class="fa fa-exclamation"></i></span>').appendTo(localCell); $('<span class="node-diff-status"><i class="fa fa-exclamation"></i></span>').appendTo(localCell);
} }
RED.utils.createObjectElement(localNode[d]).appendTo(localCell); element = $('<span class="node-diff-element"></span>').appendTo(localCell);
RED.utils.createObjectElement(localNode[d]).appendTo(element);
} else { } else {
localCell.addClass("node-diff-empty"); localCell.addClass("node-diff-empty");
} }
@ -756,7 +761,8 @@ RED.diff = (function() {
remoteCell.addClass("node-diff-node-conflict"); remoteCell.addClass("node-diff-node-conflict");
$('<span class="node-diff-status"><i class="fa fa-exclamation"></i></span>').appendTo(remoteCell); $('<span class="node-diff-status"><i class="fa fa-exclamation"></i></span>').appendTo(remoteCell);
} }
RED.utils.createObjectElement(remoteNode[d]).appendTo(remoteCell); element = $('<span class="node-diff-element"></span>').appendTo(remoteCell);
RED.utils.createObjectElement(remoteNode[d]).appendTo(element);
} else { } else {
remoteCell.addClass("node-diff-empty"); remoteCell.addClass("node-diff-empty");
} }

View File

@ -395,11 +395,13 @@ RED.utils = (function() {
for (i=0;i<keys.length;i++) { for (i=0;i<keys.length;i++) {
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 (newPath) {
if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) { if (/^[a-zA-Z_$][0-9a-zA-Z_$]*$/.test(keys[i])) {
newPath += (newPath.length > 0?".":"")+keys[i]; newPath += (newPath.length > 0?".":"")+keys[i];
} else { } else {
newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]" newPath += "[\""+keys[i].replace(/"/,"\\\"")+"\"]"
} }
}
buildMessageElement(obj[keys[i]],keys[i],false,false,newPath,sourceId,rootPath,expandPaths).appendTo(row); buildMessageElement(obj[keys[i]],keys[i],false,false,newPath,sourceId,rootPath,expandPaths).appendTo(row);
} }
if (keys.length === 0) { if (keys.length === 0) {

View File

@ -313,6 +313,10 @@
margin-bottom: 6px; margin-bottom: 6px;
text-align: center; text-align: center;
} }
.node-diff-element {
display: inline-block;
width: calc(100% - 20px);
}
.node-diff-node-description { .node-diff-node-description {
color: $form-text-color; color: $form-text-color;