Re: [pgAdmin4]: Webpacking of static JS/CSS

2017-07-27 Thread Ashesh Vashi
On Thu, Jul 27, 2017 at 12:57 PM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> Please find attached patch 'move_js_files_static_dir' with --binary option.
>
As discussed, this patch should include changes related to moving the file
to static directory only, and not related to the dynamic path generation.

-- Thanks, Ashesh

>
> Thanks,
> Surinder
>
> On Thu, Jul 27, 2017 at 12:09 PM, Surinder Kumar <
> surinder.ku...@enterprisedb.com> wrote:
>
>> Hi Ashesh,
>>
>> Changes in patch:
>>
>> 1. I have removed duplicate function 'module_use_template_javascript'
>> from modules.
>> 2. This patches only contains changes for moving template/js to
>> static/js. I have excluded changes for making module paths dynamic as we
>> will be using different approach to handle that.
>> 3. Also, changed path references for JS modules to point to static/ dir
>> instead of template/js in webpack.shim.js and webpack.config.js .
>>
>> Please find attached patches
>>
>> Thanks,
>> Surinder
>>
>>
>> On Thu, Jul 27, 2017 at 10:33 AM, Surinder Kumar <
>> surinder.ku...@enterprisedb.com> wrote:
>>
>>> Ok. I will send rebased patch.
>>>
>>> On Thu, Jul 27, 2017 at 10:32 AM, Ashesh Vashi <
>>> ashesh.va...@enterprisedb.com> wrote:
>>>


 On Thu, Jul 27, 2017 at 10:22 AM, Ashesh Vashi <
 ashesh.va...@enterprisedb.com> wrote:

> Hi Surinder,
>
> 'delete_template_files.patch' is applied any more.
> Please send the rebased patches.
>
> I have also noticed in the 'move_js_files_to_static_directory.patch',
> couple of modules have two definitions for 
> 'module_use_template_javascript'
> method.
>
 Also - 'module_paths.json' is auto generated, please don't include that
 in the patch.

 -- Thanks, Ashesh

>
>
> --
>
> Thanks & Regards,
>
> Ashesh Vashi
> EnterpriseDB INDIA: Enterprise PostgreSQL Company
> 
>
>
> *http://www.linkedin.com/in/asheshvashi*
> 
>
> On Tue, Jul 25, 2017 at 3:56 PM, Surinder Kumar <
> surinder.ku...@enterprisedb.com> wrote:
>
>> Hi,
>>
>> Please find rebased patches and review.
>>
>> On Sat, Jul 22, 2017 at 1:03 AM, Surinder Kumar <
>> surinder.ku...@enterprisedb.com> wrote:
>>
>>> Hi,
>>>
>>> Following are the changes in patches attached:
>>>
>>> 1) Move Javascripts from Templates directory to Static for following
>>> modules:
>>>  - About
>>>  - Browser nodes
>>>  - Dashboard
>>>  - FileManager
>>>  - Vendor/snap.svg
>>>  - Preferences
>>>  - Settings
>>>  - Backup
>>>  - Datagrid
>>>  - Debugger
>>>  - Sqleditor
>>>  - Grant Wizard
>>>  - Import & Export
>>>  - Maintenance
>>>  - Restore and
>>>  - User Management
>>>
>>> 2) Generate module JS path references dynamically/ Remove manually
>>> written paths.
>>> Added a new file 'module_paths.json' which will update with absolute
>>> paths to module JS defined in every modules > __init__.py > 'def
>>> get_own_javascripts'.
>>>
>>> When Flask service is started, it accesses the all module
>>> javascripts using `current_app.javascripts` which is called inside an 
>>> route.
>>> This call to route is made using Flask's `test_client` and thus
>>> those paths are written to `module_paths.json`(in javascript_bundler.py)
>>> which is used by webpack.shim.js file.
>>>
>>> Three patches:
>>> 1. Move JS files to static directory
>>> 2. Deleted template JS
>>> 3. Generate JS paths before app starts
>>>
>>> These patches needs to be committed separately as deleted files
>>> includes in the commit that makes difficult to look for changes through
>>> `git log `
>>>
>>> Please review.
>>>
>>> Thanks,
>>> Surinder
>>>
>>>
>>>
>>> On Thu, Jul 20, 2017 at 6:08 PM, Dave Page 
>>> wrote:
>>>
 Thanks, applied.

 On Thu, Jul 20, 2017 at 1:35 PM, Surinder Kumar <
 surinder.ku...@enterprisedb.com> wrote:

> Hi Dave,
>
> Can you please review this patch please? I guess it was missed as
> i send 2 patches back to back in same email chain.
> Please find inline detailed description of issue.
>
> On Thu, Jul 20, 2017 at 12:37 PM, Surinder Kumar <
> surinder.ku...@enterprisedb.com> wrote:
>
>> Hi
>>
>> The loading icon image is used in FileManager and it is still
>> referenced from vendor `aciTree`(which is removed) so it gives 404 
>> not
>> found when FileManager is opened from Query tool/Backup utility.
>>
>> Please find attached patch and review.
>>
>> Thanks,
>> Surinder Kumar
>>
>
>
>>>

pgAdmin 4 commit: Moved the javascripts of different modules from 'temp

2017-07-27 Thread Ashesh Vashi
Moved the javascripts of different modules from 'templates' to 'static' 
directory.

Moving the javascripts for the following modules:
 - About
 - Browser nodes
 - Dashboard
 - FileManager
 - Vendor/snap.svg
 - Preferences
 - Settings
 - Backup
 - Datagrid
 - Debugger
 - Sqleditor
 - Grant Wizard
 - Import & Export
 - Maintenance
 - Restore and
 - User Management

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=6d5417709cda9af579e067ee91dadef8559d43bf
Author: Surinder Kumar 

Modified Files
--
web/pgadmin/about/static/js/about.js   |   54 +
web/pgadmin/about/templates/about/about.js |   54 -
web/pgadmin/browser/server_groups/__init__.py  |2 +-
.../foreign_servers/__init__.py|8 +
.../foreign_servers/static/js/foreign_server.js|  184 +
.../foreign_servers/js/foreign_servers.js  |  184 -
.../foreign_servers/user_mapping/__init__.py   |8 +
.../user_mapping/static/js/user_mapping.js |  165 +
.../templates/user_mappings/js/user_mappings.js|  165 -
.../schemas/catalog_objects/columns/__init__.py|8 +
.../columns/static/js/catalog_object_column.js |   71 +
.../js/catalog_object_column.js|   71 -
.../databases/schemas/foreign_tables/__init__.py   |8 +-
.../static/img/coll-foreign_table.png  |  Bin 0 -> 492 bytes
.../foreign_tables/static/img/foreign_table.png|  Bin 0 -> 563 bytes
.../foreign_tables/static/js/foreign_table.js  |  719 ++
.../foreign_tables/tests/test_foreign_table_add.py |2 +-
.../tests/test_foreign_table_delete.py |2 +-
.../foreign_tables/tests/test_foreign_table_get.py |2 +-
.../foreign_tables/tests/test_foreign_table_put.py |2 +-
.../schemas/packages/edbfuncs/__init__.py  |   16 +
.../schemas/packages/edbfuncs/static/js/edbfunc.js |  112 +
.../schemas/packages/edbfuncs/static/js/edbproc.js |   67 +
.../edbfuncs/templates/edbfunc/js/edbfunc.js   |  112 -
.../edbfuncs/templates/edbproc/js/edbproc.js   |   67 -
.../databases/schemas/packages/edbvars/__init__.py |8 +
.../schemas/packages/edbvars/static/js/edbvar.js   |   70 +
.../packages/edbvars/templates/edbvar/js/edbvar.js |   70 -
.../databases/schemas/tables/column/__init__.py|8 +
.../schemas/tables/column/static/js/column.js  |  734 ++
.../tables/column/templates/column/js/column.js|  734 --
.../schemas/tables/constraints/__init__.py |8 +
.../constraints/check_constraint/__init__.py   |   12 +-
.../check_constraint/static/js/check_constraint.js |  235 +
.../check_constraint/js/check_constraint.js|  235 -
.../tests/test_check_constraint_add.py |2 +-
.../tests/test_check_constraint_delete.py  |2 +-
.../tests/test_check_constraint_get.py |2 +-
.../tests/test_check_constraint_put.py |2 +-
.../constraints/exclusion_constraint/__init__.py   |8 +
.../static/js/exclusion_constraint.js  |  951 +++
.../js/exclusion_constraint.js |  949 ---
.../tables/constraints/foreign_key/__init__.py |8 +
.../foreign_key/static/js/foreign_key.js   | 1102 +++
.../templates/foreign_key/js/foreign_key.js| 1100 ---
.../constraints/index_constraint/__init__.py   |8 +
.../index_constraint/js/index_constraint.js|  569 --
.../tables/constraints/static/js/constraints.js|   56 +
.../templates/constraints/js/constraints.js|   56 -
.../databases/schemas/tables/indexes/__init__.py   |8 +
.../schemas/tables/indexes/static/js/index.js  |  515 ++
.../tables/indexes/templates/index/js/index.js |  515 --
.../databases/schemas/tables/rules/__init__.py |8 +
.../schemas/tables/rules/static/js/rule.js |  274 +
.../tables/rules/templates/rules/js/rules.js   |  274 -
.../databases/schemas/tables/triggers/__init__.py  |8 +
.../schemas/tables/triggers/static/js/trigger.js   |  634 ++
.../triggers/templates/trigger/js/trigger.js   |  634 --
.../servers/resource_groups/__init__.py|9 +
.../resource_groups/static/js/resource_group.js|  126 +
.../resource_groups/js/resource_groups.js  |  126 -
.../server_groups/servers/roles/__init__.py|8 +
.../server_groups/servers/roles/static/js/role.js  |  564 ++
.../servers/roles/templates/role/js/role.js|  564 --
.../server_groups/servers/static/js/server.js  |8 +-
.../server_groups/servers/tablespaces/__init__.py  |8 +
.../servers/tablespaces/static/js/tablespace.js|  406 +
.../templates/tablespaces/js/tablespaces.js|  406 -
.../server_groups/static/img/server_group.png  |  Bin 0 -> 504 bytes
.../server_groups/static/js/server-group.js|   82 -
.../server_groups/static/js/server_group.js|   82 +
.../browser/server_groups/tests/test_sg_get.py |2 +-
web/pgadmin/browser/static/js/browser.js

Re: [pgAdmin4]: Webpacking of static JS/CSS

2017-07-27 Thread Ashesh Vashi
On Thu, Jul 27, 2017 at 1:32 PM, Surinder Kumar <
surinder.ku...@enterprisedb.com> wrote:

> Hi Ashesh,
>
> I have removed changes which are not relevant to the moving file to static
> directory.
>
Committed the code for moving the javascript files from 'templates' to
'static' directory for most of the modules now.

I had to remove some redundant javascripts from the template directory
manually.

-- Thanks, Ashesh

