diff --git a/web/pgadmin/browser/templates/browser/js/browser.js b/web/pgadmin/browser/templates/browser/js/browser.js index ae99ff6..e5d6dc0 100644 --- a/web/pgadmin/browser/templates/browser/js/browser.js +++ b/web/pgadmin/browser/templates/browser/js/browser.js @@ -284,7 +284,8 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { allowContextMenu: true, allowCollapse: false, themePath: '../static/css/wcDocker/Themes', - theme: 'pgadmin' + theme: 'pgadmin', + loadingClass: 'pg_spinner' }); if (obj.docker) { // Initialize all the panels @@ -299,8 +300,6 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { // Stored layout in database from the previous session var layout = '{{ layout }}'; - obj.docker.startLoading('{{ _('Loading...') }}'); - // Try to restore the layout if there is one if (layout != '') { try { @@ -313,10 +312,6 @@ function(require, $, _, S, Bootstrap, pgAdmin, alertify, CodeMirror) { } else { obj.buildDefaultLayout() } - - obj.docker.on(wcDocker.EVENT.LOADED, function() { - obj.docker.finishLoading(500); - }); } // Syntax highlight the SQL Pane diff --git a/web/pgadmin/browser/templates/browser/js/collection.js b/web/pgadmin/browser/templates/browser/js/collection.js index 776ac4c..6a8a49e 100644 --- a/web/pgadmin/browser/templates/browser/js/collection.js +++ b/web/pgadmin/browser/templates/browser/js/collection.js @@ -91,11 +91,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) { }; if (view) { - // Release the view - view.remove({data: true, internal: true, silent: true}); - // Deallocate the view - delete view; - view = null; + panel.startLoading(); // Reset the data object j.data('obj-view', null); } @@ -107,6 +103,7 @@ function($, _, S, pgAdmin, Backbone, Alertify, Backform) { // Render subNode grid content.append(grid.render().$el); j.append(content); + panel.finishLoading(500); // Fetch Data collection.fetch({reset: true}) diff --git a/web/pgadmin/browser/templates/browser/js/node.js b/web/pgadmin/browser/templates/browser/js/node.js index 247966e..cad2498 100644 --- a/web/pgadmin/browser/templates/browser/js/node.js +++ b/web/pgadmin/browser/templates/browser/js/node.js @@ -789,6 +789,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { properties = function() { var panel = this; + panel.startLoading(); if (!content.hasClass('has-pg-prop-btn-group')) content.addClass('has-pg-prop-btn-group'); @@ -818,6 +819,7 @@ function($, _, S, pgAdmin, Menu, Backbone, Alertify, pgBrowser, Backform) { // Save it for release it later j.data('obj-view', view); + panel.finishLoading(500); // Create status bar createStatusBar('footer'); diff --git a/web/pgadmin/dashboard/templates/dashboard/js/dashboard.js b/web/pgadmin/dashboard/templates/dashboard/js/dashboard.js index 9a470d9..9dbd20d 100644 --- a/web/pgadmin/dashboard/templates/dashboard/js/dashboard.js +++ b/web/pgadmin/dashboard/templates/dashboard/js/dashboard.js @@ -31,6 +31,7 @@ function(r, $, pgAdmin, _, Backbone) { if (dashboardPanel) { var div = dashboardPanel.layout().scene().find('.pg-panel-content'); + dashboardPanel.startLoading(); if (div) { $.ajax({ url: url, @@ -38,6 +39,7 @@ function(r, $, pgAdmin, _, Backbone) { dataType: "html", success: function (data) { $(div).html(data); + dashboardPanel.finishLoading(500); }, error: function (xhr, status) { $(div).html( @@ -102,12 +104,14 @@ function(r, $, pgAdmin, _, Backbone) { // Clear out everything so any existing timers die off $(div).empty(); + dashboardPanel.startLoading(); $.ajax({ url: url, type: "GET", dataType: "html", success: function (data) { + dashboardPanel.finishLoading(500); $(div).html(data); }, error: function (xhr, status) { diff --git a/web/pgadmin/misc/depends/static/js/depends.js b/web/pgadmin/misc/depends/static/js/depends.js index d7534c8..3e537c7 100644 --- a/web/pgadmin/misc/depends/static/js/depends.js +++ b/web/pgadmin/misc/depends/static/js/depends.js @@ -72,8 +72,8 @@ define( */ var appendGridToPanel = function(collection, panel, is_dependent) { var $container = panel[0].layout().scene().find('.pg-panel-content'), - $gridContainer = $container.find('.pg-panel-depends-container'), - grid = new Backgrid.Grid({ + $gridContainer = $container.find('.pg-panel-depends-container'); + self.grid = grid = new Backgrid.Grid({ columns: [ { name : 'type', @@ -105,6 +105,7 @@ define( collection: collection, className: "backgrid presentation table backgrid-striped table-bordered table-hover", }); + panel[0].startLoading(); // Condition is used to save grid object to change the label of the header. if (is_dependent) @@ -113,6 +114,7 @@ define( self.dependenciesGrid = grid; $gridContainer.append(grid.render().el); + panel[0].finishLoading(500); return true; }; @@ -197,6 +199,7 @@ define( */ msg = messages[2]; $msgContainer.text(msg); + panel[0].startLoading(); /* Updating the label for the 'field' type of the backbone model. * Label should be "Database" if the node type is tablespace or role @@ -210,15 +213,16 @@ define( this.dependentGrid.columns.models[2].set({'label': 'Restriction'}); } + // Hide the message container and show the grid container. + $msgContainer.addClass('hidden'); + $gridContainer.removeClass('hidden'); // Set the url, fetch the data and update the collection collection.url = url; collection.fetch({ reset: true, success: function(res) { - - // In case of success hide the message container and show the grid container. - $gridContainer.removeClass('hidden'); - $msgContainer.addClass('hidden'); + // Hide loading icons once collection is retrieved. + panel[0].finishLoading(500); }, error: function() { } diff --git a/web/pgadmin/misc/sql/static/js/sql.js b/web/pgadmin/misc/sql/static/js/sql.js index 4e13c01..be3c07c 100644 --- a/web/pgadmin/misc/sql/static/js/sql.js +++ b/web/pgadmin/misc/sql/static/js/sql.js @@ -16,7 +16,7 @@ function(_, $, pgBrowser) { this.initialized = true; _.bindAll(this, 'showSQL', 'sqlPanelVisibilityChanged'); - var sqlPanels = pgBrowser.docker.findPanels('sql'); + this.sqlPanels = sqlPanels = pgBrowser.docker.findPanels('sql'); // We will listend to the visibility change of the SQL panel pgBrowser.Events.on( @@ -62,6 +62,8 @@ function(_, $, pgBrowser) { sql = '-- ' + pgBrowser.messages.NODE_HAS_NO_SQL; if (node.hasSQL) { + var self = this; + this.sqlPanels[0].startLoading(); sql = ''; var url = node.generate_url(item, 'sql', data, true); @@ -70,6 +72,7 @@ function(_, $, pgBrowser) { type:'GET', success: function(res) { if (pgAdmin.Browser.editor.getValue() != res) { + self.sqlPanels[0].finishLoading(500); pgAdmin.Browser.editor.setValue(res); } }, @@ -85,6 +88,8 @@ function(_, $, pgBrowser) { if (sql != '') { pgAdmin.Browser.editor.setValue(sql); } + // stop loading icon if no data is received + this.sqlPanels[0].finishLoading(500); }, 400); }, sqlPanelVisibilityChanged: function(panel) { diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js index 5278271..c0903e6 100644 --- a/web/pgadmin/misc/statistics/static/js/statistics.js +++ b/web/pgadmin/misc/statistics/static/js/statistics.js @@ -159,6 +159,7 @@ function(_, $, pgBrowser, Backgrid) { */ msg = ''; $msgContainer.text(msg); + this.panel[0].startLoading(); // Set the url, fetch the data and update the collection $.ajax({ @@ -166,6 +167,7 @@ function(_, $, pgBrowser, Backgrid) { type:'GET', success: function(res) { if (res.data) { + self.panel[0].finishLoading(500); var data = res.data; if (node.hasCollectiveStatistics || data['rows'].length > 1) { self.__createMultiLineStatistics.call(self, data); diff --git a/web/pgadmin/static/css/overrides.css b/web/pgadmin/static/css/overrides.css index 34b3dfc..26d6f3d 100755 --- a/web/pgadmin/static/css/overrides.css +++ b/web/pgadmin/static/css/overrides.css @@ -1354,3 +1354,9 @@ height: calc(100% - 35px); table.backgrid { overflow: auto; } + +.pg_spinner { + background: url("../../browser/static/css/aciTree/image/load-root.gif") no-repeat; + width: 32px; + height: 32px; +}