Fixed Statistics panel hang issue for 1000+ tables. Fixes #3664

This commit is contained in:
Khushboo Vashi 2019-01-31 14:47:29 +05:30 committed by Akshay Joshi
parent 2afa3d8267
commit 6244463ac1
3 changed files with 27 additions and 4 deletions

View File

@ -18,6 +18,7 @@ Bug fixes
| `Bug #3475 <https://redmine.postgresql.org/issues/3475>`_ - Fixed execution time to show Hours part for long running queries in Query Tool.
| `Bug #3608 <https://redmine.postgresql.org/issues/3608>`_ - Messages tab of query tool should be clear on subsequent execution of table/view using View/Edit Data.
| `Bug #3609 <https://redmine.postgresql.org/issues/3609>`_ - Clear drop-down menu should be disabled for View/Edit Data.
| `Bug #3664 <https://redmine.postgresql.org/issues/3664>`_ - Fixed Statistics panel hang issue for 1000+ tables.
| `Bug #3693 <https://redmine.postgresql.org/issues/3693>`_ - Proper error should be thrown when server group is created with existing name.
| `Bug #3695 <https://redmine.postgresql.org/issues/3695>`_ - Ensure long string should be wrap in alertify dialogs.
| `Bug #3697 <https://redmine.postgresql.org/issues/3697>`_ - Ensure that output of the query should be displayed even if Data Output window is detached from the Query Tool.

View File

@ -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);

View File

@ -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) {