From 0573e2d31c9c608aa984c8f5378e8f0097f4c774 Mon Sep 17 00:00:00 2001 From: Michael Wood Date: Thu, 21 May 2015 18:44:18 +0100 Subject: bitbake: toaster: Add ajax loading spinner This adds an ajax loading spinner to provide feedback when in-page loading is happening. It will show after 1.2 seconds of initial loading. [YOCTO #7790] (Bitbake rev: ecb70b0bc996529f1a6e58e5716b31e273395c98) Signed-off-by: Michael Wood Signed-off-by: Richard Purdie --- .../lib/toaster/toastergui/static/js/libtoaster.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'bitbake/lib/toaster/toastergui/static/js/libtoaster.js') diff --git a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js index 23755a75f2..c3798336f2 100644 --- a/bitbake/lib/toaster/toastergui/static/js/libtoaster.js +++ b/bitbake/lib/toaster/toastergui/static/js/libtoaster.js @@ -341,6 +341,8 @@ function reload_params(params) { /* Things that happen for all pages */ $(document).ready(function() { + var ajaxLoadingTimer; + /* If we don't have a console object which might be the case in some * browsers, no-op it to avoid undefined errors. */ @@ -482,6 +484,26 @@ $(document).ready(function() { $('#collapse-warnings').addClass('in'); } + /* Show the loading notification if nothing has happend after 1.5 + * seconds + */ + $(document).bind("ajaxStart", function(){ + if (ajaxLoadingTimer) + window.clearTimeout(ajaxLoadingTimer); + + ajaxLoadingTimer = window.setTimeout(function() { + $("#loading-notification").fadeIn(); + }, 1200); + }); + + $(document).bind("ajaxStop", function(){ + if (ajaxLoadingTimer) + window.clearTimeout(ajaxLoadingTimer); + + $("#loading-notification").fadeOut(); + }); + + function check_for_duplicate_ids () { /* warn about duplicate element ids */ var ids = {}; -- cgit v1.2.3-54-g00ecf