Add minimum show time to deploy spinner to avoid flicker

This commit is contained in:
Nick O'Leary 2016-10-21 12:59:55 +01:00
parent fc9835512d
commit 8debed805b
1 changed files with 6 additions and 2 deletions

View File

@ -602,6 +602,7 @@ RED.deploy = (function() {
var nns = RED.nodes.createCompleteNodeSet();
var startTime = Date.now();
$(".deploy-button-content").css('opacity',0);
$(".deploy-button-spinner").show();
$("#btn-deploy").addClass("disabled");
@ -665,8 +666,11 @@ RED.deploy = (function() {
RED.notify(RED._("deploy.deployFailed",{message:RED._("deploy.errors.noResponse")}),"error");
}
}).always(function() {
$(".deploy-button-content").css('opacity',1);
$(".deploy-button-spinner").hide();
var delta = Math.max(0,300-(Date.now()-startTime));
setTimeout(function() {
$(".deploy-button-content").css('opacity',1);
$(".deploy-button-spinner").hide();
},delta);
});
}
}