From e89688939438b2d5414155f053530bd9eb34b300 Mon Sep 17 00:00:00 2001 From: aya <15815271+ayatnkw@users.noreply.github.com> Date: Thu, 2 May 2024 11:08:57 +0200 Subject: [PATCH] feat(Postgres Node): Add option IS NOT NULL and hide value input fields (#9241) --- .../nodes/MySql/v2/actions/common.descriptions.ts | 9 +++++++++ packages/nodes-base/nodes/MySql/v2/helpers/utils.ts | 2 +- .../nodes/Postgres/v2/actions/common.descriptions.ts | 9 +++++++++ packages/nodes-base/nodes/Postgres/v2/helpers/utils.ts | 2 +- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/nodes-base/nodes/MySql/v2/actions/common.descriptions.ts b/packages/nodes-base/nodes/MySql/v2/actions/common.descriptions.ts index ab5362ac7de17..3454f97562ffa 100644 --- a/packages/nodes-base/nodes/MySql/v2/actions/common.descriptions.ts +++ b/packages/nodes-base/nodes/MySql/v2/actions/common.descriptions.ts @@ -279,6 +279,10 @@ export const selectRowsFixedCollection: INodeProperties = { name: 'Is Null', value: 'IS NULL', }, + { + name: 'Is Not Null', + value: 'IS NOT NULL', + }, ], default: 'equal', }, @@ -286,6 +290,11 @@ export const selectRowsFixedCollection: INodeProperties = { displayName: 'Value', name: 'value', type: 'string', + displayOptions: { + hide: { + condition: ['IS NULL', 'IS NOT NULL'], + }, + }, default: '', }, ], diff --git a/packages/nodes-base/nodes/MySql/v2/helpers/utils.ts b/packages/nodes-base/nodes/MySql/v2/helpers/utils.ts index 40b0f30b9c9dc..1e15ce71bb2ad 100644 --- a/packages/nodes-base/nodes/MySql/v2/helpers/utils.ts +++ b/packages/nodes-base/nodes/MySql/v2/helpers/utils.ts @@ -413,7 +413,7 @@ export function addWhereClauses( } let valueReplacement = ' '; - if (clause.condition !== 'IS NULL') { + if (clause.condition !== 'IS NULL' && clause.condition !== 'IS NOT NULL') { valueReplacement = ' ?'; values.push(clause.value); } diff --git a/packages/nodes-base/nodes/Postgres/v2/actions/common.descriptions.ts b/packages/nodes-base/nodes/Postgres/v2/actions/common.descriptions.ts index 8ed1b3a7d77b9..1d4088820ff34 100644 --- a/packages/nodes-base/nodes/Postgres/v2/actions/common.descriptions.ts +++ b/packages/nodes-base/nodes/Postgres/v2/actions/common.descriptions.ts @@ -263,6 +263,10 @@ export const whereFixedCollection: INodeProperties = { name: 'Is Null', value: 'IS NULL', }, + { + name: 'Is Not Null', + value: 'IS NOT NULL', + }, ], default: 'equal', }, @@ -270,6 +274,11 @@ export const whereFixedCollection: INodeProperties = { displayName: 'Value', name: 'value', type: 'string', + displayOptions: { + hide: { + condition: ['IS NULL', 'IS NOT NULL'], + }, + }, default: '', }, ], diff --git a/packages/nodes-base/nodes/Postgres/v2/helpers/utils.ts b/packages/nodes-base/nodes/Postgres/v2/helpers/utils.ts index 4698d31938000..5f01e6b6a6690 100644 --- a/packages/nodes-base/nodes/Postgres/v2/helpers/utils.ts +++ b/packages/nodes-base/nodes/Postgres/v2/helpers/utils.ts @@ -147,7 +147,7 @@ export function addWhereClauses( replacementIndex = replacementIndex + 1; let valueReplacement = ''; - if (clause.condition !== 'IS NULL') { + if (clause.condition !== 'IS NULL' && clause.condition !== 'IS NOT NULL') { valueReplacement = ` $${replacementIndex}`; values.push(clause.value); replacementIndex = replacementIndex + 1;