public inbox for [email protected]
help / color / mirror / Atom feed[pgAdmin][RM4969] JSONB and JSON field editing
2+ messages / 2 participants
[nested] [flat]
* [pgAdmin][RM4969] JSONB and JSON field editing
@ 2020-04-10 06:18 Aditya Toshniwal <[email protected]>
0 siblings, 1 reply; 2+ messages in thread
From: Aditya Toshniwal @ 2020-04-10 06:18 UTC (permalink / raw)
To: pgadmin-hackers
Hi Hackers,
Attached is the patch fix issue for jsonb and json field editing. Making
the field blank throws a validation error. The patch will set json, jsonb
to null when set to blank.
Please review.
--
Thanks and Regards,
Aditya Toshniwal
pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
"Don't Complain about Heat, Plant a TREE"
Attachments:
[application/octet-stream] RM4969.patch (1.5K, 3-RM4969.patch)
download | inline diff:
diff --git a/web/pgadmin/static/js/slickgrid/editors.js b/web/pgadmin/static/js/slickgrid/editors.js
index 1dcc29d9b..1647d4b82 100644
--- a/web/pgadmin/static/js/slickgrid/editors.js
+++ b/web/pgadmin/static/js/slickgrid/editors.js
@@ -110,7 +110,7 @@ import gettext from 'sources/gettext';
grid.copied_rows[row][cell] = 1;
}
} else {
- if(column_type === 'jsonb') {
+ if(column_type === 'jsonb' && state != null) {
item[args.column.field] = JSONBigNumber.stringify(JSONBigNumber.parse(state));
} else {
item[args.column.field] = state;
@@ -361,7 +361,7 @@ import gettext from 'sources/gettext';
this.loadValue = function(item) {
var data = defaultValue = item[args.column.field];
/* If jsonb or array */
- if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data)) {
+ if(args.column.column_type_internal === 'jsonb' && !Array.isArray(data) && data != null) {
data = JSONBigNumber.stringify(JSONBigNumber.parse(data), null, 4);
} else if (Array.isArray(data)) {
var temp = [];
@@ -406,7 +406,9 @@ import gettext from 'sources/gettext';
if(args.column.column_type_internal === 'jsonb' ||
args.column.column_type_internal === 'json') {
try {
- JSON.parse($input.val());
+ if($input.val() != ''){
+ JSON.parse($input.val());
+ }
} catch(e) {
$input.addClass('pg-text-invalid');
return {
^ permalink raw reply [nested|flat] 2+ messages in thread
* Re: [pgAdmin][RM4969] JSONB and JSON field editing
@ 2020-04-13 08:35 Akshay Joshi <[email protected]>
parent: Aditya Toshniwal <[email protected]>
0 siblings, 0 replies; 2+ messages in thread
From: Akshay Joshi @ 2020-04-13 08:35 UTC (permalink / raw)
To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers
Thanks, patch applied.
On Fri, Apr 10, 2020 at 11:49 AM Aditya Toshniwal <
[email protected]> wrote:
> Hi Hackers,
>
> Attached is the patch fix issue for jsonb and json field editing. Making
> the field blank throws a validation error. The patch will set json, jsonb
> to null when set to blank.
>
> Please review.
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> pgAdmin Hacker | Sr. Software Engineer | EnterpriseDB India | Pune
> "Don't Complain about Heat, Plant a TREE"
>
--
*Thanks & Regards*
*Akshay Joshi*
*Sr. Software Architect*
*EnterpriseDB Software India Private Limited*
*Mobile: +91 976-788-8246*
^ permalink raw reply [nested|flat] 2+ messages in thread
end of thread, other threads:[~2020-04-13 08:35 UTC | newest]
Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-04-10 06:18 [pgAdmin][RM4969] JSONB and JSON field editing Aditya Toshniwal <[email protected]>
2020-04-13 08:35 ` Akshay Joshi <[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