From 3e7f58dedd8a9eb98700c725f4747c711a2a928e Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 26 Mar 2020 15:22:59 +0000 Subject: [PATCH] [groups] Include group counts in copy/paste notifications --- .../@node-red/editor-client/locales/en-US/editor.json | 5 +++++ .../@node-red/editor-client/src/js/ui/view.js | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json index 2b3cb691b..e69d0b48d 100755 --- a/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json +++ b/packages/node_modules/@node-red/editor-client/locales/en-US/editor.json @@ -178,6 +178,8 @@ "node_plural": "__count__ nodes", "configNode": "__count__ configuration node", "configNode_plural": "__count__ configuration nodes", + "group": "__count__ group", + "group_plural": "__count__ groups", "flow": "__count__ flow", "flow_plural": "__count__ flows", "subflow": "__count__ subflow", @@ -193,6 +195,9 @@ "nodesImported": "Imported:", "nodeCopied": "__count__ node copied", "nodeCopied_plural": "__count__ nodes copied", + "groupCopied": "__count__ group copied", + "groupCopied_plural": "__count__ groups copied", + "groupStyleCopied": "Group style copied", "invalidFlow": "Invalid flow: __message__", "export": { "selected":"selected nodes", diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js index d05335df1..22db1a99b 100755 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/view.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/view.js @@ -2073,7 +2073,11 @@ if (DEBUG_EVENTS) { console.warn("clearSelection", mouse_mode); } } } clipboard = JSON.stringify(nns); - RED.notify(RED._("clipboard.nodeCopied",{count:nns.length}),{id:"clipboard"}); + if (nodeCount > 0) { + RED.notify(RED._("clipboard.nodeCopied",{count:nodeCount}),{id:"clipboard"}); + } else if (groupCount > 0) { + RED.notify(RED._("clipboard.groupCopied",{count:groupCount}),{id:"clipboard"}); + } } } @@ -4307,12 +4311,16 @@ if (DEBUG_EVENTS) { console.warn("nodeMouseDown", mouse_mode,d); } newConfigNodeCount++; } }) + var newGroupCount = new_groups.length; if (new_workspaces.length > 0) { counts.push(RED._("clipboard.flow",{count:new_workspaces.length})); } if (newNodeCount > 0) { counts.push(RED._("clipboard.node",{count:newNodeCount})); } + if (newGroupCount > 0) { + counts.push(RED._("clipboard.group",{count:newGroupCount})); + } if (newConfigNodeCount > 0) { counts.push(RED._("clipboard.configNode",{count:newNodeCount})); }