From 8debed805b6d6c5c922434a5574ec86f30d2ebf4 Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Fri, 21 Oct 2016 12:59:55 +0100 Subject: [PATCH] Add minimum show time to deploy spinner to avoid flicker --- editor/js/ui/deploy.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor/js/ui/deploy.js b/editor/js/ui/deploy.js index b94add055..55f3d8a7a 100644 --- a/editor/js/ui/deploy.js +++ b/editor/js/ui/deploy.js @@ -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); }); } }