>
> Please find updated patch.
>
> Thanks,
> Surinder
>
> On Thu, Jul 27, 2017 at 1:13 PM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>> On Thu, Jul 27, 2017 at 12:57 PM, Surinder Kumar <
>> surinder.ku...@enterprisedb.com> wrote:
>>
>>> Hi Ashesh,
>>>
>>> Please find attached patch 'move_js_files_static_dir' with --binary
>>> option.
>>>
>> As discussed, this patch should include changes related to moving the
>> file to static directory only, and not related to the dynamic path
>> generation.
>>
>> -- Thanks, Ashesh
>>
>>>
>>> Thanks,
>>> Surinder
>>>
>>> On Thu, Jul 27, 2017 at 12:09 PM, Surinder Kumar <
>>> surinder.ku...@enterprisedb.com> wrote:
>>>
 Hi Ashesh,

 Changes in patch:

 1. I have removed duplicate function 'module_use_template_javascript'
 from modules.
 2. This patches only contains changes for moving template/js to
 static/js. I have excluded changes for making module paths dynamic as we
 will be using different approach to handle that.
 3. Also, changed path references for JS modules to point to static/ dir
 instead of template/js in webpack.shim.js and webpack.config.js .

 Please find attached patches

 Thanks,
 Surinder


 On Thu, Jul 27, 2017 at 10:33 AM, Surinder Kumar <
 surinder.ku...@enterprisedb.com> wrote:

> Ok. I will send rebased patch.
>
> On Thu, Jul 27, 2017 at 10:32 AM, Ashesh Vashi <
> ashesh.va...@enterprisedb.com> wrote:
>
>>
>>
>> On Thu, Jul 27, 2017 at 10:22 AM, Ashesh Vashi <
>> ashesh.va...@enterprisedb.com> wrote:
>>
>>> Hi Surinder,
>>>
>>> 'delete_template_files.patch' is applied any more.
>>> Please send the rebased patches.
>>>
>>> I have also noticed in the 'move_js_files_to_static_directory.patch',
>>> couple of modules have two definitions for 
>>> 'module_use_template_javascript'
>>> method.
>>>
>> Also - 'module_paths.json' is auto generated, please don't include
>> that in the patch.
>>
>> -- Thanks, Ashesh
>>
>>>
>>>
>>> --
>>>
>>> Thanks & Regards,
>>>
>>> Ashesh Vashi
>>> EnterpriseDB INDIA: Enterprise PostgreSQL Company
>>> 
>>>
>>>
>>> *http://www.linkedin.com/in/asheshvashi*
>>> 
>>>
>>> On Tue, Jul 25, 2017 at 3:56 PM, Surinder Kumar <
>>> surinder.ku...@enterprisedb.com> wrote:
>>>
 Hi,

 Please find rebased patches and review.

 On Sat, Jul 22, 2017 at 1:03 AM, Surinder Kumar <
 surinder.ku...@enterprisedb.com> wrote:

> Hi,
>
> Following are the changes in patches attached:
>
> 1) Move Javascripts from Templates directory to Static for
> following modules:
>  - About
>  - Browser nodes
>  - Dashboard
>  - FileManager
>  - Vendor/snap.svg
>  - Preferences
>  - Settings
>  - Backup
>  - Datagrid
>  - Debugger
>  - Sqleditor
>  - Grant Wizard
>  - Import & Export
>  - Maintenance
>  - Restore and
>  - User Management
>
> 2) Generate module JS path references dynamically/ Remove manually
> written paths.
> Added a new file 'module_paths.json' which will update with
> absolute paths to module JS defined in every modules > __init__.py > 
> 'def
> get_own_javascripts'.
>
> When Flask service is started, it accesses the all module
> javascripts using `current_app.javascripts` which is called inside an 
> route.
> This call to route is made using Flask's `test_client` and thus
> those paths are written to `module_paths.json`(in 
> javascript_bundler.py)
> which is used by webpack.shim.js file.
>
> Three patches:
> 1. Move JS files to static directory
> 2. Deleted template JS
> 3. Generate JS paths before app starts
>
> These patches needs to be committed separately as deleted files
> includes in the commit that makes difficult to look for changes 
> through
> `git log `
>
> Please review.
>
> Thanks,
> Surinder
>
>
>
> On Thu, Jul 20, 2017 at 6:08 PM, Dave Page 
> wrote:
>
>> Thanks, applied.

Discussion on improving alertify notifications logic

2017-07-27 Thread Akshay Joshi
Hi All

As in commit "Update alertify alerts to use the styling defined in
the style guide":

