From ed1a55d9cd120dfb04b5d3fad518e613085a7edf Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Wed, 3 May 2017 13:29:35 +0100 Subject: [PATCH] Provide feedback when enable/disable node fails --- editor/js/ui/palette-editor.js | 15 ++++++++++++--- red/api/locales/en-US/editor.json | 4 +++- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/editor/js/ui/palette-editor.js b/editor/js/ui/palette-editor.js index cd1d06812..2ae88679a 100644 --- a/editor/js/ui/palette-editor.js +++ b/editor/js/ui/palette-editor.js @@ -690,8 +690,13 @@ RED.palette.editor = (function() { if (object.setUseCount[setName] === 0) { var currentSet = RED.nodes.registry.getNodeSet(set.id); shade.show(); - changeNodeState(set.id,!currentSet.enabled,shade,function(xhr){ - console.log(xhr) + var newState = !currentSet.enabled + changeNodeState(set.id,newState,shade,function(xhr){ + if (xhr) { + if (xhr.responseJSON) { + RED.notify(RED._('palette.editor.errors.'+(newState?'enable':'disable')+'Failed',{module: id,message:xhr.responseJSON.message})); + } + } }); } }) @@ -706,7 +711,11 @@ RED.palette.editor = (function() { evt.preventDefault(); if (object.totalUseCount === 0) { changeNodeState(entry.name,(container.hasClass('disabled')),shade,function(xhr){ - console.log(xhr) + if (xhr) { + if (xhr.responseJSON) { + RED.notify(RED._('palette.editor.errors.installFailed',{module: id,message:xhr.responseJSON.message})); + } + } }); } }) diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json index ffbdb9407..ffefff02c 100644 --- a/red/api/locales/en-US/editor.json +++ b/red/api/locales/en-US/editor.json @@ -316,7 +316,9 @@ "catalogLoadFailed": "Failed to load node catalogue.
Check the browser console for more information", "installFailed": "Failed to install: __module__
__message__
Check the log for more information", "removeFailed": "Failed to remove: __module__
__message__
Check the log for more information", - "updateFailed": "Failed to update: __module__
__message__
Check the log for more information" + "updateFailed": "Failed to update: __module__
__message__
Check the log for more information", + "enableFailed": "Failed to enable: __module__
__message__
Check the log for more information", + "disableFailed": "Failed to disable: __module__
__message__
Check the log for more information" }, "confirm": { "install": {