Thread: [pgAdmin4] Patch: Added new Control SqlFieldControl

[pgAdmin4] Patch: Added new Control SqlFieldControl

From
Surinder Kumar
Date:
Hi,


Please find patch for SqlFieldControl.

This control allows the user to write/edit SQL queries.

To use SqlFieldControl, Set control property of field to 'sql-field' in model's schema like:

{
          id: 'definition', label:'{{ _('Definition') }}', cell: 'string', 
          control: 'sql-field'
}



Regards,
Surinder Kumar
Attachment

Re: [pgAdmin4] Patch: Added new Control SqlFieldControl

From
Ashesh Vashi
Date:
Hi Surinder,

On Tue, Feb 2, 2016 at 1:05 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,


Please find patch for SqlFieldControl.
Thanks for the patch. 

This control allows the user to write/edit SQL queries.

To use SqlFieldControl, Set control property of field to 'sql-field' in model's schema like:

{
          id: 'definition', label:'{{ _('Definition') }}', cell: 'string', 
          control: 'sql-field'
}
K.


Please extend the SqlFieldContorl from the Backform.TextareaControl instead of Backform.Control.

* Do not need to set events, TextareaControl has handled those events.
* Extend 'getValueFromDom' function in order to get the value from the sql, and set it to the model.
* Don't listen to the 'pg-property-tab-changed' event here. (It is redundant here).
  In your implementation, you're already refreshing lazely using setTimeout function, which should refresh issue of CodeMirror any way.

As per our personal discussion, please update the 'updateInvalid' function for the Control to look for only the 'input' tag with 'name' attribute.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

 



Regards,
Surinder Kumar


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Re: [pgAdmin4] Patch: Added new Control SqlFieldControl

From
Ashesh Vashi
Date:
Hi Surinder,

[Please do not forget to "Reply All" (and, not reply to me personally)..]

On Wed, Feb 3, 2016 at 4:37 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,

Please find the patch with suggested changes.
I've updated the patch with some minor changes.
Please test me, and let me know (if it is working in your environment  with the view node, which you're working on.)


--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi



Thanks
Surinder Kumar

On Wed, Feb 3, 2016 at 10:49 AM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Surinder,

On Tue, Feb 2, 2016 at 1:05 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,


Please find patch for SqlFieldControl.
Thanks for the patch. 

This control allows the user to write/edit SQL queries.

To use SqlFieldControl, Set control property of field to 'sql-field' in model's schema like:

{
          id: 'definition', label:'{{ _('Definition') }}', cell: 'string', 
          control: 'sql-field'
}
K.


Please extend the SqlFieldContorl from the Backform.TextareaControl instead of Backform.Control.
Done 

* Do not need to set events, TextareaControl has handled those events.
Done 
* Extend 'getValueFromDom' function in order to get the value from the sql, and set it to the model.
Done 
* Don't listen to the 'pg-property-tab-changed' event here. (It is redundant here).
  In your implementation, you're already refreshing lazely using setTimeout function, which should refresh issue of CodeMirror any way.
 
There is an issue with Code mirror control, so after discussion its added.   

As per our personal discussion, please update the 'updateInvalid' function for the Control to look for only the 'input' tag with 'name' attribute.
 
As per discussion, this change is required for all 'input' tag, so removed it from SqlFieldControl and changed it in updateInvalid function

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

 



Regards,
Surinder Kumar


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers




Attachment

Re: [pgAdmin4] Patch: Added new Control SqlFieldControl

From
Surinder Kumar
Date:


On Wed, Feb 3, 2016 at 4:58 PM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Surinder,

[Please do not forget to "Reply All" (and, not reply to me personally)..]
Ok I will remember. 

On Wed, Feb 3, 2016 at 4:37 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,

Please find the patch with suggested changes.
I've updated the patch with some minor changes.
Please test me, and let me know (if it is working in your environment  with the view node, which you're working on.)
Yes, I applied the patch and Its working with view node.


--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi



Thanks
Surinder Kumar

On Wed, Feb 3, 2016 at 10:49 AM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Surinder,

On Tue, Feb 2, 2016 at 1:05 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,


Please find patch for SqlFieldControl.
Thanks for the patch. 

This control allows the user to write/edit SQL queries.

To use SqlFieldControl, Set control property of field to 'sql-field' in model's schema like:

{
          id: 'definition', label:'{{ _('Definition') }}', cell: 'string', 
          control: 'sql-field'
}
K.


Please extend the SqlFieldContorl from the Backform.TextareaControl instead of Backform.Control.
Done 

* Do not need to set events, TextareaControl has handled those events.
Done 
* Extend 'getValueFromDom' function in order to get the value from the sql, and set it to the model.
Done 
* Don't listen to the 'pg-property-tab-changed' event here. (It is redundant here).
  In your implementation, you're already refreshing lazely using setTimeout function, which should refresh issue of CodeMirror any way.
 
There is an issue with Code mirror control, so after discussion its added.   

As per our personal discussion, please update the 'updateInvalid' function for the Control to look for only the 'input' tag with 'name' attribute.
 
As per discussion, this change is required for all 'input' tag, so removed it from SqlFieldControl and changed it in updateInvalid function

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

 



Regards,
Surinder Kumar


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers





Re: [pgAdmin4] Patch: Added new Control SqlFieldControl

From
Ashesh Vashi
Date:

On Wed, Feb 3, 2016 at 5:51 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:



On Wed, Feb 3, 2016 at 4:58 PM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Surinder,

[Please do not forget to "Reply All" (and, not reply to me personally)..]
Ok I will remember. 

On Wed, Feb 3, 2016 at 4:37 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,

Please find the patch with suggested changes.
I've updated the patch with some minor changes.
Please test me, and let me know (if it is working in your environment  with the view node, which you're working on.)
Yes, I applied the patch and Its working with view node.
Thanks.

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company




--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi



Thanks
Surinder Kumar

On Wed, Feb 3, 2016 at 10:49 AM, Ashesh Vashi <ashesh.vashi@enterprisedb.com> wrote:
Hi Surinder,

On Tue, Feb 2, 2016 at 1:05 PM, Surinder Kumar <surinder.kumar@enterprisedb.com> wrote:
Hi,


Please find patch for SqlFieldControl.
Thanks for the patch. 

This control allows the user to write/edit SQL queries.

To use SqlFieldControl, Set control property of field to 'sql-field' in model's schema like:

{
          id: 'definition', label:'{{ _('Definition') }}', cell: 'string', 
          control: 'sql-field'
}
K.


Please extend the SqlFieldContorl from the Backform.TextareaControl instead of Backform.Control.
Done 

* Do not need to set events, TextareaControl has handled those events.
Done 
* Extend 'getValueFromDom' function in order to get the value from the sql, and set it to the model.
Done 
* Don't listen to the 'pg-property-tab-changed' event here. (It is redundant here).
  In your implementation, you're already refreshing lazely using setTimeout function, which should refresh issue of CodeMirror any way.
 
There is an issue with Code mirror control, so after discussion its added.   

As per our personal discussion, please update the 'updateInvalid' function for the Control to look for only the 'input' tag with 'name' attribute.
 
As per discussion, this change is required for all 'input' tag, so removed it from SqlFieldControl and changed it in updateInvalid function

--

Thanks & Regards,

Ashesh Vashi
EnterpriseDB INDIA: Enterprise PostgreSQL Company


http://www.linkedin.com/in/asheshvashi

 



Regards,
Surinder Kumar


--
Sent via pgadmin-hackers mailing list (pgadmin-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers