From 4b05a9bb6f9bee4b3e9809b24c2e71737b8b87d6 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Mon, 10 Apr 2017 00:00:10 +0100 Subject: [PATCH] Ensure flow info box updates after editing flow --- editor/js/ui/tab-info.js | 5 ++--- editor/js/ui/view.js | 8 ++++++-- editor/js/ui/workspaces.js | 4 ++++ 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/editor/js/ui/tab-info.js b/editor/js/ui/tab-info.js index deb1759c7..3a110ef2e 100644 --- a/editor/js/ui/tab-info.js +++ b/editor/js/ui/tab-info.js @@ -134,9 +134,8 @@ RED.sidebar.info = (function() { $(propRow.children()[1]).html(' '+(node.label||"")) propRow = $(''+RED._("sidebar.info.id")+"").appendTo(tableBody); RED.utils.createObjectElement(node.id).appendTo(propRow.children()[1]); - propRow = $('Enabled').appendTo(tableBody); - RED.utils.createObjectElement((!!!node.disabled)).appendTo(propRow.children()[1]); - + propRow = $('State').appendTo(tableBody); + $(propRow.children()[1]).html((!!!node.disabled)?"Enabled":"Disabled") } else { nodeSection.title.html("Node"); if (node.type !== "subflow" && node.name) { diff --git a/editor/js/ui/view.js b/editor/js/ui/view.js index 327ba9c36..f457e8ff3 100644 --- a/editor/js/ui/view.js +++ b/editor/js/ui/view.js @@ -1056,6 +1056,7 @@ RED.view = (function() { selected_link = null; } + var lastSelection = null; function updateSelection() { var selection = {}; @@ -1128,8 +1129,11 @@ RED.view = (function() { } } - - RED.events.emit("view:selection-changed",selection); + var selectionJSON = JSON.stringify(selection); + if (selectionJSON !== lastSelection) { + lastSelection = selectionJSON; + RED.events.emit("view:selection-changed",selection); + } } function endKeyboardMove() { diff --git a/editor/js/ui/workspaces.js b/editor/js/ui/workspaces.js index f058cce8d..44f674d1f 100644 --- a/editor/js/ui/workspaces.js +++ b/editor/js/ui/workspaces.js @@ -112,6 +112,10 @@ RED.workspaces = (function() { RED.history.push(historyEvent); RED.nodes.dirty(true); RED.sidebar.config.refresh(); + var selection = RED.view.selection(); + if (!selection.nodes && !selection.links) { + RED.sidebar.info.refresh(workspace); + } } RED.tray.close(); }