mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Webpack all the things! Fixes #2135
This significantly speeds up loading of the application; in an average of 3 tests, v1.6 loaded in 11.5s in the runtime on a Mac, whilst the webpacked version of the code loaded in 5.53s.
This commit is contained in:
committed by
Dave Page
parent
d04ac7656a
commit
4a91bcde30
@@ -1,4 +1,4 @@
|
||||
define([
|
||||
define('misc.sql', [
|
||||
'sources/gettext', 'underscore', 'underscore.string', 'jquery', 'pgadmin.browser',
|
||||
'alertify', 'pgadmin.alertifyjs'
|
||||
], function(gettext, _, S, $, pgBrowser, Alertify) {
|
||||
@@ -8,6 +8,7 @@ define([
|
||||
if (pgBrowser.ShowNodeSQL.initialized) {
|
||||
return pgBrowser.ShowNodeSQL;
|
||||
}
|
||||
var wcDocker = window.wcDocker;
|
||||
|
||||
_.extend(pgBrowser.ShowNodeSQL, {
|
||||
init: function() {
|
||||
@@ -17,6 +18,7 @@ define([
|
||||
this.initialized = true;
|
||||
_.bindAll(this, 'showSQL', 'sqlPanelVisibilityChanged');
|
||||
|
||||
var sqlPanels;
|
||||
this.sqlPanels = sqlPanels = pgBrowser.docker.findPanels('sql');
|
||||
|
||||
// We will listend to the visibility change of the SQL panel
|
||||
@@ -64,6 +66,7 @@ define([
|
||||
**/
|
||||
this.timeout && clearTimeout(this.timeout);
|
||||
|
||||
var that = this;
|
||||
this.timeout = setTimeout(
|
||||
function() {
|
||||
var sql = '';
|
||||
@@ -75,11 +78,11 @@ define([
|
||||
treeHierarchy = node.getTreeNodeHierarchy(item);
|
||||
|
||||
// Avoid unnecessary reloads
|
||||
if (_.isEqual($(this.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
|
||||
if (_.isEqual($(that.sqlPanels[0]).data('node-prop'), treeHierarchy)) {
|
||||
return;
|
||||
}
|
||||
// Cache the current IDs for next time
|
||||
$(this.sqlPanels[0]).data('node-prop', treeHierarchy);
|
||||
$(that.sqlPanels[0]).data('node-prop', treeHierarchy);
|
||||
|
||||
if (node.hasSQL) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user