Thread: [pgAdmin4][Patch]: Using client-side 'url_for' implementation in thedatagrid module

Hi

Changes:

1. Replace Jinja {{ url_for }} with js 'url_for'

2. While minifying JS using webpack, the code to open QueryToolPanel and DatagridPanel wasn't working. This is fixed.

Please find attached patch.

Thanks,
Surinder Kumar
Attachment
Thanks, patch applied.

On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi
>
> Changes:
>
> 1. Replace Jinja {{ url_for }} with js 'url_for'
>
> 2. While minifying JS using webpack, the code to open QueryToolPanel and
> DatagridPanel wasn't working. This is fixed.
>
> Please find attached patch.
>
> Thanks,
> Surinder Kumar



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Hi Dave,

Due to this commit all features test cases which requires query tool are failing. Reason for this is additional dummy iframe added in panel.

@@ -463,7 +501,16 @@ define([
    * create new panel and add it to the dashboard panel.
    */
   var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
-              queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED, dashboardPanel[0]);
+              var $frameArea = $('<div style="position:absolute;top:0 !important;width:100%;height:100%;display:table">');
+
+              var queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED, dashboardPanel[0]);
+              queryToolPanel.layout().addItem($frameArea);
+              // Initialize empty frame
+              var frame = new wcIFrame($frameArea, queryToolPanel);
+              $(queryToolPanel).data('frameInitialized', false);
+              $(queryToolPanel).data('embeddedFrame', frame);
+
+              // Set panel title and icon
   queryToolPanel.title('<span title="'+panel_title+'">'+panel_title+'</span>');
   queryToolPanel.icon('fa fa-bolt');

Surinder is looking into this. I'm holding patch for RM2137 (on demand loading of result set) until this is fixed.

Thanks,



-- 
Harshal Dhumal
Sr. Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jun 26, 2017 at 5:13 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks, patch applied.

On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi
>
> Changes:
>
> 1. Replace Jinja {{ url_for }} with js 'url_for'
>
> 2. While minifying JS using webpack, the code to open QueryToolPanel and
> DatagridPanel wasn't working. This is fixed.
>
> Please find attached patch.
>
> Thanks,
> Surinder Kumar



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


Hi

Please find attached patch to revert the query tool/datagrid panel changes.

I found the frame assigned to panel after its creation is set to 'undefined' from somewhere in code(after webpack minify) so earlier implementation is right. I will fix and send it along webpack patch.

Thanks,
Surinder

On Mon, Jun 26, 2017 at 6:54 PM, Harshal Dhumal <harshal.dhumal@enterprisedb.com> wrote:
Hi Dave,

Due to this commit all features test cases which requires query tool are failing. Reason for this is additional dummy iframe added in panel.

@@ -463,7 +501,16 @@ define([
    * create new panel and add it to the dashboard panel.
    */
   var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
-              queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED, dashboardPanel[0]);
+              var $frameArea = $('<div style="position:absolute;top:0 !important;width:100%;height:100%;display:table">');
+
+              var queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED, dashboardPanel[0]);
+              queryToolPanel.layout().addItem($frameArea);
+              // Initialize empty frame
+              var frame = new wcIFrame($frameArea, queryToolPanel);
+              $(queryToolPanel).data('frameInitialized', false);
+              $(queryToolPanel).data('embeddedFrame', frame);
+
+              // Set panel title and icon
   queryToolPanel.title('<span title="'+panel_title+'">'+panel_title+'</span>');
   queryToolPanel.icon('fa fa-bolt');

Surinder is looking into this. I'm holding patch for RM2137 (on demand loading of result set) until this is fixed.

Thanks,



-- 
Harshal Dhumal
Sr. Software Engineer

EnterpriseDB India: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

On Mon, Jun 26, 2017 at 5:13 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks, patch applied.

On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi
>
> Changes:
>
> 1. Replace Jinja {{ url_for }} with js 'url_for'
>
> 2. While minifying JS using webpack, the code to open QueryToolPanel and
> DatagridPanel wasn't working. This is fixed.
>
> Please find attached patch.
>
> Thanks,
> Surinder Kumar



--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Attachment
Thanks, applied.

On Mon, Jun 26, 2017 at 12:10 PM, Surinder Kumar
<surinder.kumar@enterprisedb.com> wrote:
> Hi
>
> Please find attached patch to revert the query tool/datagrid panel changes.
>
> I found the frame assigned to panel after its creation is set to 'undefined'
> from somewhere in code(after webpack minify) so earlier implementation is
> right. I will fix and send it along webpack patch.
>
> Thanks,
> Surinder
>
> On Mon, Jun 26, 2017 at 6:54 PM, Harshal Dhumal
> <harshal.dhumal@enterprisedb.com> wrote:
>>
>> Hi Dave,
>>
>> Due to this commit all features test cases which requires query tool are
>> failing. Reason for this is additional dummy iframe added in panel.
>>
>> @@ -463,7 +501,16 @@ define([
>>     * create new panel and add it to the dashboard panel.
>>     */
>>    var dashboardPanel = pgBrowser.docker.findPanels('dashboard');
>> -              queryToolPanel = pgBrowser.docker.addPanel('frm_datagrid',
>> wcDocker.DOCK.STACKED, dashboardPanel[0]);
>> +              var $frameArea = $('<div style="position:absolute;top:0
>> !important;width:100%;height:100%;display:table">');
>> +
>> +              var queryToolPanel =
>> pgBrowser.docker.addPanel('frm_datagrid', wcDocker.DOCK.STACKED,
>> dashboardPanel[0]);
>> +              queryToolPanel.layout().addItem($frameArea);
>> +              // Initialize empty frame
>> +              var frame = new wcIFrame($frameArea, queryToolPanel);
>> +              $(queryToolPanel).data('frameInitialized', false);
>> +              $(queryToolPanel).data('embeddedFrame', frame);
>> +
>> +              // Set panel title and icon
>>    queryToolPanel.title('<span
>> title="'+panel_title+'">'+panel_title+'</span>');
>>    queryToolPanel.icon('fa fa-bolt');
>>
>> Surinder is looking into this. I'm holding patch for RM2137 (on demand
>> loading of result set) until this is fixed.
>>
>> Thanks,
>>
>>
>>
>> --
>> Harshal Dhumal
>> Sr. Software Engineer
>>
>> EnterpriseDB India: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>> On Mon, Jun 26, 2017 at 5:13 PM, Dave Page <dpage@pgadmin.org> wrote:
>>>
>>> Thanks, patch applied.
>>>
>>> On Mon, Jun 26, 2017 at 2:05 AM, Surinder Kumar
>>> <surinder.kumar@enterprisedb.com> wrote:
>>> > Hi
>>> >
>>> > Changes:
>>> >
>>> > 1. Replace Jinja {{ url_for }} with js 'url_for'
>>> >
>>> > 2. While minifying JS using webpack, the code to open QueryToolPanel
>>> > and
>>> > DatagridPanel wasn't working. This is fixed.
>>> >
>>> > Please find attached patch.
>>> >
>>> > Thanks,
>>> > Surinder Kumar
>>>
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>>
>>
>



-- 
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company