public inbox for [email protected]  
help / color / mirror / Atom feed
Bug #2309 fix
6+ messages / 4 participants
[nested] [flat]

* Bug #2309 fix
@ 2018-02-27 18:47  Neethu Mariya Joy <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Neethu Mariya Joy @ 2018-02-27 18:47 UTC (permalink / raw)
  To: pgadmin-hackers

Hi,
I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science at
BITS Pilani.

I've attempted to fix https://redmine.postgresql.org/issues/2309.
Codemirrors catches all the keyboard and mouse events when 'readOnly'
option is set to 'noCursor' and does not allow copying.
So, I've set 'readOnly' option to true. In order to hide the cursor, I've
added a class 'hide-cursor-workaround' and applied css styles to hide the
cursor.

I'm attaching my patch as bug2309.diff below as per the contribution
guidelines.

Hope this helps. Thank you for your consideration!

Sincerely,
Neethu Mariya Joy
GitHub <https://github.com/Roboneet; | Linkedin
<https://www.linkedin.com/in/neethu-mariya-joy-653655128/;

diff --git a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
index 1e29c3f..69381e5 100644
--- a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
+++ b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
@@ -601,4 +601,9 @@ input.editor-checkbox:focus {
 .ajs-body .warn-footer {
   font-size: 13px;
   line-height: 3em;
+}
+
+/* workaround for codemirrors 'readOnly' option which is set to true instead of 'noCursor' */
+.hide-cursor-workaround .CodeMirror-cursors{
+  display: none;
 }
\ No newline at end of file
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 349c9a0..91dbe3a 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2016,12 +2016,12 @@ define('tools.querytool', [
           }
         }
         else {
-          // Disable codemirror by setting cursor to nocursor and background to dark.
+          // Disable codemirror by setting readOnly option to true, background to dark, and cursor, hidden.
           self.init_events();
-          self.gridView.query_tool_obj.setOption('readOnly', 'nocursor');
+          self.gridView.query_tool_obj.setOption('readOnly', true);
           var cm = self.gridView.query_tool_obj.getWrapperElement();
           if (cm) {
-            cm.className += ' bg-gray-1 opacity-5';
+            cm.className += ' bg-gray-1 opacity-5 hide-cursor-workaround';
           }
           self.disable_tool_buttons(true);
           self.execute_data_query();


Attachments:

  [text/plain] bug2309.diff (1.6K, 3-bug2309.diff)
  download | inline diff:
diff --git a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
index 1e29c3f..69381e5 100644
--- a/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
+++ b/web/pgadmin/tools/sqleditor/static/css/sqleditor.css
@@ -601,4 +601,9 @@ input.editor-checkbox:focus {
 .ajs-body .warn-footer {
   font-size: 13px;
   line-height: 3em;
+}
+
+/* workaround for codemirrors 'readOnly' option which is set to true instead of 'noCursor' */
+.hide-cursor-workaround .CodeMirror-cursors{
+  display: none;
 }
\ No newline at end of file
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 349c9a0..91dbe3a 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2016,12 +2016,12 @@ define('tools.querytool', [
           }
         }
         else {
-          // Disable codemirror by setting cursor to nocursor and background to dark.
+          // Disable codemirror by setting readOnly option to true, background to dark, and cursor, hidden.
           self.init_events();
-          self.gridView.query_tool_obj.setOption('readOnly', 'nocursor');
+          self.gridView.query_tool_obj.setOption('readOnly', true);
           var cm = self.gridView.query_tool_obj.getWrapperElement();
           if (cm) {
-            cm.className += ' bg-gray-1 opacity-5';
+            cm.className += ' bg-gray-1 opacity-5 hide-cursor-workaround';
           }
           self.disable_tool_buttons(true);
           self.execute_data_query();


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Bug #2309 fix
@ 2018-03-01 22:05  Joao De Almeida Pereira <[email protected]>
  parent: Neethu Mariya Joy <[email protected]>
  0 siblings, 2 replies; 6+ messages in thread

From: Joao De Almeida Pereira @ 2018-03-01 22:05 UTC (permalink / raw)
  To: Neethu Mariya Joy <[email protected]>; +Cc: pgadmin-hackers

Hello Neethu,

We run the patch though our test pipeline and all tests are green.
Everything looks good with this patch

Thanks
Joao
On Thu, Mar 1, 2018 at 10:37 AM Neethu Mariya Joy <[email protected]>
wrote:

> Hi,
> I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science
> at BITS Pilani.
>
> I've attempted to fix https://redmine.postgresql.org/issues/2309.
> Codemirrors catches all the keyboard and mouse events when 'readOnly'
> option is set to 'noCursor' and does not allow copying.
> So, I've set 'readOnly' option to true. In order to hide the cursor, I've
> added a class 'hide-cursor-workaround' and applied css styles to hide the
> cursor.
>
> I'm attaching my patch as bug2309.diff below as per the contribution
> guidelines.
>
> Hope this helps. Thank you for your consideration!
>
> Sincerely,
> Neethu Mariya Joy
> GitHub <https://github.com/Roboneet; | Linkedin
> <https://www.linkedin.com/in/neethu-mariya-joy-653655128/;
>
>
>


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Bug #2309 fix
@ 2018-03-02 04:15  Murtuza Zabuawala <[email protected]>
  parent: Joao De Almeida Pereira <[email protected]>
  1 sibling, 1 reply; 6+ messages in thread

From: Murtuza Zabuawala @ 2018-03-02 04:15 UTC (permalink / raw)
  To: Joao De Almeida Pereira <[email protected]>; +Cc: Neethu Mariya Joy <[email protected]>; pgadmin-hackers

Hi Neethu,

Patch looks good.

We are facing similar issue on dashboard as well where users are not able
to copy the sql from server activity table, I've attached screenshot for
your reference.
Bug: https://redmine.postgresql.org/issues/3137


--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


On Fri, Mar 2, 2018 at 3:35 AM, Joao De Almeida Pereira <
[email protected]> wrote:

> Hello Neethu,
>
> We run the patch though our test pipeline and all tests are green.
> Everything looks good with this patch
>
> Thanks
> Joao
> On Thu, Mar 1, 2018 at 10:37 AM Neethu Mariya Joy <
> [email protected]> wrote:
>
>> Hi,
>> I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science
>> at BITS Pilani.
>>
>> I've attempted to fix https://redmine.postgresql.org/issues/2309.
>> Codemirrors catches all the keyboard and mouse events when 'readOnly'
>> option is set to 'noCursor' and does not allow copying.
>> So, I've set 'readOnly' option to true. In order to hide the cursor, I've
>> added a class 'hide-cursor-workaround' and applied css styles to hide the
>> cursor.
>>
>> I'm attaching my patch as bug2309.diff below as per the contribution
>> guidelines.
>>
>> Hope this helps. Thank you for your consideration!
>>
>> Sincerely,
>> Neethu Mariya Joy
>> GitHub <https://github.com/Roboneet; | Linkedin
>> <https://www.linkedin.com/in/neethu-mariya-joy-653655128/;
>>
>>
>>


Attachments:

  [image/png] Screen Shot 2018-03-02 at 9.24.04 am.png (227.9K, 3-Screen%20Shot%202018-03-02%20at%209.24.04%20am.png)
  download | view image

^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Bug #2309 fix
@ 2018-03-02 09:05  Neethu Mariya Joy <[email protected]>
  parent: Murtuza Zabuawala <[email protected]>
  0 siblings, 1 reply; 6+ messages in thread

From: Neethu Mariya Joy @ 2018-03-02 09:05 UTC (permalink / raw)
  To: Murtuza Zabuawala <[email protected]>; +Cc: Joao De Almeida Pereira <[email protected]>; pgadmin-hackers

Hi,

A similar workaround fixed #3137 too. I'm attaching the patch below.

Sincerely,
Neethu

On Fri, Mar 2, 2018 at 9:45 AM, Murtuza Zabuawala <
[email protected]> wrote:

> Hi Neethu,
>
> Patch looks good.
>
> We are facing similar issue on dashboard as well where users are not able
> to copy the sql from server activity table, I've attached screenshot for
> your reference.
> Bug: https://redmine.postgresql.org/issues/3137
>
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>
> On Fri, Mar 2, 2018 at 3:35 AM, Joao De Almeida Pereira <
> [email protected]> wrote:
>
>> Hello Neethu,
>>
>> We run the patch though our test pipeline and all tests are green.
>> Everything looks good with this patch
>>
>> Thanks
>> Joao
>> On Thu, Mar 1, 2018 at 10:37 AM Neethu Mariya Joy <
>> [email protected]> wrote:
>>
>>> Hi,
>>> I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science
>>> at BITS Pilani.
>>>
>>> I've attempted to fix https://redmine.postgresql.org/issues/2309.
>>> Codemirrors catches all the keyboard and mouse events when 'readOnly'
>>> option is set to 'noCursor' and does not allow copying.
>>> So, I've set 'readOnly' option to true. In order to hide the cursor,
>>> I've added a class 'hide-cursor-workaround' and applied css styles to hide
>>> the cursor.
>>>
>>> I'm attaching my patch as bug2309.diff below as per the contribution
>>> guidelines.
>>>
>>> Hope this helps. Thank you for your consideration!
>>>
>>> Sincerely,
>>> Neethu Mariya Joy
>>> GitHub <https://github.com/Roboneet; | Linkedin
>>> <https://www.linkedin.com/in/neethu-mariya-joy-653655128/;
>>>
>>>
>>>
>


Attachments:

  [application/octet-stream] bug2309_3137.diff (2.2K, 3-bug2309_3137.diff)
  download | inline diff:
diff --git a/web/pgadmin/static/css/codemirror.overrides.css b/web/pgadmin/static/css/codemirror.overrides.css
index 178b038..1b5fcac 100644
--- a/web/pgadmin/static/css/codemirror.overrides.css
+++ b/web/pgadmin/static/css/codemirror.overrides.css
@@ -81,3 +81,8 @@
 .sql_textarea .CodeMirror-scroll {
   z-index: 0;
 }
+
+/* workaround for codemirrors 'readOnly' option which is set to true instead of 'noCursor' */
+.hide-cursor-workaround .CodeMirror-cursors{
+  display: none;
+}
diff --git a/web/pgadmin/static/js/backform.pgadmin.js b/web/pgadmin/static/js/backform.pgadmin.js
index 5bbbf9f..aa811c5 100644
--- a/web/pgadmin/static/js/backform.pgadmin.js
+++ b/web/pgadmin/static/js/backform.pgadmin.js
@@ -2098,10 +2098,11 @@ define([
 
       // Disable editor
       if (isDisabled) {
-        self.sqlCtrl.setOption('readOnly', 'nocursor');
+        // set read only mode to true instead of 'nocursor', and hide cursor using a class so that copying is enabled
+        self.sqlCtrl.setOption('readOnly', true);
         var cm = self.sqlCtrl.getWrapperElement();
         if (cm) {
-          cm.className += ' cm_disabled';
+          cm.className += ' cm_disabled hide-cursor-workaround';
         }
       }
 
diff --git a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
index 56a901a..a84daa3 100644
--- a/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
+++ b/web/pgadmin/tools/sqleditor/static/js/sqleditor.js
@@ -2019,12 +2019,12 @@ define('tools.querytool', [
           }
         }
         else {
-          // Disable codemirror by setting cursor to nocursor and background to dark.
+          // Disable codemirror by setting readOnly option to true, background to dark, and cursor, hidden.
           self.init_events();
-          self.gridView.query_tool_obj.setOption('readOnly', 'nocursor');
+          self.gridView.query_tool_obj.setOption('readOnly', true);
           var cm = self.gridView.query_tool_obj.getWrapperElement();
           if (cm) {
-            cm.className += ' bg-gray-1 opacity-5';
+            cm.className += ' bg-gray-1 opacity-5 hide-cursor-workaround';
           }
           self.disable_tool_buttons(true);
           self.execute_data_query();


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Bug #2309 fix
@ 2018-03-02 13:47  Dave Page <[email protected]>
  parent: Joao De Almeida Pereira <[email protected]>
  1 sibling, 0 replies; 6+ messages in thread

From: Dave Page @ 2018-03-02 13:47 UTC (permalink / raw)
  To: Joao De Almeida Pereira <[email protected]>; +Cc: Neethu Mariya Joy <[email protected]>; pgadmin-hackers

Hi

Thank you both. I've committed this with a minor tweak to include a space
before the { in the CSS, to match the existing formatting.

Welcome to the project Neethu!

On Thu, Mar 1, 2018 at 10:05 PM, Joao De Almeida Pereira <
[email protected]> wrote:

> Hello Neethu,
>
> We run the patch though our test pipeline and all tests are green.
> Everything looks good with this patch
>
> Thanks
> Joao
>
> On Thu, Mar 1, 2018 at 10:37 AM Neethu Mariya Joy <
> [email protected]> wrote:
>
>> Hi,
>> I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer Science
>> at BITS Pilani.
>>
>> I've attempted to fix https://redmine.postgresql.org/issues/2309.
>> Codemirrors catches all the keyboard and mouse events when 'readOnly'
>> option is set to 'noCursor' and does not allow copying.
>> So, I've set 'readOnly' option to true. In order to hide the cursor, I've
>> added a class 'hide-cursor-workaround' and applied css styles to hide the
>> cursor.
>>
>> I'm attaching my patch as bug2309.diff below as per the contribution
>> guidelines.
>>
>> Hope this helps. Thank you for your consideration!
>>
>> Sincerely,
>> Neethu Mariya Joy
>> GitHub <https://github.com/Roboneet; | Linkedin
>> <https://www.linkedin.com/in/neethu-mariya-joy-653655128/;
>>
>>
>>


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

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


^ permalink  raw  reply  [nested|flat] 6+ messages in thread

* Re: Bug #2309 fix
@ 2018-03-02 14:39  Dave Page <[email protected]>
  parent: Neethu Mariya Joy <[email protected]>
  0 siblings, 0 replies; 6+ messages in thread

From: Dave Page @ 2018-03-02 14:39 UTC (permalink / raw)
  To: Neethu Mariya Joy <[email protected]>; +Cc: Murtuza Zabuawala <[email protected]>; Joao De Almeida Pereira <[email protected]>; pgadmin-hackers

Thanks, applied.

On Fri, Mar 2, 2018 at 9:05 AM, Neethu Mariya Joy <[email protected]
> wrote:

> Hi,
>
> A similar workaround fixed #3137 too. I'm attaching the patch below.
>
> Sincerely,
> Neethu
>
> On Fri, Mar 2, 2018 at 9:45 AM, Murtuza Zabuawala <murtuza.zabuawala@
> enterprisedb.com> wrote:
>
>> Hi Neethu,
>>
>> Patch looks good.
>>
>> We are facing similar issue on dashboard as well where users are not able
>> to copy the sql from server activity table, I've attached screenshot for
>> your reference.
>> Bug: https://redmine.postgresql.org/issues/3137
>>
>>
>> --
>> Regards,
>> Murtuza Zabuawala
>> EnterpriseDB: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>>
>> On Fri, Mar 2, 2018 at 3:35 AM, Joao De Almeida Pereira <
>> [email protected]> wrote:
>>
>>> Hello Neethu,
>>>
>>> We run the patch though our test pipeline and all tests are green.
>>> Everything looks good with this patch
>>>
>>> Thanks
>>> Joao
>>> On Thu, Mar 1, 2018 at 10:37 AM Neethu Mariya Joy <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>> I am Neethu Mariya Joy, an undergraduate pursuing BE in Computer
>>>> Science at BITS Pilani.
>>>>
>>>> I've attempted to fix https://redmine.postgresql.org/issues/2309.
>>>> Codemirrors catches all the keyboard and mouse events when 'readOnly'
>>>> option is set to 'noCursor' and does not allow copying.
>>>> So, I've set 'readOnly' option to true. In order to hide the cursor,
>>>> I've added a class 'hide-cursor-workaround' and applied css styles to hide
>>>> the cursor.
>>>>
>>>> I'm attaching my patch as bug2309.diff below as per the contribution
>>>> guidelines.
>>>>
>>>> Hope this helps. Thank you for your consideration!
>>>>
>>>> Sincerely,
>>>> Neethu Mariya Joy
>>>> GitHub <https://github.com/Roboneet; | Linkedin
>>>> <https://www.linkedin.com/in/neethu-mariya-joy-653655128/;
>>>>
>>>>
>>>>
>>
>


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

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


^ permalink  raw  reply  [nested|flat] 6+ messages in thread


end of thread, other threads:[~2018-03-02 14:39 UTC | newest]

Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-02-27 18:47 Bug #2309 fix Neethu Mariya Joy <[email protected]>
2018-03-01 22:05 ` Joao De Almeida Pereira <[email protected]>
2018-03-02 04:15   ` Murtuza Zabuawala <[email protected]>
2018-03-02 09:05     ` Neethu Mariya Joy <[email protected]>
2018-03-02 14:39       ` Dave Page <[email protected]>
2018-03-02 13:47   ` Dave Page <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox