1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

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

View File

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