Thread: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Murtuza Zabuawala
Date:
Hi,

PFA patch to fix the issue of jsonb type rendering issue in runtime.
RM#1404

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

Attachment

Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Dave Page
Date:
Hi

On Wed, Jun 29, 2016 at 10:32 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi,
>
> PFA patch to fix the issue of jsonb type rendering issue in runtime.
> RM#1404

I'm not convinced this is a good fix for a couple of reasons:

1) You're only applying the fix if we're running in the runtime. The
runtime uses the Webkit engine just as Safari and Chrome do, so I'm
more inclined to believe this is a version specific issue, rather than
something that is definitely confined to the runtime.

2) What if the user has JSON data in a json field? Or worse, a text field?

I wonder if we could/should mark the contents of all text fields as
CDATA to prevent the browser trying to do anything with them.

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

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


Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Murtuza Zabuawala
Date:
Hi,

PFA updated patch, we have created backgrid jsonb type cell which will work within browser & runtime.

Regards,
Murtuza

On 29-Jun-2016, at 3:54 pm, Dave Page <dpage@pgadmin.org> wrote:

Hi

On Wed, Jun 29, 2016 at 10:32 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
Hi,

PFA patch to fix the issue of jsonb type rendering issue in runtime.
RM#1404

I'm not convinced this is a good fix for a couple of reasons:

1) You're only applying the fix if we're running in the runtime. The
runtime uses the Webkit engine just as Safari and Chrome do, so I'm
more inclined to believe this is a version specific issue, rather than
something that is definitely confined to the runtime.

2) What if the user has JSON data in a json field? Or worse, a text field?

I wonder if we could/should mark the contents of all text fields as
CDATA to prevent the browser trying to do anything with them.

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

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

Attachment

Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Dave Page
Date:
On Thu, Jun 30, 2016 at 8:11 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi,
>
> PFA updated patch, we have created backgrid jsonb type cell which will work
> within browser & runtime.

Does it resolve the issue for 'json' columns? What about a 'text'
column containing json data?

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

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


Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Murtuza Zabuawala
Date:
Hi Dave,

text type works fine even if it has json data.

Regards,
Murtuza

> On 30-Jun-2016, at 1:21 pm, Dave Page <dpage@pgadmin.org> wrote:
>
> On Thu, Jun 30, 2016 at 8:11 AM, Murtuza Zabuawala
> <murtuza.zabuawala@enterprisedb.com> wrote:
>> Hi,
>>
>> PFA updated patch, we have created backgrid jsonb type cell which will work
>> within browser & runtime.
>
> Does it resolve the issue for 'json' columns? What about a 'text'
> column containing json data?
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company



Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Dave Page
Date:
Thanks - and the json datatype?

On Thu, Jun 30, 2016 at 8:56 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi Dave,
>
> text type works fine even if it has json data.
>
> Regards,
> Murtuza
>
>> On 30-Jun-2016, at 1:21 pm, Dave Page <dpage@pgadmin.org> wrote:
>>
>> On Thu, Jun 30, 2016 at 8:11 AM, Murtuza Zabuawala
>> <murtuza.zabuawala@enterprisedb.com> wrote:
>>> Hi,
>>>
>>> PFA updated patch, we have created backgrid jsonb type cell which will work
>>> within browser & runtime.
>>
>> Does it resolve the issue for 'json' columns? What about a 'text'
>> column containing json data?
>>
>> --
>> 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


Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Murtuza Zabuawala
Date:
Hi Dave,

PFA updated patch.
Tested with json/json[]/jsonb/jsonb[] (on browsers & runtime).

Regards,
Murtuza

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


On Thu, Jun 30, 2016 at 1:26 PM, Dave Page <dpage@pgadmin.org> wrote:
Thanks - and the json datatype?

On Thu, Jun 30, 2016 at 8:56 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi Dave,
>
> text type works fine even if it has json data.
>
> Regards,
> Murtuza
>
>> On 30-Jun-2016, at 1:21 pm, Dave Page <dpage@pgadmin.org> wrote:
>>
>> On Thu, Jun 30, 2016 at 8:11 AM, Murtuza Zabuawala
>> <murtuza.zabuawala@enterprisedb.com> wrote:
>>> Hi,
>>>
>>> PFA updated patch, we have created backgrid jsonb type cell which will work
>>> within browser & runtime.
>>
>> Does it resolve the issue for 'json' columns? What about a 'text'
>> column containing json data?
>>
>> --
>> 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

Attachment

Re: PATCH: to fix jsonb type rendering in runtime (pgAdmin4)

From
Dave Page
Date:
Hi

On Thu, Jun 30, 2016 at 11:37 AM, Murtuza Zabuawala
<murtuza.zabuawala@enterprisedb.com> wrote:
> Hi Dave,
>
> PFA updated patch.
> Tested with json/json[]/jsonb/jsonb[] (on browsers & runtime).

I can't add rows to a table with this patch applied:

1) Create a table

create table test(id serial primary key, j json, jb jsonb, ja json[],
jba jsonb[])

2) Right-click the table in the treeview, and view the data

3) Click the + button to add a new row

4) The warning about moving to the last page of results is shown, but
clicking OK doesn't dismiss the dialogue.

If I remove the patch, everything works again.

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

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