From f09554bd7b2fed5e2f0036c50307b21c338c9789 Mon Sep 17 00:00:00 2001 From: Vik Date: Thu, 27 Apr 2023 21:12:15 +0530 Subject: [PATCH 1/3] Add is operator --- .../QueryEditors/TooljetDatabase/ListRows.jsx | 36 ++++++++++++++----- .../TooljetDatabase/operations.js | 7 ++-- frontend/src/TooljetDatabase/constants.js | 1 + .../src/_helpers/postgrestQueryBuilder.js | 7 +++- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx index bdf8aa51aa..a4ae2179e2 100644 --- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx +++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/ListRows.jsx @@ -5,6 +5,11 @@ import { uniqueId } from 'lodash'; import Select from '@/_ui/Select'; import { operators } from '@/TooljetDatabase/constants'; +const isOperatorOptions = [ + { value: 'null', label: 'null' }, + { value: 'notNull', label: 'not null' }, +]; + export const ListRows = React.memo(({ currentState, darkMode }) => { const { columns, listRowsOptions, limitOptionChanged, handleOptionsChange } = useContext(TooljetDatabaseContext); @@ -94,6 +99,9 @@ export const ListRows = React.memo(({ currentState, darkMode }) => { updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ value: newValue } }); }; + console.log('value', value); + console.log('operator', operator); + return (
@@ -116,15 +124,25 @@ export const ListRows = React.memo(({ currentState, darkMode }) => { />
- handleValueChange(newValue)} - /> + {operator === 'is' ? ( + + ) : ( + handleValueChange(newValue)} + /> + )}
{ const { columns, listRowsOptions, limitOptionChanged, handleOptionsChange } = useContext(TooljetDatabaseContext); @@ -99,9 +95,6 @@ export const ListRows = React.memo(({ currentState, darkMode }) => { updateFilterOptionsChanged({ ...listRowsOptions?.where_filters[id], ...{ value: newValue } }); }; - console.log('value', value); - console.log('operator', operator); - return (
@@ -127,7 +120,7 @@ export const ListRows = React.memo(({ currentState, darkMode }) => { {operator === 'is' ? ( + ) : ( + handleValueChange(newValue)} + /> + )}
{ } return false; }; + +export const isOperatorOptions = [ + { value: 'null', label: 'null' }, + { value: 'notNull', label: 'not null' }, +]; From f7f1d05dc5d2f1407b9943373bf1ca293bfe812a Mon Sep 17 00:00:00 2001 From: Vik Date: Fri, 28 Apr 2023 14:21:45 +0530 Subject: [PATCH 3/3] revert unnecessary change --- .../QueryManager/QueryEditors/TooljetDatabase/operations.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js index e71a8085bb..1290920fee 100644 --- a/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js +++ b/frontend/src/Editor/QueryManager/QueryEditors/TooljetDatabase/operations.js @@ -49,11 +49,7 @@ function buildPostgrestQuery(filters) { } } }); - let whereQuery = postgrestQueryBuilder.url.toString(); - // if (whereQuery && whereQuery.includes('nulltest=isNotNull')) { - // whereQuery = whereQuery.replace('nulltest=isNotNull', 'nulltest=not.is.null'); - // } - return whereQuery; + return postgrestQueryBuilder.url.toString(); } async function listRows(queryOptions, organizationId, currentState) {