diff --git a/docs/en_US/release_notes_4_2.rst b/docs/en_US/release_notes_4_2.rst index 79536ba2f..226b2e0ec 100644 --- a/docs/en_US/release_notes_4_2.rst +++ b/docs/en_US/release_notes_4_2.rst @@ -18,6 +18,7 @@ Bug fixes | `Bug #3475 `_ - Fixed execution time to show Hours part for long running queries in Query Tool. | `Bug #3608 `_ - Messages tab of query tool should be clear on subsequent execution of table/view using View/Edit Data. | `Bug #3609 `_ - Clear drop-down menu should be disabled for View/Edit Data. +| `Bug #3664 `_ - Fixed Statistics panel hang issue for 1000+ tables. | `Bug #3693 `_ - Proper error should be thrown when server group is created with existing name. | `Bug #3695 `_ - Ensure long string should be wrap in alertify dialogs. | `Bug #3697 `_ - Ensure that output of the query should be displayed even if Data Output window is detached from the Query Tool. diff --git a/web/pgadmin/browser/static/js/collection.js b/web/pgadmin/browser/static/js/collection.js index aa758afd5..6722b7c5a 100644 --- a/web/pgadmin/browser/static/js/collection.js +++ b/web/pgadmin/browser/static/js/collection.js @@ -188,7 +188,7 @@ define([ 'remove': function() { if (this.grid) { if (this.grid.collection) { - this.grid.collection.reset(null, {silent: true}); + this.grid.collection.reset({silent: true}); delete (this.grid.collection); } delete (this.grid); diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js index cfd573e1a..7cc1f633b 100644 --- a/web/pgadmin/misc/statistics/static/js/statistics.js +++ b/web/pgadmin/misc/statistics/static/js/statistics.js @@ -117,7 +117,7 @@ define('misc.statistics', [ _.bindAll( this, 'showStatistics', 'panelVisibilityChanged', - '__createMultiLineStatistics', '__createSingleLineStatistics'); + '__createMultiLineStatistics', '__createSingleLineStatistics', '__loadMoreRows'); _.extend( this, { @@ -253,10 +253,22 @@ define('misc.statistics', [ clearTimeout(timer); $msgContainer.text(''); if (res.data) { - var data = res.data; + var data = self.data = res.data; if (node.hasCollectiveStatistics || data['rows'].length > 1) { + // Listen scroll event to load more rows + pgBrowser.Events.on( + 'pgadmin-browser:panel-statistics:' + + wcDocker.EVENT.SCROLLED, + self.__loadMoreRows + ); self.__createMultiLineStatistics.call(self, data, node.statsPrettifyFields); } else { + // Do not listen the scroll event + pgBrowser.Events.off( + 'pgadmin-browser:panel-statistics:' + + wcDocker.EVENT.SCROLLED, + self.__loadMoreRows + ); self.__createSingleLineStatistics.call(self, data, node.statsPrettifyFields); } @@ -386,7 +398,17 @@ define('misc.statistics', [ } - this.collection.reset(rows); + this.collection.reset(rows.splice(0, 50)); + }, + + __loadMoreRows: function() { + let elem = $('.pg-panel-statistics-container').closest('.wcFrameCenter')[0]; + if ((elem.scrollHeight - 10) < elem.scrollTop + elem.offsetHeight) { + var rows = this.data['rows']; + if (rows.length > 0) { + this.collection.add(rows.splice(0, 50)); + } + } }, __createSingleLineStatistics: function(data, prettifyFields) {