https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff
;h=2a30a86e7d5e562040500f448fbb0d143ff2cff9

https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff
;h=f2d2075d81718ec02550fb592851aa330d327b24

We have introduce new wrapper class "AlertifyWrapper" and replace calls to
alertify.success and alertify.error with following two lines in most of the
files

var alertifyWrapper = new AlertifyWrapper();

alertifyWrapper.success(message);  or  alertifyWrapper.error(message);

For each call we are creating dynamic object of AlertifyWrapper and call
the appropriate function. For example there are 20 such calls in a single js
file every time are are creating object and call appropriate function.

I have tried to improve the logic here and implemented it as below:

   - Extend alertify and move success, error and info functions from "
   alertify_wrapper.js" file to "alertify.pgadmin.defaults.js", there will
   be no use of "alertify_wrapper.js"
   - Modify only "server.js" as POC, remove 'alertify' and replace
   'sources/alerts/alertify_wrapper' with 'pgadmin.alertifyjs' which is
   nothing but mapping of "alertify.pgadmin.defaults.js" from defines and
   named the reference object to 'alertify' so no need to change any function
   call like "alertify.success, alertify.error".

One more benefit of the above approach is if in future we want to use the
same style for alertify.warning, alertify.info, alertify.message etc.., we
will just have to extend that method in "alertify.pgadmin.defaults.js" and
no need to change the rest of the function call with AlertifyWrapper.

Attached is the POC patch, if it looks good then I'll start working on
replacing AlertifyWrapper with the above mentioned approach.

-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*


improved_alertify_wrapper.patch
Description: Binary data


Error using pgadmin4 HEAD

2017-07-27 Thread Dave Cramer
When I start pgadmin4 application I get the following error

The application server could not be contacted!

Thanks,

Dave Cramer


Re: Discussion on improving alertify notifications logic

2017-07-27 Thread Sarah McAlear
Hi Akshay!

That seems like a good idea. When we're using the extended
pgadmin.alerrtify in the codebase it would be beneficial to call it
pgAdminAlertify or something similar so that it is clear that it isn't only
the alertify library, but it's been extended.

Rob & Sarah

On Thu, Jul 27, 2017 at 9:41 PM, Akshay Joshi  wrote:

> Hi All
>
> As in commit "Update alertify alerts to use the styling defined in
> the style guide":
>
> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff;h=
> 2a30a86e7d5e562040500f448fbb0d143ff2cff9
>
> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff;h=
> f2d2075d81718ec02550fb592851aa330d327b24
>
> We have introduce new wrapper class "AlertifyWrapper" and replace calls
> to alertify.success and alertify.error with following two lines in most
> of the files
>
> var alertifyWrapper = new AlertifyWrapper();
>
> alertifyWrapper.success(message);  or  alertifyWrapper.error(message);
>
> For each call we are creating dynamic object of AlertifyWrapper and call
> the appropriate function. For example there are 20 such calls in a single
> js file every time are are creating object and call appropriate function.
>
>
> I have tried to improve the logic here and implemented it as below:
>
>- Extend alertify and move success, error and info functions from "
>alertify_wrapper.js" file to "alertify.pgadmin.defaults.js", there
>will be no use of "alertify_wrapper.js"
>- Modify only "server.js" as POC, remove 'alertify' and replace
>'sources/alerts/alertify_wrapper' with 'pgadmin.alertifyjs' which is
>nothing but mapping of "alertify.pgadmin.defaults.js" from defines and
>named the reference object to 'alertify' so no need to change any function
>call like "alertify.success, alertify.error".
>
> One more benefit of the above approach is if in future we want to use the
> same style for alertify.warning, alertify.info, alertify.message etc..,
> we will just have to extend that method in "alertify.pgadmin.defaults.js"
> and no need to change the rest of the function call with AlertifyWrapper.
>
>
> Attached is the POC patch, if it looks good then I'll start working on
> replacing AlertifyWrapper with the above mentioned approach.
>
> --
> *Akshay Joshi*
> *Principal Software Engineer *
>
>
>
> *Phone: +91 20-3058-9517 <+91%2020%203058%209517>Mobile: +91 976-788-8246
> <+91%2097678%2088246>*
>


