From 2a5aec1473a7be507ed7dd1c5f3b18c3e1f9acf8 Mon Sep 17 00:00:00 2001 From: Tira Odhner Date: Tue, 21 Mar 2017 09:24:23 -0400 Subject: [PATCH 3/3] Remove code that hides spinner after 900ms --- web/pgadmin/browser/templates/browser/index.html | 67 ++++-------------------- 1 file changed, 11 insertions(+), 56 deletions(-) diff --git a/web/pgadmin/browser/templates/browser/index.html b/web/pgadmin/browser/templates/browser/index.html index 5bd054a2..d5747005 100644 --- a/web/pgadmin/browser/templates/browser/index.html +++ b/web/pgadmin/browser/templates/browser/index.html @@ -2,65 +2,20 @@ {% block title %}{{ config.APP_NAME }}{% endblock %} {% block init_script %} try { -require( -['pgadmin', 'pgadmin.browser'], -function(pgAdmin, pgBrowser) { -pgBrowser.init(); -}, -function() { -/* TODO:: Show proper error dialog */ -console.log(arguments); -}); + require( + ['pgadmin', 'pgadmin.browser'], + function(pgAdmin, pgBrowser) { + pgBrowser.init(); + }, + function() { + /* TODO:: Show proper error dialog */ + console.log(arguments); + }); } catch (err) { -/* Show proper error dialog */ -console.log(err); + /* Show proper error dialog */ + console.log(err); } -/* - * Show loading spinner till every js module is loaded completely - * Referenced url: - * http://stackoverflow.com/questions/15581563/requirejs-load-script-progress - * Little bit tweaked as per need - */ -require.onResourceLoad = function (context, map, depMaps) { - var loadingStatusEl = panel = document.getElementById('pg-spinner'); - if (loadingStatusEl) { - if (!context) { - // we will call onResourceLoad(false) by ourselves when requirejs - // is not loading anything hide the indicator and exit - setTimeout(function() { - if (panel != null) { - $(panel).remove(); - return; - } - }, 500); - } - - // show indicator when any module is loaded and - // shedule requirejs status (loading/idle) check - panel.style.display = ""; - clearTimeout(panel.ttimer); - panel.ttimer = setTimeout(function () { - var context = require.s.contexts._; - var inited = true; - for (name in context.registry) { - var m = context.registry[name]; - if (m.inited !== true) { - inited = false; - break; - } - } - - // here the "inited" variable will be true, if requirejs is "idle", - // false if "loading" - if (inited) { - // will fire if module loads in 400ms. TODO: reset this timer - // for slow module loading - require.onResourceLoad(false); - } - }, 400) - } -}; {% endblock %} {% block body %}