Re: [pgAdmin4][RM3600] json values changed when printed by pgadmin4

From: Aditya Toshniwal <aditya(dot)toshniwal(at)enterprisedb(dot)com>
To: Dave Page <dpage(at)pgadmin(dot)org>
Cc: pgadmin-hackers <pgadmin-hackers(at)postgresql(dot)org>
Subject: Re: [pgAdmin4][RM3600] json values changed when printed by pgadmin4
Date: 2019-02-25 10:01:44
Message-ID: CAM9w-_mnaTVzO_tzXx2LPo12x7OioMRLy-TdVwV8705i_yO59w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-hackers

Hi Hackers,

PFA patch for fixing json values changed issue.

On Mon, Feb 25, 2019 at 2:36 PM Aditya Toshniwal <
aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:

>
>
> On Fri, Feb 22, 2019 at 8:08 PM Dave Page <dpage(at)pgadmin(dot)org> wrote:
>
>> Hi
>>
>> On Fri, Feb 22, 2019 at 1:08 PM Aditya Toshniwal <
>> aditya(dot)toshniwal(at)enterprisedb(dot)com> wrote:
>>
>>> Hi Hackers,
>>>
>>> Attached is the patch to fix data alterations done in pgAdmin4 for json
>>> datatype. pgAdmin4 will not change json data in any way, and will treat
>>> json data as text for data type json. Note that, this is not applicable for
>>> jsonb.
>>> Also added jsonb editing validation.
>>>
>>> An enhancement which I have added with this patch is when you do double
>>> click on the slick grid column resize bar, the column will expand to
>>> maximum width of data.
>>>
>>
>> Nice! Can you break that out into a separate patch please? And fix this:
>>
> Ohh. I remember I had run the linter :/
> Will fix and separate.
>
>>
>> (pgadmin4) dpage(at)hal:*~/git/pgadmin4*$ make bundle
>>
>> cd web && yarn run bundle
>>
>> *yarn run v1.12.3*
>>
>> $ cross-env NODE_ENV=production yarn run bundle:dev
>>
>> $ yarn run linter && yarn run webpacker
>>
>> $ yarn eslint --no-eslintrc -c .eslintrc.js --ext .js --ext .jsx .
>>
>> $ /Users/dpage/git/pgadmin4/web/node_modules/.bin/eslint --no-eslintrc -c
>> .eslintrc.js --ext .js --ext .jsx .
>>
>>
>> /Users/dpage/git/pgadmin4/web/pgadmin/static/js/slickgrid/editors.js
>>
>> 111:11 error Expected indentation of 8 spaces but found 10 indent
>>
>>
>>
>> /Users/dpage/git/pgadmin4/web/pgadmin/static/js/slickgrid/plugins/slick.autocolumnsize.js
>>
>> 3:5 error Expected indentation of 2 spaces but found 4 indent
>>
>> 4:9 error Strings must use singlequote quotes
>>
>> 4:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 5:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 5:13 error Strings must use singlequote quotes
>>
>> 5:45 error Missing trailing comma
>> comma-dangle
>>
>> 6:10 error Missing trailing comma
>> comma-dangle
>>
>> 9:5 error Expected indentation of 2 spaces but found 4 indent
>>
>> 11:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 12:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 13:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 13:24 error Missing trailing comma
>> comma-dangle
>>
>> 16:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 17:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 18:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 20:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 21:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 21:27 error Strings must use singlequote quotes
>>
>> 21:48 error Strings must use singlequote quotes
>>
>> 22:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 24:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 24:46 error Strings must use singlequote quotes
>>
>> 24:67 error Strings must use singlequote quotes
>>
>> 27:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 28:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 31:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 32:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 33:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 37:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 38:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 38:45 error Strings must use singlequote quotes
>>
>> 39:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 40:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 41:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 42:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 43:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 44:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 45:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 46:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 47:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 49:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 50:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 53:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 54:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 55:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 57:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 58:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 61:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 62:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 64:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 65:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 66:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 67:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 69:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 71:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 72:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 73:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 74:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 78:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 79:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 80:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 81:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 82:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 82:17 error 'Slick' is not defined
>> no-undef
>>
>> 82:47 error 'Slick' is not defined
>> no-undef
>>
>> 83:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 85:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 86:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 88:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 89:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 90:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 91:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 94:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 95:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 95:37 error Strings must use singlequote quotes
>>
>> 96:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 97:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 97:26 error Strings must use singlequote quotes
>>
>> 97:35 error Strings must use singlequote quotes
>>
>> 97:47 error Strings must use singlequote quotes
>>
>> 98:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 101:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 102:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 103:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 104:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 105:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 106:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 107:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 108:21 error Expected indentation of 18 spaces but found 20 indent
>>
>> 108:34 error Strings must use singlequote quotes
>>
>> 108:104 error Strings must use singlequote quotes
>>
>> 109:21 error Expected indentation of 18 spaces but found 20 indent
>>
>> 111:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 112:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 113:21 error Expected indentation of 18 spaces but found 20 indent
>>
>> 114:21 error Expected indentation of 18 spaces but found 20 indent
>>
>> 117:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 120:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 120:28 error 'columnDef' is defined but never used
>> no-unused-vars
>>
>> 121:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 122:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 122:24 error Strings must use singlequote quotes
>>
>> 123:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 123:17 error Strings must use singlequote quotes
>>
>> 123:31 error Strings must use singlequote quotes
>>
>> 124:17 error Strings must use singlequote quotes
>>
>> 124:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 124:34 error Strings must use singlequote quotes
>>
>> 125:17 error Strings must use singlequote quotes
>>
>> 125:17 error Expected indentation of 14 spaces but found 16 indent
>>
>> 125:32 error Strings must use singlequote quotes
>>
>> 125:40 error Missing trailing comma
>> comma-dangle
>>
>> 127:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 127:46 error Strings must use singlequote quotes
>>
>> 128:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 129:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 132:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 133:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 136:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 137:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 138:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 139:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 140:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 141:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 142:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 145:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 146:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 146:40 error Strings must use singlequote quotes
>>
>> 146:55 error Strings must use singlequote quotes
>>
>> 146:73 error Strings must use singlequote quotes
>>
>> 147:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 148:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 151:9 error Expected indentation of 6 spaces but found 8 indent
>>
>> 152:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 153:13 error Expected indentation of 10 spaces but found 12 indent
>>
>> 153:29 error Missing trailing comma
>> comma-dangle
>>
>> 156:3 error 'jQuery' is not defined
>> no-undef
>>
>>
>> *✖ 138 problems (138 errors, 0 warnings)*
>>
>>
>>
>> Thanks!
>>
>>
>>> Below is sample data for testing:
>>>
>>> CREATE TABLE public.tab_jsontest
>>> (
>>> id integer NOT NULL PRIMARY KEY,
>>> coljson json,
>>> coljsonarr json[],
>>> coljsonb jsonb,
>>> coljsonbarr jsonb[]
>>> )
>>>
>>> insert into tab_jsontest values(1,'{"sender":"pablo","body":"they are on
>>> to us"}','{"{\"sody\": \"they are on to us\", \"bender\":
>>> \"pablo\"}","{\"sender\": \"arthur\"}"}','{"sender":"pablo","body":"they
>>> are on to us"}','{"{\"body\": \"they are on to us\", \"sender\":
>>> \"pablo\"}","{\"sender\": \"arthur\"}"}')
>>>
>>> Kindly review.
>>> --
>>> Thanks and Regards,
>>> Aditya Toshniwal
>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>> "Don't Complain about Heat, Plant a tree"
>>>
>>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>

--
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"

Attachment Content-Type Size
RM3600_v2.patch application/octet-stream 9.1 KB

In response to

Responses

Browse pgadmin-hackers by date

  From Date Subject
Next Message Usman Muzaffar 2019-02-25 10:08:53 [pgAdmin4][RM3936] - Fixes for feature test due to changes in pgadmin4
Previous Message Aditya Toshniwal 2019-02-25 09:06:43 Re: [pgAdmin4][RM3600] json values changed when printed by pgadmin4