Better notification message when action is not permitted

This commit is contained in:
Nick O'Leary
2016-04-10 15:22:41 +01:00
parent 913b09570c
commit 75a7be41eb
3 changed files with 18 additions and 6 deletions

View File

@@ -268,10 +268,12 @@ RED.deploy = (function() {
RED.events.emit("deploy");
}).fail(function(xhr,textStatus,err) {
RED.nodes.dirty(true);
if (xhr.responseText) {
RED.notify(RED._("notification.error",{message:xhr.responseText}),"error");
if (xhr.status === 401) {
RED.notify(RED._("deploy.deployFailed",{message:RED._("user.notAuthorized")}),"error");
} else if (xhr.responseText) {
RED.notify(RED._("deploy.deployFailed",{message:xhr.responseText}),"error");
} else {
RED.notify(RED._("notification.error",{message:RED._("deploy.errors.noResponse")}),"error");
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
}
}).always(function() {
$("#btn-deploy-icon").removeClass('spinner');