public inbox for [email protected]  
help / color / mirror / Atom feed
RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field
4+ messages / 2 participants
[nested] [flat]

* RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field
@ 2021-06-30 10:05 Dave Page <[email protected]>
  2021-06-30 11:36 ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Khushboo Vashi <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dave Page @ 2021-06-30 10:05 UTC (permalink / raw)
  To: pgadmin-hackers; +Cc: Nikhil Mohite <[email protected]>

Here's a simple patch for $SUBJECT. It will remove any leading spaces from
the grid cell display and replace them with '[...] '. In edit mode, the
data is unchanged.

The only downside I can see to this is that the tooltip will show the
modified data when it probably should actually show the un-modified data.
Unfortunately that's handled by a SlickGrid plugin, which would have to be
vendorised and modified (perhaps non-trivially). I don't think that's a big
issue though.

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

EDB: https://www.enterprisedb.com


Attachments:

  [application/octet-stream] RM_6427.diff (948B, 3-RM_6427.diff)
  download | inline diff:
diff --git a/web/pgadmin/static/js/slickgrid/formatters.js b/web/pgadmin/static/js/slickgrid/formatters.js
index 7c9b2a21b..2159c9dda 100644
--- a/web/pgadmin/static/js/slickgrid/formatters.js
+++ b/web/pgadmin/static/js/slickgrid/formatters.js
@@ -103,12 +103,21 @@
 
   function TextFormatter(row, cell, value, columnDef) {
     // If column has default value, set placeholder
-    var data = NullAndDefaultFormatter(row, cell, value, columnDef);
-    if (data) {
-      return data;
+    var raw = NullAndDefaultFormatter(row, cell, value, columnDef);
+
+    var data;
+    if (raw) {
+      data = raw;
     } else {
-      return _.escape(value);
+      data = _.escape(value);
     }
+
+    // Replace leading whitespace with a marker so we don't just show blank lines
+    if (data.trimStart() != data) {
+      data = '[...] ' + data.trimStart();
+    }
+
+    return data;
   }
 
   function BinaryFormatter(row, cell, value, columnDef) {


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

* Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field
  2021-06-30 10:05 RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
@ 2021-06-30 11:36 ` Khushboo Vashi <[email protected]>
  2021-06-30 12:11   ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Khushboo Vashi @ 2021-06-30 11:36 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers; Nikhil Mohite <[email protected]>

Hi Dave,

On Wed, Jun 30, 2021 at 3:35 PM Dave Page <[email protected]> wrote:

> Here's a simple patch for $SUBJECT. It will remove any leading spaces from
> the grid cell display and replace them with '[...] '. In edit mode, the
> data is unchanged.
>
> The patch looks good to me.
Do we need to specify somewhere what is [...] ?

The only downside I can see to this is that the tooltip will show the
> modified data when it probably should actually show the un-modified data.
> Unfortunately that's handled by a SlickGrid plugin, which would have to be
> vendorised and modified (perhaps non-trivially). I don't think that's a big
> issue though.
>
> --
> Dave Page
> Blog: https://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EDB: https://www.enterprisedb.com
>
>


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

* Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field
  2021-06-30 10:05 RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
  2021-06-30 11:36 ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Khushboo Vashi <[email protected]>
@ 2021-06-30 12:11   ` Dave Page <[email protected]>
  2021-07-01 08:18     ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
  0 siblings, 1 reply; 4+ messages in thread

From: Dave Page @ 2021-06-30 12:11 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers; Nikhil Mohite <[email protected]>

Hi

On Wed, Jun 30, 2021 at 12:36 PM Khushboo Vashi <
[email protected]> wrote:

> Hi Dave,
>
> On Wed, Jun 30, 2021 at 3:35 PM Dave Page <[email protected]> wrote:
>
>> Here's a simple patch for $SUBJECT. It will remove any leading spaces
>> from the grid cell display and replace them with '[...] '. In edit mode,
>> the data is unchanged.
>>
>> The patch looks good to me.
>

Thanks.


> Do we need to specify somewhere what is [...] ?
>

I don't think there's much point.


>
> The only downside I can see to this is that the tooltip will show the
>> modified data when it probably should actually show the un-modified data.
>> Unfortunately that's handled by a SlickGrid plugin, which would have to be
>> vendorised and modified (perhaps non-trivially). I don't think that's a big
>> issue though.
>>
>> --
>> Dave Page
>> Blog: https://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EDB: https://www.enterprisedb.com
>>
>>

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

EDB: https://www.enterprisedb.com


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

* Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field
  2021-06-30 10:05 RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
  2021-06-30 11:36 ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Khushboo Vashi <[email protected]>
  2021-06-30 12:11   ` Re: RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
@ 2021-07-01 08:18     ` Dave Page <[email protected]>
  0 siblings, 0 replies; 4+ messages in thread

From: Dave Page @ 2021-07-01 08:18 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers; Nikhil Mohite <[email protected]>

Thanks, committed.

On Wed, Jun 30, 2021 at 1:11 PM Dave Page <[email protected]> wrote:

> Hi
>
> On Wed, Jun 30, 2021 at 12:36 PM Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi Dave,
>>
>> On Wed, Jun 30, 2021 at 3:35 PM Dave Page <[email protected]> wrote:
>>
>>> Here's a simple patch for $SUBJECT. It will remove any leading spaces
>>> from the grid cell display and replace them with '[...] '. In edit mode,
>>> the data is unchanged.
>>>
>>> The patch looks good to me.
>>
>
> Thanks.
>
>
>> Do we need to specify somewhere what is [...] ?
>>
>
> I don't think there's much point.
>
>
>>
>> The only downside I can see to this is that the tooltip will show the
>>> modified data when it probably should actually show the un-modified data.
>>> Unfortunately that's handled by a SlickGrid plugin, which would have to be
>>> vendorised and modified (perhaps non-trivially). I don't think that's a big
>>> issue though.
>>>
>>> --
>>> Dave Page
>>> Blog: https://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EDB: https://www.enterprisedb.com
>>>
>>>
>
> --
> Dave Page
> Blog: https://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EDB: https://www.enterprisedb.com
>
>

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

EDB: https://www.enterprisedb.com


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


end of thread, other threads:[~2021-07-01 08:18 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-06-30 10:05 RM 6427 - Newlines in text columns of resultset show an allegedly "empty" field Dave Page <[email protected]>
2021-06-30 11:36 ` Khushboo Vashi <[email protected]>
2021-06-30 12:11   ` Dave Page <[email protected]>
2021-07-01 08:18     ` 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