Re: Error using pgadmin4 HEAD

2017-07-27 Thread Khushboo Vashi
Hi Dave,

Please provide below information to investigate:

1. OS Details
2. pgAdmin 4 version
3. The steps you followed to install the application


pgAdmin 4 documentation
 to help in
deployment process.

Thanks,
Khushboo

On Fri, Jul 28, 2017 at 3:08 AM, Dave Cramer  wrote:

> When I start pgadmin4 application I get the following error
>
> The application server could not be contacted!
>
> Thanks,
>
> Dave Cramer
>


Re: Discussion on improving alertify notifications logic

2017-07-27 Thread Akshay Joshi
Hi Sara

On Fri, Jul 28, 2017 at 9:19 AM, Sarah McAlear  wrote:

> Hi Akshay!
>
> That seems like a good idea. When we're using the extended
> pgadmin.alerrtify in the codebase it would be beneficial to call it
> pgAdminAlertify or something similar so that it is clear that it isn't only
> the alertify library, but it's been extended.
>

   Thanks, but If I understand to you correctly calling it pgAdminAlertify
will required code changes wherever alertify. is called.

>
> Rob & Sarah
>
> On Thu, Jul 27, 2017 at 9:41 PM, Akshay Joshi <
> akshay.jo...@enterprisedb.com> wrote:
>
>> Hi All
>>
>> As in commit "Update alertify alerts to use the styling defined in
>> the style guide":
>>
>> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff
>> ;h=2a30a86e7d5e562040500f448fbb0d143ff2cff9
>>
>> https://git.postgresql.org/gitweb/?p=pgadmin4.git;a=commitdiff
>> ;h=f2d2075d81718ec02550fb592851aa330d327b24
>>
>> We have introduce new wrapper class "AlertifyWrapper" and replace calls
>> to alertify.success and alertify.error with following two lines in most
>> of the files
>>
>> var alertifyWrapper = new AlertifyWrapper();
>>
>> alertifyWrapper.success(message);  or  alertifyWrapper.error(message);
>>
>> For each call we are creating dynamic object of AlertifyWrapper and call
>> the appropriate function. For example there are 20 such calls in a single
>> js file every time are are creating object and call appropriate
>> function.
>>
>> I have tried to improve the logic here and implemented it as below:
>>
>>- Extend alertify and move success, error and info functions from "
>>alertify_wrapper.js" file to "alertify.pgadmin.defaults.js", there
>>will be no use of "alertify_wrapper.js"
>>- Modify only "server.js" as POC, remove 'alertify' and replace
>>'sources/alerts/alertify_wrapper' with 'pgadmin.alertifyjs' which is
>>nothing but mapping of "alertify.pgadmin.defaults.js" from defines
>>and named the reference object to 'alertify' so no need to change any
>>function call like "alertify.success, alertify.error".
>>
>> One more benefit of the above approach is if in future we want to use the
>> same style for alertify.warning, alertify.info, alertify.message etc..,
>> we will just have to extend that method in "alertify.pgadmin.defaults.js"
>> and no need to change the rest of the function call with AlertifyWrapper.
>>
>>
>> Attached is the POC patch, if it looks good then I'll start working on
>> replacing AlertifyWrapper with the above mentioned approach.
>>
>> --
>> *Akshay Joshi*
>> *Principal Software Engineer *
>>
>>
>>
>> *Phone: +91 20-3058-9517 <+91%2020%203058%209517>Mobile: +91 976-788-8246
>> <+91%2097678%2088246>*
>>
>
>


-- 
*Akshay Joshi*
*Principal Software Engineer *



*Phone: +91 20-3058-9517Mobile: +91 976-788-8246*