public inbox for [email protected]
help / color / mirror / Atom feedFrom: Khushboo Vashi <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
Date: Thu, 17 Jan 2019 11:35:48 +0530
Message-ID: <CAFOhELfJZCeQ2tE3_H7vUXQJ2uk6PF0u=wgoy494OUtX=UDjHQ@mail.gmail.com> (raw)
Hi,
Please find the attached patch to fix the RM 3664 - Statistic panel hangs
when 1000+ tables
The statistics tab hangs with more rows. So, now the rows will be pushed in
the backgrid collection in bunches on scroll event to fix this issue.
Thanks,
Khushboo
Attachments:
[application/octet-stream] RM_3664.patch (2.0K, 3-RM_3664.patch)
download | inline diff:
diff --git a/web/pgadmin/misc/statistics/static/js/statistics.js b/web/pgadmin/misc/statistics/static/js/statistics.js
index cfd573e1..d01d5c15 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,14 @@ define('misc.statistics', [
}
- this.collection.reset(rows);
+ this.collection.reset(rows.splice(0, 50));
+ },
+
+ __loadMoreRows: function(data, prettifyFields) {
+ var rows = this.data['rows'];
+ if (rows.length > 0) {
+ this.collection.add(rows.splice(0, 50));
+ }
},
__createSingleLineStatistics: function(data, prettifyFields) {
view thread (6+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected]
Subject: Re: [pgAdmin4][Patch] - RM 3664 - Statistic panel hangs when 1000+ tables
In-Reply-To: <CAFOhELfJZCeQ2tE3_H7vUXQJ2uk6PF0u=wgoy494OUtX=UDjHQ@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox