Thread: pgAdmin 4 commit: Introduced a event manager for the browser, which wil

pgAdmin 4 commit: Introduced a event manager for the browser, which wil

From
Ashesh Vashi
Date:
Introduced a event manager for the browser, which will generate certain
known events, when any activity happens on the browser layout.

The following types of events will be triggered through the browser
event manager.
- pgadmin-browser:frame:* [1]
- pgadmin-browser:frame-<name>:* [1]
- pgadmin-browser:panel:* [1]
- pgadmin-browser:panel-<name>:* [1]
- pgadmin-browser:panel
- pgadmin-browser:frame
- pgadmin-browser:tree
- pgadmin-browser:tree:* [2]

[1] The '*' denotes some of the events generated by the wcDocker, which
    can be useful to do some operations.
    These events are:
    + wcDocker.EVENT.UPDATED
    + wcDocker.EVENT.VISIBILITY_CHANGED
    + wcDocker.EVENT.BEGIN_DOCK
    + wcDocker.EVENT.END_DOCK
    + wcDocker.EVENT.GAIN_FOCUS,
    + wcDocker.EVENT.LOST_FOCUS
    + wcDocker.EVENT.CLOSED
    + wcDocker.EVENT.BUTTON
    + wcDocker.EVENT.ATTACHED
    + wcDocker.EVENT.DETACHED
    + wcDocker.EVENT.MOVE_STARTED
    + wcDocker.EVENT.MOVE_ENDED
    + wcDocker.EVENT.MOVED
    + wcDocker.EVENT.RESIZE_STARTED
    + wcDocker.EVENT.RESIZE_ENDED
    + wcDocker.EVENT.RESIZED
    + wcDocker.EVENT.SCROLLED

[2] The '*' denotes all the events generated by the Browser Tree
    (aciTree).

The extension modules can utilize these events to do some operations on
nodes, and panels.

This patch includes showing 'Reversed Engineered Query' for the selected
node (if allowed) using the above approch.

The ShowNodeSQL module looks for two events.
1. SQL Panel Visibility change.
   - Based on the visibility of that panel, we start/stop listening the
     node selection event.
2. Node Selection in Browser tree
   - Based on the selected node type, it will look for 'hasSQL'
     parameter of the node, and fetch the Query from the server, and
     show it in the SQL editor.

Branch
------
master

Details
-------
http://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=8120b380bbbc2bb4635f29da44d1b0d7f43320ae

Modified Files
--------------
web/pgadmin/browser/static/js/datamodel.js         |  4 +-
web/pgadmin/browser/static/js/frame.js             | 69 ++++++++++++++----
web/pgadmin/browser/static/js/panel.js             | 32 +++++++-
.../browser/templates/browser/js/browser.js        | 58 +++++----------
web/pgadmin/browser/templates/browser/js/node.js   |  2 +
web/pgadmin/misc/sql/__init__.py                   | 29 ++++++++
web/pgadmin/misc/sql/static/js/sql.js              | 85 ++++++++++++++++++++++
7 files changed, 224 insertions(+), 55 deletions(-)