Optimize Webpack to improve overall performance.

Changes include:
1) Remove underscore-string and sprintf-js packages as we were using only %s. Instead, added a function to do the same. Also changed gettext to behave like sprintf directly.
2) backgrid.sizeable.columns was not used anywhere, removed. @babel/polyfill is deprecated, replaced it with core-js.
3) Moved few css to make sure they get minified and bundled.
4) Added Flask-Compress to send static files as compressed gzip. This will reduce network traffic and improve initial load time for pgAdmin.
5) Split few JS files to make code reusable.
6) Lazy load few modules like leaflet, wkx is required only if geometry viewer is opened. snapsvg loaded only when explain plan is executed. This will improve sqleditor initial opening time.

Reviewed By: Khushboo Vashi
Fixes #4701
This commit is contained in:
Aditya Toshniwal
2019-10-10 12:05:28 +05:30
committed by Akshay Joshi
parent e5638b520d
commit f16498a8a7
97 changed files with 1896 additions and 1355 deletions

View File

@@ -9,10 +9,10 @@
define('pgadmin.node.database', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore',
'underscore.string', 'sources/pgadmin', 'pgadmin.browser.utils',
'sources/utils', 'sources/pgadmin', 'pgadmin.browser.utils',
'pgadmin.alertifyjs', 'pgadmin.backform', 'pgadmin.browser.collection',
'pgadmin.browser.server.privilege', 'pgadmin.browser.server.variable',
], function(gettext, url_for, $, _, S, pgAdmin, pgBrowser, Alertify, Backform) {
], function(gettext, url_for, $, _, pgadminUtils, pgAdmin, pgBrowser, Alertify, Backform) {
if (!pgBrowser.Nodes['coll-database']) {
pgBrowser.Nodes['coll-database'] =
@@ -190,7 +190,7 @@ define('pgadmin.node.database', [
Alertify.confirm(
gettext('Disconnect the database'),
S(gettext('Are you sure you want to disconnect the database - %s?')).sprintf(d.label).value(),
pgadminUtils.sprintf(gettext('Are you sure you want to disconnect the database - %s?'), d.label),
function() {
var data = d;
$.ajax({