From 41c841678fe8bdd9359e4343e58843a807e0876c Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Sun, 10 Nov 2024 23:43:40 +0530 Subject: [PATCH 01/15] bump to v3.0.0-ce --- .version | 2 +- frontend/.version | 2 +- server/.version | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.version b/.version index b56e89db41..fe96cad5cf 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -3.0.0-ce-beta.1 +3.0.0-ce diff --git a/frontend/.version b/frontend/.version index b56e89db41..fe96cad5cf 100644 --- a/frontend/.version +++ b/frontend/.version @@ -1 +1 @@ -3.0.0-ce-beta.1 +3.0.0-ce diff --git a/server/.version b/server/.version index b56e89db41..fe96cad5cf 100644 --- a/server/.version +++ b/server/.version @@ -1 +1 @@ -3.0.0-ce-beta.1 +3.0.0-ce From 488a9d864164c1d013b040ca0eae64bd38d927ea Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Mon, 11 Nov 2024 03:56:55 +0530 Subject: [PATCH 02/15] hide TJDB mode toggle button From 07c755b71e51061f7f3c7ea68b2b1a1ca569842a Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Mon, 11 Nov 2024 05:00:35 +0530 Subject: [PATCH 03/15] make TJDB sql mode configurable from backend --- frontend/webpack.config.js | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/webpack.config.js b/frontend/webpack.config.js index 8d3f1968d6..4eb6c357f8 100644 --- a/frontend/webpack.config.js +++ b/frontend/webpack.config.js @@ -196,7 +196,6 @@ module.exports = { COMMENT_FEATURE_ENABLE: process.env.COMMENT_FEATURE_ENABLE ?? true, ENABLE_MULTIPLAYER_EDITING: true, ENABLE_MARKETPLACE_DEV_MODE: process.env.ENABLE_MARKETPLACE_DEV_MODE, - TJDB_SQL_MODE_DISABLE: process.env.TJDB_SQL_MODE_DISABLE ?? false, TOOLJET_MARKETPLACE_URL: process.env.TOOLJET_MARKETPLACE_URL || 'https://tooljet-plugins-production.s3.us-east-2.amazonaws.com', }), From 28a550facce0cd0c59b19791d41207e8245b6211 Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Mon, 11 Nov 2024 05:58:05 +0530 Subject: [PATCH 04/15] populate default connection type for legacy postgres data sources --- ...ateManualConnectionTypeForOldPostgresDs.ts | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts diff --git a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts new file mode 100644 index 0000000000..4f444ec7a2 --- /dev/null +++ b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts @@ -0,0 +1,62 @@ +import { DataSource } from '@entities/data_source.entity'; +import { DataSourceOptions } from '@entities/data_source_options.entity'; +import { MigrationProgress } from '@helpers/migration.helper'; +import { processDataInBatches } from '@helpers/utils.helper'; +import { EntityManager, In, MigrationInterface, QueryRunner } from 'typeorm'; + +export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implements MigrationInterface { + public async up(queryRunner: QueryRunner): Promise { + const entityManager = queryRunner.manager; + const dataSourceIds = ( + await entityManager.find(DataSource, { + where: { kind: 'postgresql' }, + select: ['id'], + }) + ).map((d) => d.id); + + const datasourceOptionsCount = await entityManager.count(DataSourceOptions, { + where: { dataSourceId: In(dataSourceIds) }, + }); + + const migrationProgress = new MigrationProgress( + 'PopulateManualConnectionTypeForOldPostgresDs1731283187529', + datasourceOptionsCount + ); + + const getDataSourceOptionsToUpdate = async ( + entityManager: EntityManager, + skip: number, + take: number + ): Promise => { + return await entityManager.find(DataSourceOptions, { + where: { dataSourceId: In(dataSourceIds) }, + take, + skip, + }); + }; + + const processDataSourceOptionsBatch = async ( + entityManager: EntityManager, + dataSourceOptions: DataSourceOptions[] + ): Promise => { + for (const dataSourceOption of dataSourceOptions) { + if (dataSourceOption.options.connection_type) { + migrationProgress.show(); + continue; + } + + dataSourceOption.options = { + ...dataSourceOption.options, + connection_type: { value: 'manual', encrypted: false }, + }; + + await entityManager.save(dataSourceOption); + migrationProgress.show(); + } + }; + + await processDataInBatches(entityManager, getDataSourceOptionsToUpdate, processDataSourceOptionsBatch); + } + + public async down(queryRunner: QueryRunner): Promise {} +} From 06cc68eb9d2740807e7c748cb93f9ab705e9b8bd Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Mon, 11 Nov 2024 06:18:02 +0530 Subject: [PATCH 05/15] reduce batch size to 100 --- ...283187529-PopulateManualConnectionTypeForOldPostgresDs.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts index 4f444ec7a2..b9b5411e8e 100644 --- a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts +++ b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts @@ -14,6 +14,7 @@ export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implement }) ).map((d) => d.id); + const batchSize = 100; const datasourceOptionsCount = await entityManager.count(DataSourceOptions, { where: { dataSourceId: In(dataSourceIds) }, }); @@ -40,7 +41,7 @@ export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implement dataSourceOptions: DataSourceOptions[] ): Promise => { for (const dataSourceOption of dataSourceOptions) { - if (dataSourceOption.options.connection_type) { + if (dataSourceOption.options?.connection_type) { migrationProgress.show(); continue; } @@ -55,7 +56,7 @@ export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implement } }; - await processDataInBatches(entityManager, getDataSourceOptionsToUpdate, processDataSourceOptionsBatch); + await processDataInBatches(entityManager, getDataSourceOptionsToUpdate, processDataSourceOptionsBatch, batchSize); } public async down(queryRunner: QueryRunner): Promise {} From 5d6c7e0b8986e9aa629c67896d4b4b32b55bef6f Mon Sep 17 00:00:00 2001 From: Akshay Sasidharan Date: Mon, 11 Nov 2024 06:54:27 +0530 Subject: [PATCH 06/15] optimize data migration query to remove large id list --- ...ateManualConnectionTypeForOldPostgresDs.ts | 46 +++++++++++++------ 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts index b9b5411e8e..c6153b71ad 100644 --- a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts +++ b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts @@ -2,22 +2,27 @@ import { DataSource } from '@entities/data_source.entity'; import { DataSourceOptions } from '@entities/data_source_options.entity'; import { MigrationProgress } from '@helpers/migration.helper'; import { processDataInBatches } from '@helpers/utils.helper'; -import { EntityManager, In, MigrationInterface, QueryRunner } from 'typeorm'; +import { EntityManager, MigrationInterface, QueryRunner } from 'typeorm'; export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { const entityManager = queryRunner.manager; - const dataSourceIds = ( - await entityManager.find(DataSource, { - where: { kind: 'postgresql' }, - select: ['id'], - }) - ).map((d) => d.id); const batchSize = 100; - const datasourceOptionsCount = await entityManager.count(DataSourceOptions, { - where: { dataSourceId: In(dataSourceIds) }, - }); + const datasourceOptionsCount = await entityManager + .createQueryBuilder(DataSourceOptions, 'dso') + .innerJoin(DataSource, 'ds', 'dso.dataSourceId = ds.id') + .where('ds.kind = :kind', { kind: 'postgresql' }) + .andWhere( + ` + NOT EXISTS ( + SELECT 1 + FROM jsonb_object_keys(dso.options::jsonb) AS keys + WHERE keys = 'connection_type' + ) + ` + ) + .getCount(); const migrationProgress = new MigrationProgress( 'PopulateManualConnectionTypeForOldPostgresDs1731283187529', @@ -29,11 +34,22 @@ export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implement skip: number, take: number ): Promise => { - return await entityManager.find(DataSourceOptions, { - where: { dataSourceId: In(dataSourceIds) }, - take, - skip, - }); + return await entityManager + .createQueryBuilder(DataSourceOptions, 'dso') + .innerJoin(DataSource, 'ds', 'dso.dataSourceId = ds.id') + .where('ds.kind = :kind', { kind: 'postgresql' }) + .andWhere( + ` + NOT EXISTS ( + SELECT 1 + FROM jsonb_object_keys(dso.options::jsonb) AS keys + WHERE keys = 'connection_type' + ) + ` + ) + .skip(skip) + .take(take) + .getMany(); }; const processDataSourceOptionsBatch = async ( From fce61d8db91626ffd97326626312cbe858f488ff Mon Sep 17 00:00:00 2001 From: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com> Date: Mon, 11 Nov 2024 11:27:33 +0530 Subject: [PATCH 07/15] open in new tab fix workspace modal (#2595) --- .../_components/OrganizationManager/List.jsx | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/frontend/src/_components/OrganizationManager/List.jsx b/frontend/src/_components/OrganizationManager/List.jsx index 8ac54710bb..9229d4079b 100644 --- a/frontend/src/_components/OrganizationManager/List.jsx +++ b/frontend/src/_components/OrganizationManager/List.jsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import React, { useEffect, useState, useRef } from 'react'; import { authenticationService } from '@/_services'; import { CustomSelect } from './CustomSelect'; import { getAvatar, decodeEntities } from '@/_helpers/utils'; @@ -29,14 +29,21 @@ export const OrganizationList = function () { fetchOrganizations(); // eslint-disable-next-line react-hooks/exhaustive-deps }, []); - - const switchOrganization = (id) => { + const newTabRef = useRef(false); + const switchOrganization = (id, newTab = false) => { + newTabRef.current = newTab; const organization = organizationList.find((org) => org.id === id); if (![id, organization.slug].includes(getWorkspaceIdOrSlugFromURL())) { const newPath = appendWorkspaceId(organization.slug || id, location.pathname, true); - window.open(newPath, '_blank'); + newTab ? window.open(newPath, '_blank') : (window.location = newPath); } }; + const handleOnChange = (id) => { + if (!newTabRef.current) { + switchOrganization(id, false); + } + newTabRef.current = false; + }; const options = organizationList .map((org) => ({ @@ -81,7 +88,7 @@ export const OrganizationList = function () {
switchOrganization(org.id)} + onClick={() => switchOrganization(org.id, true)} >
@@ -103,7 +110,7 @@ export const OrganizationList = function () { isLoading={isGettingOrganizations} options={options} value={current_organization_id} - onChange={(id) => switchOrganization(id)} + onChange={handleOnChange} className={`tj-org-select ${darkMode && 'dark-theme'}`} /> From 8908fc64ecd3cf3c999dddce77ffb5e871f1414f Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 11 Nov 2024 16:54:07 +0530 Subject: [PATCH 08/15] optimise postgres data migration query (#658) --- ...ateManualConnectionTypeForOldPostgresDs.ts | 89 ++++--------------- 1 file changed, 18 insertions(+), 71 deletions(-) diff --git a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts index c6153b71ad..567f1fb3bd 100644 --- a/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts +++ b/server/data-migrations/1731283187529-PopulateManualConnectionTypeForOldPostgresDs.ts @@ -1,78 +1,25 @@ -import { DataSource } from '@entities/data_source.entity'; -import { DataSourceOptions } from '@entities/data_source_options.entity'; -import { MigrationProgress } from '@helpers/migration.helper'; -import { processDataInBatches } from '@helpers/utils.helper'; -import { EntityManager, MigrationInterface, QueryRunner } from 'typeorm'; +import { MigrationInterface, QueryRunner } from 'typeorm'; export class PopulateManualConnectionTypeForOldPostgresDs1731283187529 implements MigrationInterface { public async up(queryRunner: QueryRunner): Promise { - const entityManager = queryRunner.manager; - - const batchSize = 100; - const datasourceOptionsCount = await entityManager - .createQueryBuilder(DataSourceOptions, 'dso') - .innerJoin(DataSource, 'ds', 'dso.dataSourceId = ds.id') - .where('ds.kind = :kind', { kind: 'postgresql' }) - .andWhere( - ` - NOT EXISTS ( - SELECT 1 - FROM jsonb_object_keys(dso.options::jsonb) AS keys - WHERE keys = 'connection_type' - ) - ` + await queryRunner.query(` + UPDATE data_source_options + SET options = jsonb_set( + COALESCE(options::jsonb, '{}'), + '{connection_type}', + '{"value": "manual", "encrypted": false}'::jsonb ) - .getCount(); - - const migrationProgress = new MigrationProgress( - 'PopulateManualConnectionTypeForOldPostgresDs1731283187529', - datasourceOptionsCount - ); - - const getDataSourceOptionsToUpdate = async ( - entityManager: EntityManager, - skip: number, - take: number - ): Promise => { - return await entityManager - .createQueryBuilder(DataSourceOptions, 'dso') - .innerJoin(DataSource, 'ds', 'dso.dataSourceId = ds.id') - .where('ds.kind = :kind', { kind: 'postgresql' }) - .andWhere( - ` - NOT EXISTS ( - SELECT 1 - FROM jsonb_object_keys(dso.options::jsonb) AS keys - WHERE keys = 'connection_type' - ) - ` - ) - .skip(skip) - .take(take) - .getMany(); - }; - - const processDataSourceOptionsBatch = async ( - entityManager: EntityManager, - dataSourceOptions: DataSourceOptions[] - ): Promise => { - for (const dataSourceOption of dataSourceOptions) { - if (dataSourceOption.options?.connection_type) { - migrationProgress.show(); - continue; - } - - dataSourceOption.options = { - ...dataSourceOption.options, - connection_type: { value: 'manual', encrypted: false }, - }; - - await entityManager.save(dataSourceOption); - migrationProgress.show(); - } - }; - - await processDataInBatches(entityManager, getDataSourceOptionsToUpdate, processDataSourceOptionsBatch, batchSize); + WHERE data_source_id IN ( + SELECT ds.id + FROM data_sources ds + WHERE ds.kind = 'postgresql' + ) + AND NOT EXISTS ( + SELECT 1 + FROM jsonb_object_keys(COALESCE(options::jsonb, '{}')) AS keys + WHERE keys = 'connection_type' + ); + `); } public async down(queryRunner: QueryRunner): Promise {} From 5652f10806a26d46bb78816841ea3b92360c2c0e Mon Sep 17 00:00:00 2001 From: Akshay Date: Mon, 11 Nov 2024 19:45:29 +0530 Subject: [PATCH 09/15] fix numerical/boolean value not sent on restapi (#662) --- plugins/packages/common/lib/utils.helper.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/packages/common/lib/utils.helper.ts b/plugins/packages/common/lib/utils.helper.ts index c85909d926..aaab6c436e 100644 --- a/plugins/packages/common/lib/utils.helper.ts +++ b/plugins/packages/common/lib/utils.helper.ts @@ -82,8 +82,7 @@ export const sanitizeHeaders = ( queryOptions: any, hasDataSource = true ): { [k: string]: string } => { - const cleanHeaders = (headers) => - headers.filter(([_, v]) => !isEmpty(v)).map(([k, v]) => [k.trim().toLowerCase(), v]); + const cleanHeaders = (headers) => headers.filter(([k, _]) => k !== '').map(([k, v]) => [k.trim(), v]); const _queryHeaders = cleanHeaders(queryOptions.headers || []); const queryHeaders = Object.fromEntries(_queryHeaders); From 5e7541b133105ccfca977619b7a558d14f23eadf Mon Sep 17 00:00:00 2001 From: johnsoncherian Date: Mon, 11 Nov 2024 23:36:09 +0530 Subject: [PATCH 10/15] fix: added null check for data-cy components --- frontend/src/Editor/Components/Multiselect.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Editor/Components/Multiselect.jsx b/frontend/src/Editor/Components/Multiselect.jsx index 65ebf2767b..591d97f9ea 100644 --- a/frontend/src/Editor/Components/Multiselect.jsx +++ b/frontend/src/Editor/Components/Multiselect.jsx @@ -164,7 +164,7 @@ export const Multiselect = function Multiselect({ From 98dbf56425eeb617387641cb575c51540075a552 Mon Sep 17 00:00:00 2001 From: johnsoncherian Date: Tue, 12 Nov 2024 03:49:27 +0530 Subject: [PATCH 11/15] fix: fixed runjs attribution variable inconsistancies --- frontend/src/AppBuilder/_hooks/useAppData.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frontend/src/AppBuilder/_hooks/useAppData.js b/frontend/src/AppBuilder/_hooks/useAppData.js index bb745f2568..21c95a0144 100644 --- a/frontend/src/AppBuilder/_hooks/useAppData.js +++ b/frontend/src/AppBuilder/_hooks/useAppData.js @@ -156,7 +156,15 @@ const useAppData = (appId, moduleId, mode = 'edit', { environmentId, versionId } let editorEnvironment = result.editorEnvironment; const editorEnvironmentId = result.editing_version?.current_environment_id; if (isPreviewForVersion) { + const rawDataQueries = appData?.data_queries; + const rawEditingVersionDataQueries = appData?.editing_version?.data_queries; appData = convertAllKeysToSnakeCase(appData); + + appData.data_queries = rawDataQueries; + if (appData.editing_version && rawEditingVersionDataQueries) { + appData.editing_version.data_queries = rawEditingVersionDataQueries; + } + editorEnvironment = { id: environmentId, name: queryParams.env, From 5714c79e5b4be4d17eab0b2340aa796206bb7a44 Mon Sep 17 00:00:00 2001 From: johnsoncherian Date: Mon, 11 Nov 2024 23:36:09 +0530 Subject: [PATCH 12/15] fix: added null check for data-cy components From 4c6a9a18a9c7dc318295266266c925207c0c6430 Mon Sep 17 00:00:00 2001 From: Rudhra Deep Biswas <98055396+rudeUltra@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:02:03 +0530 Subject: [PATCH 13/15] Query fix for number values (#11282) * Query fix for number values * query changes --- server/src/services/data_queries.service.ts | 54 +++++++++++---------- 1 file changed, 29 insertions(+), 25 deletions(-) diff --git a/server/src/services/data_queries.service.ts b/server/src/services/data_queries.service.ts index 81509bc95d..cd4531f2e1 100644 --- a/server/src/services/data_queries.service.ts +++ b/server/src/services/data_queries.service.ts @@ -573,7 +573,6 @@ export class DataQueriesService { finalResult += str.slice(lastIndex); return finalResult; } - async parseQueryOptions( object: any, options: object, @@ -581,10 +580,8 @@ export class DataQueriesService { environmentId?: string ): Promise { const stack: any[] = [{ obj: object, key: null, parent: null }]; - while (stack.length > 0) { const { obj, key, parent } = stack.pop(); - // Case 1: Object if (typeof obj === 'object' && obj !== null && !Array.isArray(obj)) { Object.keys(obj).forEach((k) => { @@ -592,7 +589,6 @@ export class DataQueriesService { }); continue; } - // Case 2: Array if (Array.isArray(obj)) { obj.forEach((element, index) => { @@ -600,52 +596,54 @@ export class DataQueriesService { }); continue; } - // Case 3: String if (typeof obj === 'string') { let resolvedValue = obj.replace(/\n/g, ' '); - // a: Handle strings with both {{ }} and %% - if (resolvedValue.includes('{{') && resolvedValue.includes('}}') && resolvedValue.includes('%%')) { + if ( + typeof resolvedValue === 'string' && + resolvedValue.includes('{{') && + resolvedValue.includes('}}') && + resolvedValue?.includes('%%') + ) { let resolvedVar = options[resolvedValue]; - // find all server variables in the string - if (resolvedValue.includes(`server.`)) { + if (typeof resolvedValue === 'string' && resolvedValue.includes(`server.`)) { let serverVariables: string[] = resolvedValue.match(/server.(.*?)%%/g) || []; - // Map each variable by replacing '%%' and 'server.' serverVariables = serverVariables?.map((variable) => { return variable.replace('%%', '').replace('server.', ''); }); - const resolvedOrgVar: string[] = []; - for (const variable of serverVariables || []) { const resolvedVariable = await this.resolveVariable(variable, organization_id); resolvedOrgVar.push(resolvedVariable); } - serverVariables?.forEach((i) => { resolvedVar = resolvedVar.replace('HiddenEnvironmentVariable', resolvedOrgVar[i]); }); } - if (parent && key !== null) { parent[key] = resolvedVar; } } - // b: Handle {{constants.}} or {{secrets.}} - if (resolvedValue?.includes('{{constants.') || resolvedValue.includes('{{secrets.')) { + if ( + (typeof resolvedValue === 'string' && resolvedValue.includes('{{constants.')) || + resolvedValue.includes('{{secrets.') + ) { const resolvingConstant = await this.resolveConstants(resolvedValue, organization_id, environmentId); resolvedValue = resolvingConstant; if (parent && key !== null) { parent[key] = resolvedValue; } } - // c: Replace all occurrences of {{ }} variables - if (resolvedValue?.match(/\{\{(.*?)\}\}/g)?.length > 0) { + if ( + typeof resolvedValue === 'string' && + resolvedValue?.match(/\{\{(.*?)\}\}/g)?.length > 0 && + !(resolvedValue.startsWith('{{') && resolvedValue.endsWith('}}')) + ) { const variables = resolvedValue.match(/\{\{(.*?)\}\}/g); for (const variable of variables || []) { @@ -655,18 +653,25 @@ export class DataQueriesService { // Ensure parent is a non-empty array before attempting to access its first element if (Array.isArray(parent) && parent.length > 0) { // Assign replacement value based on the first item in the parent array - replacement = replacement[parent[0]]; + replacement = replacement[parent[0]] || replacement; } } - resolvedValue = resolvedValue.replace(variable, replacement); + // Check type of replacement and assign accordingly + if (typeof replacement === 'string' || typeof replacement === 'number') { + // If replacement is a string, perform the replace + resolvedValue = resolvedValue.replace(variable, String(replacement)); + } else { + // If replacement is an object or an array, assign the whole value to resolvedValue + resolvedValue = resolvedValue.replace(variable, JSON.stringify(replacement)); + } } if (parent && key !== null) { parent[key] = resolvedValue; } } - // d: Simple variable replacement for single {{variable}} if ( + typeof resolvedValue === 'string' && resolvedValue.startsWith('{{') && resolvedValue.endsWith('}}') && (resolvedValue.match(/{{/g) || [])?.length === 1 @@ -676,9 +681,9 @@ export class DataQueriesService { parent[key] = resolvedValue; } } - // e: Handle strings with %% if ( + typeof resolvedValue === 'string' && resolvedValue.startsWith('%%') && resolvedValue.endsWith('%%') && (resolvedValue.match(/%%/g) || [])?.length === 2 @@ -692,9 +697,9 @@ export class DataQueriesService { parent[key] = resolvedValue; } } - // f: Replace all %% variables - const variables = resolvedValue?.match(/%%(.*?)%%/g); + //disallow strings with spaces in between '%%' eg. '%% hghgh hg %%' + const variables = typeof resolvedValue === 'string' && resolvedValue?.match(/%%(?:client|server)\.[^\s%%]+%%/g); if (variables?.length > 0) { for (const variable of variables) { if (variable.includes(`server.`)) { @@ -710,7 +715,6 @@ export class DataQueriesService { } } } - return object; } From 1fd1f24040296932dc8e7f8a4c0123df059fbf7e Mon Sep 17 00:00:00 2001 From: Rohan Lahori <64496391+rohanlahori@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:15:32 +0530 Subject: [PATCH 14/15] ui fixes and changes (#11283) --- frontend/src/_styles/global-datasources.scss | 1 + frontend/src/_styles/theme.scss | 10 +++++++++- server/src/services/organizations.service.ts | 2 +- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/frontend/src/_styles/global-datasources.scss b/frontend/src/_styles/global-datasources.scss index 1cbaed557b..fb482533bc 100644 --- a/frontend/src/_styles/global-datasources.scss +++ b/frontend/src/_styles/global-datasources.scss @@ -179,6 +179,7 @@ .datasource-list-container { overflow-y: auto; max-height: calc(100vh - 64px); + padding-left: 20px; .datasource-list { width: 976px; diff --git a/frontend/src/_styles/theme.scss b/frontend/src/_styles/theme.scss index 50fb8d60f6..a5987eee1d 100644 --- a/frontend/src/_styles/theme.scss +++ b/frontend/src/_styles/theme.scss @@ -3656,6 +3656,9 @@ input:focus-visible { } .main-wrapper.theme-dark { + position: relative; + min-height: 100%; + min-width: 100%; background-color: #2b394b; } @@ -7796,7 +7799,11 @@ tbody { .audit-log-nav-item { bottom: 40px; } - +.workspace-content-wrapper{ + overflow-x: auto; + overflow-y: auto; + padding-left: 20px; +} .workspace-content-wrapper, .database-page-content-wrap { background-color: var(--page-default); @@ -10560,6 +10567,7 @@ tbody { .manage-groups-body { padding: 12px 12px 10px 12px; font-size: 12px; + overflow-y: auto; // overflow-y: auto; height: calc(100vh - 300px); diff --git a/server/src/services/organizations.service.ts b/server/src/services/organizations.service.ts index 1a77a7f34c..0a539bd381 100644 --- a/server/src/services/organizations.service.ts +++ b/server/src/services/organizations.service.ts @@ -845,7 +845,7 @@ export class OrganizationsService { ...(slug && { slug }), }, }); - if (result) throw new ConflictException(`${name ? 'Name' : 'Slug'} must be unique`); + if (result) throw new ConflictException(`Workspace ${name ? 'name' : 'slug'} already exists`); return; } From 978393114f2b9c2ffbf7feb8e89094d027d5e34c Mon Sep 17 00:00:00 2001 From: Parth <108089718+parthy007@users.noreply.github.com> Date: Tue, 12 Nov 2024 13:16:54 +0530 Subject: [PATCH 15/15] Remove extra index input (#2646) --- marketplace/plugins/pinecone/lib/operations.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/marketplace/plugins/pinecone/lib/operations.json b/marketplace/plugins/pinecone/lib/operations.json index b5d3a4e3c9..cd798370bc 100644 --- a/marketplace/plugins/pinecone/lib/operations.json +++ b/marketplace/plugins/pinecone/lib/operations.json @@ -5,14 +5,6 @@ "type": "database", "defaults": {}, "properties": { - "index": { - "label": "Index", - "key": "index", - "type": "text", - "description": "Enter the index name (e.g., example-index)", - "placeholder": "example-index", - "height": "36px" - }, "operation": { "label": "Operation", "key": "operation",