[pgAdmin4][Patch]: Load module's JS files only when required

From: Surinder Kumar <surinder(dot)kumar(at)enterprisedb(dot)com>
To: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: [pgAdmin4][Patch]: Load module's JS files only when required
Date: 2017-05-22 05:50:26
Message-ID: CAM5-9D92zW=qJqKT_HFjtMQvOAXuz5a5DJuABnz9fWWLKeZZrw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi

As per pgAdmin4 design, template JS files can either be preloaded or load
when a specific node expands (by adding for e.g.: when: 'server').

The JS files of several modules found to be loaded when pgAdmin4 loads
which results in increasing:

- the number of http requests
- latency(greater request time)
- pgAdmin4 load time

*Tested on Firefox:*

Before applying patch

- http requests - 143
- Content size - 3.4 MB
- Load time: 4.1s (onload: 524ms)

After applying patch

- http requests: 68
- Content size: 2.1 MB
- Load time: 2.84s (onload: 481ms)

Also, I found the http request for gravtar takes much time(depending on
internet speed) to load which increases load time.
https://secure.gravatar.com/avatar/d30aea269994f01256a99a8e7154a328?s=100&d=retro&r=g

Shouldn't the gravatar image be replaced with custom image ? I don't see
its any use except displaying for user.

*Patch changes:*

1) Load following modules JS when 'servers' node expands:

- Roles
- FileManager
- Backup
- Datagrid
- Grant wizard
- Import/Export, Maintenance & restore
- Sqleditor

2) Load Debugger JS when database node expands

3) Load Flotr2 when render function is called in dashboard.js

4) Load BigNumber library when sorting is performed on Statistics tab in
backgrid.pgadmin.js

5) Remove 'backgrid.select.all' from dependency list(user_management.js) as
it had no use.

After applying this patch, Menu items such "Query tool", "Grant wizard"
don't appear in Tools menu.
I have logged an RM2424 <https://redmine.postgresql.org/issues/2424> to
track this.

Please find attached patch and review.

Thanks
Surinder

Attachment Content-Type Size
load_module_js_when_required.patch application/octet-stream 16.5 KB

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Akshay Joshi 2017-05-22 09:28:09 Re: Declarative partitioning in pgAdmin4
Previous Message Dave Page 2017-05-21 14:06:58 Re: [Design update] Style guide for pgAdmin4