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,13 +9,13 @@
define('pgadmin.node.server', [
'sources/gettext', 'sources/url_for', 'jquery', 'underscore', 'backbone',
'underscore.string', 'sources/pgadmin', 'pgadmin.browser',
'sources/pgadmin', 'pgadmin.browser',
'pgadmin.server.supported_servers', 'pgadmin.user_management.current_user',
'pgadmin.alertifyjs', 'pgadmin.backform',
'sources/browser/server_groups/servers/model_validation',
'pgadmin.browser.server.privilege',
], function(
gettext, url_for, $, _, Backbone, S, pgAdmin, pgBrowser,
gettext, url_for, $, _, Backbone, pgAdmin, pgBrowser,
supported_servers, current_user, Alertify, Backform,
modelValidation
) {
@@ -260,10 +260,7 @@ define('pgadmin.node.server', [
if (notify) {
Alertify.confirm(
gettext('Disconnect server'),
gettext(
'Are you sure you want to disconnect the server %(server)s?',
{server: d.label}
),
gettext('Are you sure you want to disconnect the server %s?', d.label),
function() { disconnect(); },
function() { return true;}
);
@@ -310,9 +307,7 @@ define('pgadmin.node.server', [
Alertify.confirm(
gettext('Reload server configuration'),
S(
gettext('Are you sure you want to reload the server configuration on %s?')
).sprintf(d.label).value(),
gettext('Are you sure you want to reload the server configuration on %s?', d.label),
function() {
$.ajax({
url: obj.generate_url(i, 'reload', d, true),
@@ -643,9 +638,7 @@ define('pgadmin.node.server', [
Alertify.confirm(
gettext('Clear saved password'),
S(
gettext('Are you sure you want to clear the saved password for server %s?')
).sprintf(d.label).value(),
gettext('Are you sure you want to clear the saved password for server %s?', d.label),
function() {
$.ajax({
url: obj.generate_url(i, 'clear_saved_password', d, true),
@@ -683,9 +676,7 @@ define('pgadmin.node.server', [
Alertify.confirm(
gettext('Clear SSH Tunnel password'),
S(
gettext('Are you sure you want to clear the saved password of SSH Tunnel for server %s?')
).sprintf(d.label).value(),
gettext('Are you sure you want to clear the saved password of SSH Tunnel for server %s?', d.label),
function() {
$.ajax({
url: obj.generate_url(i, 'clear_sshtunnel_password', d, true),