From b08aea22410d0495ba7ac87bbbbab95fb08be3da Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 18 Jul 2022 15:23:07 +0100 Subject: [PATCH 01/21] Allow full spectrum cards to be clickable --- packages/client/manifest.json | 14 ++++++++------ .../src/components/app/SpectrumCard.svelte | 16 +++++++++++++--- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/packages/client/manifest.json b/packages/client/manifest.json index fdb5700a5c..8be92e19f6 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3509,17 +3509,18 @@ }, { "type": "boolean", - "label": "Show button", + "label": "Use button for click action", "key": "showButton" }, { "type": "text", "key": "buttonText", - "label": "Button text" + "label": "Button text", + "dependsOn": "showButton" }, { "type": "event", - "label": "Button action", + "label": "Click action", "key": "buttonOnClick" } ] @@ -3841,18 +3842,19 @@ }, { "type": "boolean", - "label": "Show button", + "label": "Use button for click action", "key": "showCardButton" }, { "type": "text", "key": "cardButtonText", "label": "Button text", - "nested": true + "nested": true, + "dependsOn": "showCardButton" }, { "type": "event", - "label": "Button action", + "label": "Click action", "key": "cardButtonOnClick", "nested": true } diff --git a/packages/client/src/components/app/SpectrumCard.svelte b/packages/client/src/components/app/SpectrumCard.svelte index 4b4f9d62f2..3b2fe44f4e 100644 --- a/packages/client/src/components/app/SpectrumCard.svelte +++ b/packages/client/src/components/app/SpectrumCard.svelte @@ -19,9 +19,10 @@ const handleLink = e => { if (!linkURL) { - return + return false } e.preventDefault() + e.stopPropagation() routeStore.actions.navigate(linkURL, linkPeek) } @@ -32,6 +33,8 @@ tabindex="0" role="figure" class:horizontal + class:clickable={buttonOnClick && !showButton} + on:click={showButton ? null : buttonOnClick} > {#if imageURL} {/if} @@ -81,6 +86,11 @@ flex-direction: column; justify-content: flex-start; align-items: stretch; + transition: border-color 130ms ease-out; + } + .spectrum-Card.clickable:hover { + cursor: pointer; + border-color: var(--spectrum-global-color-gray-500) !important; } .spectrum-Card.horizontal { flex-direction: row; @@ -90,7 +100,7 @@ padding: var(--spectrum-global-dimension-size-50) 0; } .spectrum-Card-title.link { - transition: color 130ms ease-in-out; + transition: color 130ms ease-out; } .spectrum-Card-title.link:hover { cursor: pointer; From ac378e18394a4e527d643fbf8bcde24a438c0312 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 14:11:40 +0100 Subject: [PATCH 02/21] Contains now works for internalSearch array type --- packages/frontend-core/src/constants.js | 2 +- .../src/api/controllers/row/internalSearch.js | 55 ++++++++++++------- 2 files changed, 36 insertions(+), 21 deletions(-) diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index 00af4127e4..4ac2a02f6c 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -35,7 +35,7 @@ export const OperatorOptions = { label: "Less than", }, Contains: { - value: "equal", + value: "contains", label: "Contains", }, NotContains: { diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index e6090ad8f0..8a04fc2bd0 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -19,6 +19,7 @@ class QueryBuilder { empty: {}, notEmpty: {}, oneOf: {}, + contains: {}, ...base, } this.limit = 50 @@ -119,6 +120,11 @@ class QueryBuilder { return this } + addContains(key, value) { + this.query.contains[key] = value + return this + } + /** * Preprocesses a value before going into a lucene search. * Transforms strings to lowercase and wraps strings and bools in quotes. @@ -164,6 +170,31 @@ class QueryBuilder { return `${key}:${builder.preprocess(value, allPreProcessingOpts)}` } + const contains = (key, value) => { + if (!value && value !== 0) { + return null + } + return `${key}:${builder.preprocess(value, { escape: true })}` + } + + const oneOf = (key, value) => { + if (!Array.isArray(value)) { + if (typeof value === "string") { + value = value.split(",") + } else { + return "" + } + } + let orStatement = `${builder.preprocess(value[0], allPreProcessingOpts)}` + for (let i = 1; i < value.length; i++) { + orStatement += ` OR ${builder.preprocess( + value[i], + allPreProcessingOpts + )}` + } + return `${key}:(${orStatement})` + } + function build(structure, queryFn) { for (let [key, value] of Object.entries(structure)) { key = builder.preprocess(key.replace(/ /g, "_"), { @@ -239,26 +270,10 @@ class QueryBuilder { build(this.query.notEmpty, key => `${key}:["" TO *]`) } if (this.query.oneOf) { - build(this.query.oneOf, (key, value) => { - if (!Array.isArray(value)) { - if (typeof value === "string") { - value = value.split(",") - } else { - return "" - } - } - let orStatement = `${builder.preprocess( - value[0], - allPreProcessingOpts - )}` - for (let i = 1; i < value.length; i++) { - orStatement += ` OR ${builder.preprocess( - value[i], - allPreProcessingOpts - )}` - } - return `${key}:(${orStatement})` - }) + build(this.query.oneOf, oneOf) + } + if (this.query.contains) { + build(this.query.contains, contains) } // make sure table ID is always added as an AND if (tableId) { From 9b12dd6b47ad6c94628829dc432bce94c30698c2 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 14:17:09 +0100 Subject: [PATCH 03/21] Test prettier precommit --- packages/server/src/api/controllers/row/internalSearch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index 8a04fc2bd0..c951baec3e 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -20,7 +20,7 @@ class QueryBuilder { notEmpty: {}, oneOf: {}, contains: {}, - ...base, + ...base } this.limit = 50 this.sortOrder = "ascending" From ed0bd077326fb0d0cc8007a22890a1de3ea05b93 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 17:25:41 +0100 Subject: [PATCH 04/21] Added contains support for datasource pluses --- .../src/api/controllers/row/internalSearch.js | 4 +- packages/server/src/definitions/datasource.ts | 3 ++ packages/server/src/integrations/base/sql.ts | 52 ++++++++++++++----- 3 files changed, 44 insertions(+), 15 deletions(-) diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index c951baec3e..a81620c90c 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -19,8 +19,8 @@ class QueryBuilder { empty: {}, notEmpty: {}, oneOf: {}, - contains: {}, - ...base + contains: {} , + ...base, } this.limit = 50 this.sortOrder = "ascending" diff --git a/packages/server/src/definitions/datasource.ts b/packages/server/src/definitions/datasource.ts index 90c81abe9f..9752fc947a 100644 --- a/packages/server/src/definitions/datasource.ts +++ b/packages/server/src/definitions/datasource.ts @@ -131,6 +131,9 @@ export interface SearchFilters { oneOf?: { [key: string]: any[] } + contains?: { + [key: string]: any + } } export interface SortJson { diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index fbbc42151a..3e7bcbf317 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -142,6 +142,21 @@ class InternalBuilder { } } } + + const like = (key: string, value: any) => { + const fnc = allOr ? "orWhere" : "where" + // postgres supports ilike, nothing else does + if (this.client === SqlClients.POSTGRES) { + query = query[fnc](key, "ilike", `%${value}%`) + } else { + const rawFnc = `${fnc}Raw` + // @ts-ignore + query = query[rawFnc](`LOWER(${likeKey(this.client, key)}) LIKE ?`, [ + `%${value}%`, + ]) + } + } + if (!filters) { return query } @@ -168,19 +183,7 @@ class InternalBuilder { }) } if (filters.fuzzy) { - iterate(filters.fuzzy, (key, value) => { - const fnc = allOr ? "orWhere" : "where" - // postgres supports ilike, nothing else does - if (this.client === SqlClients.POSTGRES) { - query = query[fnc](key, "ilike", `%${value}%`) - } else { - const rawFnc = `${fnc}Raw` - // @ts-ignore - query = query[rawFnc](`LOWER(${likeKey(this.client, key)}) LIKE ?`, [ - `%${value}%`, - ]) - } - }) + iterate(filters.fuzzy, like) } if (filters.range) { iterate(filters.range, (key, value) => { @@ -223,6 +226,29 @@ class InternalBuilder { query = query[fnc](key) }) } + if (filters.contains) { + const fnc = allOr ? "orWhere" : "where" + const rawFnc = `${fnc}Raw` + if (this.client === SqlClients.POSTGRES) { + iterate(filters.contains, (key: string, value: any) => { + const fieldNames = key.split(/\./g) + const tableName = fieldNames[0] + const columnName = fieldNames[1] + // @ts-ignore + query = query[rawFnc](`"${tableName}"."${columnName}"::jsonb @> '["${value}"]'`) + }) + } else if (this.client === SqlClients.MY_SQL) { + iterate(filters.contains, (key: string, value: any) => { + if (typeof value === "string") { + value = `"${value}"` + } + // @ts-ignore + query = query[rawFnc](`JSON_CONTAINS(${key}, '${value}')`) + }) + } else { + iterate(filters.contains, like) + } + } return query } From da066a95b417959db70512973a6328c403cdfe6f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 17:28:56 +0100 Subject: [PATCH 05/21] lint fix --- packages/server/src/api/controllers/row/internalSearch.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/row/internalSearch.js b/packages/server/src/api/controllers/row/internalSearch.js index a81620c90c..8a04fc2bd0 100644 --- a/packages/server/src/api/controllers/row/internalSearch.js +++ b/packages/server/src/api/controllers/row/internalSearch.js @@ -19,7 +19,7 @@ class QueryBuilder { empty: {}, notEmpty: {}, oneOf: {}, - contains: {} , + contains: {}, ...base, } this.limit = 50 From 57e24b87223e3f1631e70846e107413836ba25e5 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 18:03:50 +0100 Subject: [PATCH 06/21] Yarn lock --- packages/server/yarn.lock | 38 +++++++++++++++++++------------------- packages/worker/yarn.lock | 38 +++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 38 deletions(-) diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 06c6070132..e15c64cf25 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.15-alpha.1.tgz#fb2b726a9afe301aaedbf09a5bcfa82ef14fa7b9" - integrity sha512-tVujXhAA7E8h9DbmAeRmje/CcJKwWvPIk8og6o46kmkdLx+7lwm4AG4ImrsR9PoRtvhkdUClAUwuGtFGcsafwg== +"@budibase/backend-core@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.15-alpha.3.tgz#2c082606f17b2adeaff2a88b18c3a247abc3f3aa" + integrity sha512-qg3hEmZjMRJyZK2OnvEUhQ7gCXZzSJ6036XHX8dUWfSiiUD60R1qLiAjSKDOPGDlZ4T3zsAYUAzJkyc++dUYbQ== dependencies: - "@budibase/types" "^1.1.15-alpha.1" + "@budibase/types" "^1.1.15-alpha.3" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.15-alpha.1.tgz#8013b5bdb6adea291bf29a32f9c572e5cc1f9fc8" - integrity sha512-8DwIs12un59YnLNlqUFQgGqclf4Dmpp76Yo4cVDeRkaKDvbRJoUUK7jkYsDpstU6FVXD8m6/0l8Pwr3gWN5iyQ== +"@budibase/pro@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.15-alpha.3.tgz#15ff94878e677092b631e3bdde6ff7fb3403f8b9" + integrity sha512-Xw32Q7Mbc6HtsPv1viWqBewMUMVNSZPvBmjYUEl5zezwsAaoHV5Tbbak5noLIHYfxmZO/kBWbBgVDxEx4ja3jQ== dependencies: - "@budibase/backend-core" "1.1.15-alpha.1" - "@budibase/types" "1.1.15-alpha.1" + "@budibase/backend-core" "1.1.15-alpha.3" + "@budibase/types" "1.1.15-alpha.3" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": @@ -1204,15 +1204,15 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.15-alpha.1.tgz#4abb0830e3c1dca4a49bc974371edda922f8253b" - integrity sha512-x00f0/JY2CayjGEBR9R2cH/87nFV1dg2bZHXdMIWN6djcQjBsMjkaq+Qx2xJtWPMcld9yufPbBWdfgVQsiPc0A== +"@budibase/types@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.15-alpha.3.tgz#6e46c4fa3fdea3544871d0b529b4c8baeadc597b" + integrity sha512-vIZuXnjExC34yMXCStp174jzMSObH3FIfHHCl373x/Jkgh0uAqDYxQe0hFYiuBH81OrD4TGbOD1+qL5pqODyVw== -"@budibase/types@^1.1.15-alpha.1": - version "1.1.16" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.16.tgz#4dd1f0b1e630abd46749414d74a1fdd07820df54" - integrity sha512-jaOdsCOx0CJ2tyKodTI6PMo9CNHTo1nsMMrRi/XFIFQtGOypkiNoskb5u0Ee3GtpN6LNXgwPdrYnh+vcIL9lRw== +"@budibase/types@^1.1.15-alpha.3": + version "1.1.17" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.17.tgz#fa58e86f3858c04a8b79094193ff87ac57a499fe" + integrity sha512-3sTH3tjPd+NEk5CIN23bgwyGXXNYq/hwaxKMbYLKGr45K6m9WDZs6saWxJ2JwguNtKGB9RggzCVR/DFJH2zI1A== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 8f79dc881c..d6a6d76c7c 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.15-alpha.1.tgz#fb2b726a9afe301aaedbf09a5bcfa82ef14fa7b9" - integrity sha512-tVujXhAA7E8h9DbmAeRmje/CcJKwWvPIk8og6o46kmkdLx+7lwm4AG4ImrsR9PoRtvhkdUClAUwuGtFGcsafwg== +"@budibase/backend-core@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.15-alpha.3.tgz#2c082606f17b2adeaff2a88b18c3a247abc3f3aa" + integrity sha512-qg3hEmZjMRJyZK2OnvEUhQ7gCXZzSJ6036XHX8dUWfSiiUD60R1qLiAjSKDOPGDlZ4T3zsAYUAzJkyc++dUYbQ== dependencies: - "@budibase/types" "^1.1.15-alpha.1" + "@budibase/types" "^1.1.15-alpha.3" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,24 +324,24 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.15-alpha.1.tgz#8013b5bdb6adea291bf29a32f9c572e5cc1f9fc8" - integrity sha512-8DwIs12un59YnLNlqUFQgGqclf4Dmpp76Yo4cVDeRkaKDvbRJoUUK7jkYsDpstU6FVXD8m6/0l8Pwr3gWN5iyQ== +"@budibase/pro@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.15-alpha.3.tgz#15ff94878e677092b631e3bdde6ff7fb3403f8b9" + integrity sha512-Xw32Q7Mbc6HtsPv1viWqBewMUMVNSZPvBmjYUEl5zezwsAaoHV5Tbbak5noLIHYfxmZO/kBWbBgVDxEx4ja3jQ== dependencies: - "@budibase/backend-core" "1.1.15-alpha.1" - "@budibase/types" "1.1.15-alpha.1" + "@budibase/backend-core" "1.1.15-alpha.3" + "@budibase/types" "1.1.15-alpha.3" node-fetch "^2.6.1" -"@budibase/types@1.1.15-alpha.1": - version "1.1.15-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.15-alpha.1.tgz#4abb0830e3c1dca4a49bc974371edda922f8253b" - integrity sha512-x00f0/JY2CayjGEBR9R2cH/87nFV1dg2bZHXdMIWN6djcQjBsMjkaq+Qx2xJtWPMcld9yufPbBWdfgVQsiPc0A== +"@budibase/types@1.1.15-alpha.3": + version "1.1.15-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.15-alpha.3.tgz#6e46c4fa3fdea3544871d0b529b4c8baeadc597b" + integrity sha512-vIZuXnjExC34yMXCStp174jzMSObH3FIfHHCl373x/Jkgh0uAqDYxQe0hFYiuBH81OrD4TGbOD1+qL5pqODyVw== -"@budibase/types@^1.1.15-alpha.1": - version "1.1.16" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.16.tgz#4dd1f0b1e630abd46749414d74a1fdd07820df54" - integrity sha512-jaOdsCOx0CJ2tyKodTI6PMo9CNHTo1nsMMrRi/XFIFQtGOypkiNoskb5u0Ee3GtpN6LNXgwPdrYnh+vcIL9lRw== +"@budibase/types@^1.1.15-alpha.3": + version "1.1.17" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.17.tgz#fa58e86f3858c04a8b79094193ff87ac57a499fe" + integrity sha512-3sTH3tjPd+NEk5CIN23bgwyGXXNYq/hwaxKMbYLKGr45K6m9WDZs6saWxJ2JwguNtKGB9RggzCVR/DFJH2zI1A== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 58c02ee05d048da3fd360ff36853c9c85e129d1c Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 18:04:27 +0100 Subject: [PATCH 07/21] Prettier --- packages/server/src/integrations/base/sql.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index 3e7bcbf317..62db482a24 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -235,7 +235,9 @@ class InternalBuilder { const tableName = fieldNames[0] const columnName = fieldNames[1] // @ts-ignore - query = query[rawFnc](`"${tableName}"."${columnName}"::jsonb @> '["${value}"]'`) + query = query[rawFnc]( + `"${tableName}"."${columnName}"::jsonb @> '["${value}"]'` + ) }) } else if (this.client === SqlClients.MY_SQL) { iterate(filters.contains, (key: string, value: any) => { From 0c88195ab06d18502a79e4f1f7bd12f0ac432759 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 19 Jul 2022 18:34:30 +0100 Subject: [PATCH 08/21] Handle numeric types Postgres --- packages/server/src/integrations/base/sql.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index 62db482a24..750564c6ff 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -234,9 +234,12 @@ class InternalBuilder { const fieldNames = key.split(/\./g) const tableName = fieldNames[0] const columnName = fieldNames[1] + if (typeof value === "string") { + value = `"${value}"` + } // @ts-ignore query = query[rawFnc]( - `"${tableName}"."${columnName}"::jsonb @> '["${value}"]'` + `"${tableName}"."${columnName}"::jsonb @> '[${value}]'` ) }) } else if (this.client === SqlClients.MY_SQL) { From bdc8d1e675fef1619952e0ecc6d90bb20d1dcef1 Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 20 Jul 2022 16:38:42 +0100 Subject: [PATCH 09/21] Fix for left positioning of the KeyValueBuilder drawers --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 2 ++ .../src/components/common/bindings/DrawerBindableInput.svelte | 3 ++- .../builder/src/components/integration/KeyValueBuilder.svelte | 2 ++ .../datasource/[selectedDatasource]/rest/[query]/index.svelte | 3 +++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 8b34cf8cd2..f77374985d 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -246,6 +246,7 @@ {bindings} allowJS={false} updateOnChange={false} + drawerLeft="260px" /> {/if} {:else if value.customType === "query"} @@ -335,6 +336,7 @@ {bindings} updateOnChange={false} placeholder={value.customType === "queryLimit" ? queryLimit : ""} + drawerLeft="260px" /> {/if} diff --git a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte index b162408b26..b8d418c62b 100644 --- a/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte +++ b/packages/builder/src/components/common/bindings/DrawerBindableInput.svelte @@ -18,6 +18,7 @@ export let fillWidth export let allowJS = true export let updateOnChange = true + export let drawerLeft const dispatch = createEventDispatcher() let bindingDrawer @@ -53,7 +54,7 @@ {/if} - + Add the objects on the left to enrich your text. diff --git a/packages/builder/src/components/integration/KeyValueBuilder.svelte b/packages/builder/src/components/integration/KeyValueBuilder.svelte index 9b46bc0364..4ffb380aa4 100644 --- a/packages/builder/src/components/integration/KeyValueBuilder.svelte +++ b/packages/builder/src/components/integration/KeyValueBuilder.svelte @@ -32,6 +32,7 @@ export let menuItems export let showMenu = false export let bindings = [] + export let bindingDrawerLeft let fields = Object.entries(object || {}).map(([name, value]) => ({ name, @@ -119,6 +120,7 @@ value={field.value} allowJS={false} fillWidth={true} + drawerLeft={bindingDrawerLeft} /> {:else} @@ -448,6 +449,7 @@ name="param" headings bindings={mergedBindings} + bindingDrawerLeft="260px" /> @@ -458,6 +460,7 @@ name="header" headings bindings={mergedBindings} + bindingDrawerLeft="260px" /> From 1373710065aed338a9309a76d79c31669eb011d3 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 20 Jul 2022 17:44:30 +0100 Subject: [PATCH 10/21] AutoScreensUI test changes Changes related to the UI redesign - Also added new command to filter screens by access level --- .../addMultiOptionDatatype.spec.js | 2 +- .../cypress/integration/autoScreensUI.spec.js | 43 +++++++++---------- packages/builder/cypress/support/commands.js | 26 ++++++++--- packages/builder/cypress/support/interact.js | 2 +- 4 files changed, 42 insertions(+), 31 deletions(-) diff --git a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js b/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js index 32f62efe1f..88ab6b94a7 100644 --- a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js +++ b/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js @@ -17,7 +17,7 @@ filterTests(['all'], () => { it("should add form with multi select picker, containing 5 options", () => { cy.navigateToFrontend() // Add data provider - cy.get(interact.CATEGORY_DATA, { timeout: 500 }).click() + cy.get(interact.CATEGORY_DATA, { timeout: 2000 }).click() cy.get(interact.COMPONENT_DATA_PROVIDER).click() cy.get(interact.DATASOURCE_PROP_CONTROL).click() cy.get(interact.DROPDOWN).contains("Multi Data").click() diff --git a/packages/builder/cypress/integration/autoScreensUI.spec.js b/packages/builder/cypress/integration/autoScreensUI.spec.js index ca997479ae..9431fc1782 100644 --- a/packages/builder/cypress/integration/autoScreensUI.spec.js +++ b/packages/builder/cypress/integration/autoScreensUI.spec.js @@ -14,11 +14,8 @@ filterTests(['smoke', 'all'], () => { cy.closeModal(); cy.contains("Design").click() - cy.get(interact.LABEL_ADD_CIRCLE).click() - cy.get(interact.SPECTRUM_MODAL).within(() => { - cy.get(interact.ITEM_DISABLED).contains("Autogenerated screens") - cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled') - }) + cy.navigateToAutogeneratedModal() + cy.get(interact.CONFIRM_WRAP_SPE_BUTTON).should('be.disabled') cy.deleteAllApps() }); @@ -45,25 +42,25 @@ filterTests(['smoke', 'all'], () => { // Create Autogenerated screens from the internal table cy.createDatasourceScreen(["Cypress Tests"]) // Confirm screens have been auto generated - cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").click({ force: true }) - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'cypress-tests/:id') + cy.get(interact.BODY).should('contain', "cypress-tests") + .and('contain', 'cypress-tests/:id') .and('contain', 'cypress-tests/new/row') }) it("should generate multiple internal table screens at once", () => { - // Create a second internal table const initialTable = "Cypress Tests" const secondTable = "Table Two" + // Create a second internal table cy.createTable(secondTable) // Create Autogenerated screens from the internal tables cy.createDatasourceScreen([initialTable, secondTable]) // Confirm screens have been auto generated - cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").click({ force: true }) // Previously generated tables are suffixed with numbers - as expected - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'cypress-tests-2/:id') + cy.get(interact.BODY).should('contain', 'cypress-tests-2') + .and('contain', 'cypress-tests-2/:id') .and('contain', 'cypress-tests-2/new/row') - cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-two").click() - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-two/:id') + .and('contain', 'table-two') + .and('contain', 'table-two/:id') .and('contain', 'table-two/new/row') }) @@ -73,17 +70,17 @@ filterTests(['smoke', 'all'], () => { cy.createTable("Table Four") cy.createDatasourceScreen(["Table Three", "Table Four"], "Admin") - cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-three").click() - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-three/:id') + // Filter screens to Admin + cy.filterScreensAccessLevel('Admin') + + cy.get(interact.BODY).should('contain', 'table-three') + .and('contain', 'table-three/:id') .and('contain', 'table-three/new/row') - - cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-four").click() - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'table-four/:id') + .and('contain', 'table-four') + .and('contain', 'table-four/:id') .and('contain', 'table-four/new/row') - - //The access level should now be set to admin. Previous screens should be filtered. - cy.get(interact.NAV_ITEMS_CONTAINER).contains("table-two").should('not.exist') - cy.get(interact.NAV_ITEMS_CONTAINER).contains("cypress-tests").should('not.exist') + .and('not.contain', 'table-two') + .and('not.contain', 'cypress-tests') }) if (Cypress.env("TEST_ENV")) { @@ -96,8 +93,8 @@ filterTests(['smoke', 'all'], () => { // Create Autogenerated screens from a MySQL table - MySQL contains books table cy.createDatasourceScreen(["books"]) - cy.get(interact.NAV_ITEMS_CONTAINER).contains("books").click() - cy.get(interact.NAV_ITEMS_CONTAINER).should('contain', 'books/:id') + cy.get(interact.BODY).should('contain', 'books') + .and('contain', 'books/:id') .and('contain', 'books/new/row') }) } diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 21df5b8592..914faba461 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -510,8 +510,10 @@ Cypress.Commands.add("addCustomSourceOptions", totalOptions => { }) }) -// DESIGN AREA +// DESIGN SECTION Cypress.Commands.add("addComponent", (category, component) => { + cy.get(".spectrum-Button").contains("Component").click() + if (category) { cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({ force: true, @@ -546,7 +548,7 @@ Cypress.Commands.add("getComponent", componentId => { Cypress.Commands.add("createScreen", (route, accessLevelLabel) => { // Blank Screen cy.contains("Design").click() - cy.get("[aria-label=AddCircle]").click() + cy.get(".header > .add-button").click() cy.get(".spectrum-Modal").within(() => { cy.get("[data-cy='blank-screen']").click() cy.get(".spectrum-Button").contains("Continue").click({ force: true }) @@ -571,7 +573,7 @@ Cypress.Commands.add( "createDatasourceScreen", (datasourceNames, accessLevelLabel) => { cy.contains("Design").click() - cy.get("[aria-label=AddCircle]").click() + cy.get(".header > .add-button").click() cy.get(".spectrum-Modal").within(() => { cy.get(".item").contains("Autogenerated screens").click() cy.get(".spectrum-Button").contains("Continue").click({ force: true }) @@ -626,13 +628,23 @@ Cypress.Commands.add( } ) +Cypress.Commands.add("filterScreensAccessLevel", accessLevel => { + // Filters screens by access level dropdown + cy.get(".body").within(() => { + cy.get(".spectrum-Form-item").eq(1).click() + }) + cy.get(".spectrum-Menu").within(() => { + cy.contains(accessLevel).click() + }) +}) + // NAVIGATION Cypress.Commands.add("navigateToFrontend", () => { // Clicks on Design tab and then the Home nav item cy.wait(500) cy.contains("Design").click() cy.get(".spectrum-Search", { timeout: 2000 }).type("/") - cy.get(".nav-item", { timeout: 2000 }).contains("home").click() + cy.get(".nav-item", { timeout: 2000 }).contains("home").click({ force: true }) }) Cypress.Commands.add("navigateToDataSection", () => { @@ -644,9 +656,11 @@ Cypress.Commands.add("navigateToDataSection", () => { Cypress.Commands.add("navigateToAutogeneratedModal", () => { // Screen name must already exist within data source cy.contains("Design").click() - cy.get("[aria-label=AddCircle]").click() + cy.get(".header > .add-button").click() cy.get(".spectrum-Modal").within(() => { - cy.get(".item").contains("Autogenerated screens").click() + cy.get(".item", { timeout: 2000 }) + .contains("Autogenerated screens") + .click({ force: true }) cy.get(".spectrum-Button").contains("Continue").click({ force: true }) cy.wait(500) }) diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js index 0b31d8a8c5..727c57bccc 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -51,7 +51,7 @@ export const LABEL_ADD_CIRCLE = "[aria-label=AddCircle]" export const ITEM_DISABLED = ".item.disabled" export const CONFIRM_WRAP_SPE_BUTTON = ".confirm-wrap .spectrum-Button" export const DATA_SOURCE_ENTRY = ".data-source-entry" -export const NAV_ITEMS_CONTAINER = ".nav-items-container" +export const BODY = ".body" //publishWorkFlow export const DEPLOY_APP_MODAL = ".spectrum-Modal [data-cy=deploy-app-modal]" From c9448296def0852e2b5e4eff0ece43bf55a1d55e Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Wed, 20 Jul 2022 19:21:30 +0100 Subject: [PATCH 11/21] CreateScreen Tests Updated the current createScreen test file: - Reworked a test related to access levels - Tests for screens of all access levels and deleting all screens (and starting new screen journey) - Added commands to delete screen and delete all screens --- .../cypress/integration/createScreen.spec.js | 39 ++++++++++++------- packages/builder/cypress/support/commands.js | 37 ++++++++++++++++++ 2 files changed, 63 insertions(+), 13 deletions(-) diff --git a/packages/builder/cypress/integration/createScreen.spec.js b/packages/builder/cypress/integration/createScreen.spec.js index 94a827f26f..a516e279f4 100644 --- a/packages/builder/cypress/integration/createScreen.spec.js +++ b/packages/builder/cypress/integration/createScreen.spec.js @@ -1,4 +1,5 @@ import filterTests from "../support/filterTests" +const interact = require('../support/interact') filterTests(["smoke", "all"], () => { context("Screen Tests", () => { @@ -10,32 +11,44 @@ filterTests(["smoke", "all"], () => { it("Should successfully create a screen", () => { cy.createScreen("test") - cy.get(".nav-items-container").within(() => { + cy.get(interact.BODY).within(() => { cy.contains("/test").should("exist") }) }) it("Should update the url", () => { cy.createScreen("test with spaces") - cy.get(".nav-items-container").within(() => { + cy.get(interact.BODY).within(() => { cy.contains("/test-with-spaces").should("exist") }) }) - it("Should create a blank screen with the selected access level", () => { - cy.createScreen("admin only", "Admin") + it("should delete all screens then create first screen via button", () => { + cy.deleteAllScreens() + + cy.contains("Create first screen").click() + cy.get(interact.BODY, { timeout: 2000 }).should('contain', '/home') + }) - cy.get(".nav-items-container").within(() => { - cy.contains("/admin-only").should("exist") - }) + it("Should create and filter screens by access level", () => { + const accessLevels = ["Basic", "Admin", "Public", "Power"] - cy.createScreen("open to all", "Public") + for (const access of accessLevels){ + // Create screen with specified access level + cy.createScreen(access, access) + // Filter by access level and confirm screen visible + cy.filterScreensAccessLevel(access) + cy.get(interact.BODY).within(() => { + cy.get(interact.NAV_ITEM).should('contain', access.toLowerCase()) + }) + } - cy.get(".nav-items-container").within(() => { - cy.contains("/open-to-all").should("exist") - //The access level should now be set to admin. Previous screens should be filtered. - cy.get(".nav-item").contains("/test-screen").should("not.exist") - }) + // Filter by All screens - Confirm all screens visible + cy.filterScreensAccessLevel("All screens") + cy.get(interact.BODY).should('contain', accessLevels[0]) + .and('contain', accessLevels[1]) + .and('contain', accessLevels[2]) + .and('contain', accessLevels[3]) }) }) }) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 914faba461..309d051483 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -638,6 +638,43 @@ Cypress.Commands.add("filterScreensAccessLevel", accessLevel => { }) }) +Cypress.Commands.add("deleteScreen", screen => { + // Navigates to Design section and deletes specified screen + cy.contains("Design").click() + cy.get(".body").within(() => { + cy.contains(screen) + .siblings(".actions") + .within(() => { + cy.get(".spectrum-Icon").click({ force: true }) + }) + }) + cy.get(".spectrum-Menu > .spectrum-Menu-item > .spectrum-Menu-itemLabel") + .contains("Delete") + .click() + + cy.get( + ".spectrum-Dialog-grid > .spectrum-ButtonGroup > .confirm-wrap > .spectrum-Button" + ).click({ force: true }) + cy.get(".spectrum-Dialog-grid", { timeout: 10000 }).should("not.exist") +}) + +Cypress.Commands.add("deleteAllScreens", () => { + // Deletes all screens + cy.get(".body") + .find(".nav-item") + .its("length") + .then(len => { + for (let i = 0; i < len; i++) { + cy.get(".body > .nav-item") + .eq(0) + .invoke("text") + .then(text => { + cy.deleteScreen(text.trim()) + }) + } + }) +}) + // NAVIGATION Cypress.Commands.add("navigateToFrontend", () => { // Clicks on Design tab and then the Home nav item From bee5b6b603168d6bc7bf9cde7013f2381c28586f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 21 Jul 2022 08:41:47 +0000 Subject: [PATCH 12/21] v1.1.18-alpha.3 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 4 ++-- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lerna.json b/lerna.json index d7175264a2..106d21fbe3 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 20a1b55607..4f9150d431 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.1.18-alpha.2", + "@budibase/types": "^1.1.18-alpha.3", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 7beb5f2663..3314a465d0 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.1.18-alpha.2", + "@budibase/string-templates": "^1.1.18-alpha.3", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 570e8b1be8..ec1d43ce9d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.2", - "@budibase/client": "^1.1.18-alpha.2", - "@budibase/frontend-core": "^1.1.18-alpha.2", - "@budibase/string-templates": "^1.1.18-alpha.2", + "@budibase/bbui": "^1.1.18-alpha.3", + "@budibase/client": "^1.1.18-alpha.3", + "@budibase/frontend-core": "^1.1.18-alpha.3", + "@budibase/string-templates": "^1.1.18-alpha.3", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 887eaf4c76..8640f9642c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.2", + "@budibase/backend-core": "^1.1.18-alpha.3", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 19a581c6d0..d9c99f76b4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.2", - "@budibase/frontend-core": "^1.1.18-alpha.2", - "@budibase/string-templates": "^1.1.18-alpha.2", + "@budibase/bbui": "^1.1.18-alpha.3", + "@budibase/frontend-core": "^1.1.18-alpha.3", + "@budibase/string-templates": "^1.1.18-alpha.3", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index ceacf027c1..b13a835d38 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.2", + "@budibase/bbui": "^1.1.18-alpha.3", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 22d1ef43a0..d60b35d2c2 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.1.18-alpha.2", - "@budibase/client": "^1.1.18-alpha.2", + "@budibase/backend-core": "^1.1.18-alpha.3", + "@budibase/client": "^1.1.18-alpha.3", "@budibase/pro": "1.1.18-alpha.2", - "@budibase/string-templates": "^1.1.18-alpha.2", - "@budibase/types": "^1.1.18-alpha.2", + "@budibase/string-templates": "^1.1.18-alpha.3", + "@budibase/types": "^1.1.18-alpha.3", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index c7fca714ca..ee75ce6336 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 3d68984e5b..fb12fb840e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 5f5648e8b6..2bc5f3e15c 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.1.18-alpha.2", + "version": "1.1.18-alpha.3", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.2", + "@budibase/backend-core": "^1.1.18-alpha.3", "@budibase/pro": "1.1.18-alpha.2", - "@budibase/string-templates": "^1.1.18-alpha.2", - "@budibase/types": "^1.1.18-alpha.2", + "@budibase/string-templates": "^1.1.18-alpha.3", + "@budibase/types": "^1.1.18-alpha.3", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 6334165b4fa024fed99e557f05247b2f738efcc0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 21 Jul 2022 08:43:20 +0000 Subject: [PATCH 13/21] Update pro version to 1.1.18-alpha.3 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index d60b35d2c2..d7638ae4d7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.1.18-alpha.3", "@budibase/client": "^1.1.18-alpha.3", - "@budibase/pro": "1.1.18-alpha.2", + "@budibase/pro": "1.1.18-alpha.3", "@budibase/string-templates": "^1.1.18-alpha.3", "@budibase/types": "^1.1.18-alpha.3", "@bull-board/api": "3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 2bc5f3e15c..226769e355 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.1.18-alpha.3", - "@budibase/pro": "1.1.18-alpha.2", + "@budibase/pro": "1.1.18-alpha.3", "@budibase/string-templates": "^1.1.18-alpha.3", "@budibase/types": "^1.1.18-alpha.3", "@koa/router": "8.0.8", From 3ba1ce80ddee46f6a373d59525e7b22605dc14bb Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 21 Jul 2022 10:28:54 +0100 Subject: [PATCH 14/21] Added unit tests for contains filter --- .../server/src/integrations/tests/sql.spec.js | 54 +++++++++++++++++-- 1 file changed, 50 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/tests/sql.spec.js b/packages/server/src/integrations/tests/sql.spec.js index c2e65c56b7..55c762573a 100644 --- a/packages/server/src/integrations/tests/sql.spec.js +++ b/packages/server/src/integrations/tests/sql.spec.js @@ -1,4 +1,5 @@ const Sql = require("../base/sql") +const { SqlClients } = require("../utils") const TABLE_NAME = "test" @@ -46,7 +47,7 @@ function generateDeleteJson(table = TABLE_NAME, filters = {}) { describe("SQL query builder", () => { const limit = 500 - const client = "pg" + const client = SqlClients.POSTGRES let sql beforeEach(() => { @@ -173,15 +174,15 @@ describe("SQL query builder", () => { }) it("should work with MS-SQL", () => { - const query = new Sql("mssql", 10)._query(generateReadJson()) + const query = new Sql(SqlClients.MS_SQL, 10)._query(generateReadJson()) expect(query).toEqual({ bindings: [10], sql: `select * from (select top (@p0) * from [${TABLE_NAME}]) as [${TABLE_NAME}]` }) }) - it("should work with mySQL", () => { - const query = new Sql("mysql", 10)._query(generateReadJson()) + it("should work with MySQL", () => { + const query = new Sql(SqlClients.MY_SQL, 10)._query(generateReadJson()) expect(query).toEqual({ bindings: [10], sql: `select * from (select * from \`${TABLE_NAME}\` limit ?) as \`${TABLE_NAME}\`` @@ -238,4 +239,49 @@ describe("SQL query builder", () => { sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."property" > $1 limit $2) as "${TABLE_NAME}"` }) }) + + it("should use like expression for MS-SQL when filter is contains", () => { + const query = new Sql(SqlClients.MS_SQL, 10)._query(generateReadJson({ + filters: { + contains: { + age: 20, + name: "John" + } + } + })) + expect(query).toEqual({ + bindings: [10, "%20%", "%John%"], + sql: `select * from (select top (@p0) * from [${TABLE_NAME}] where LOWER(${TABLE_NAME}.age) LIKE @p1 and LOWER(${TABLE_NAME}.name) LIKE @p2) as [${TABLE_NAME}]` + }) + }) + + it("should use JSON_CONTAINS expression for MySQL when filter is contains", () => { + const query = new Sql(SqlClients.MY_SQL, 10)._query(generateReadJson({ + filters: { + contains: { + age: 20, + name: "John" + } + } + })) + expect(query).toEqual({ + bindings: [10], + sql: `select * from (select * from \`${TABLE_NAME}\` where JSON_CONTAINS(${TABLE_NAME}.age, '20') and JSON_CONTAINS(${TABLE_NAME}.name, '"John"') limit ?) as \`${TABLE_NAME}\`` + }) + }) + + it("should use jsonb operator expression for PostgreSQL when filter is contains", () => { + const query = new Sql(SqlClients.POSTGRES, 10)._query(generateReadJson({ + filters: { + contains: { + age: 20, + name: "John" + } + } + })) + expect(query).toEqual({ + bindings: [10], + sql: `select * from (select * from \"${TABLE_NAME}\" where \"${TABLE_NAME}\".\"age\"::jsonb @> '[20]' and \"${TABLE_NAME}\".\"name\"::jsonb @> '["John"]' limit $1) as \"${TABLE_NAME}\"` + }) + }) }) From 7065fa3f6095195f90a7262a109ef494da9c102f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 21 Jul 2022 10:00:09 +0000 Subject: [PATCH 15/21] v1.1.18-alpha.4 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 4 ++-- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lerna.json b/lerna.json index 106d21fbe3..22cf4a1e83 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 4f9150d431..ad02630ccb 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.1.18-alpha.3", + "@budibase/types": "^1.1.18-alpha.4", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 3314a465d0..9a22fa3cea 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.1.18-alpha.3", + "@budibase/string-templates": "^1.1.18-alpha.4", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index ec1d43ce9d..d1a8e29ff3 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.3", - "@budibase/client": "^1.1.18-alpha.3", - "@budibase/frontend-core": "^1.1.18-alpha.3", - "@budibase/string-templates": "^1.1.18-alpha.3", + "@budibase/bbui": "^1.1.18-alpha.4", + "@budibase/client": "^1.1.18-alpha.4", + "@budibase/frontend-core": "^1.1.18-alpha.4", + "@budibase/string-templates": "^1.1.18-alpha.4", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 8640f9642c..bf28b34f0f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.3", + "@budibase/backend-core": "^1.1.18-alpha.4", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index d9c99f76b4..e1efa3995b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.3", - "@budibase/frontend-core": "^1.1.18-alpha.3", - "@budibase/string-templates": "^1.1.18-alpha.3", + "@budibase/bbui": "^1.1.18-alpha.4", + "@budibase/frontend-core": "^1.1.18-alpha.4", + "@budibase/string-templates": "^1.1.18-alpha.4", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index b13a835d38..6b77b38894 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.3", + "@budibase/bbui": "^1.1.18-alpha.4", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index d7638ae4d7..cb46d355d0 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.1.18-alpha.3", - "@budibase/client": "^1.1.18-alpha.3", + "@budibase/backend-core": "^1.1.18-alpha.4", + "@budibase/client": "^1.1.18-alpha.4", "@budibase/pro": "1.1.18-alpha.3", - "@budibase/string-templates": "^1.1.18-alpha.3", - "@budibase/types": "^1.1.18-alpha.3", + "@budibase/string-templates": "^1.1.18-alpha.4", + "@budibase/types": "^1.1.18-alpha.4", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index ee75ce6336..1fa97718ef 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index fb12fb840e..3233361991 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 226769e355..14bb055d25 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.1.18-alpha.3", + "version": "1.1.18-alpha.4", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.3", + "@budibase/backend-core": "^1.1.18-alpha.4", "@budibase/pro": "1.1.18-alpha.3", - "@budibase/string-templates": "^1.1.18-alpha.3", - "@budibase/types": "^1.1.18-alpha.3", + "@budibase/string-templates": "^1.1.18-alpha.4", + "@budibase/types": "^1.1.18-alpha.4", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 121e869caf7e47adfc35181634a46c07529994c3 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 21 Jul 2022 10:02:12 +0000 Subject: [PATCH 16/21] Update pro version to 1.1.18-alpha.4 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index cb46d355d0..db6ea93c6f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.1.18-alpha.4", "@budibase/client": "^1.1.18-alpha.4", - "@budibase/pro": "1.1.18-alpha.3", + "@budibase/pro": "1.1.18-alpha.4", "@budibase/string-templates": "^1.1.18-alpha.4", "@budibase/types": "^1.1.18-alpha.4", "@bull-board/api": "3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 14bb055d25..b16c661f40 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.1.18-alpha.4", - "@budibase/pro": "1.1.18-alpha.3", + "@budibase/pro": "1.1.18-alpha.4", "@budibase/string-templates": "^1.1.18-alpha.4", "@budibase/types": "^1.1.18-alpha.4", "@koa/router": "8.0.8", From fb9b897be040bba90ff07c65840131408d0ccc6d Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Fri, 22 Jul 2022 16:33:00 +0100 Subject: [PATCH 17/21] Cypress: Test Changes + New Command Data-cy IDs are gone for components (I assume due to the UI redesign) For now I have created a new command to search and add a component. Tests have been updated to reflect this --- .../addMultiOptionDatatype.spec.js | 7 +-- .../integration/addRadioButtons.spec.js | 10 ++-- .../cypress/integration/appOverview.spec.js | 2 +- .../cypress/integration/createBinding.spec.js | 8 +-- .../integration/createComponents.spec.js | 28 ++++----- .../datasources/postgreSql.spec.js | 6 +- .../cypress/integration/revertApp.spec.js | 4 +- packages/builder/cypress/support/commands.js | 59 ++++++++++++------- packages/builder/cypress/support/interact.js | 2 +- 9 files changed, 67 insertions(+), 59 deletions(-) diff --git a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js b/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js index 88ab6b94a7..f436f3ff39 100644 --- a/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js +++ b/packages/builder/cypress/integration/addMultiOptionDatatype.spec.js @@ -17,16 +17,15 @@ filterTests(['all'], () => { it("should add form with multi select picker, containing 5 options", () => { cy.navigateToFrontend() // Add data provider - cy.get(interact.CATEGORY_DATA, { timeout: 2000 }).click() - cy.get(interact.COMPONENT_DATA_PROVIDER).click() + cy.searchAndAddComponent("Data Provider") cy.get(interact.DATASOURCE_PROP_CONTROL).click() cy.get(interact.DROPDOWN).contains("Multi Data").click() // Add Form with schema to match table - cy.addComponent("Form", "Form") + cy.searchAndAddComponent("Form") cy.get(interact.DATASOURCE_PROP_CONTROL).click() cy.get(interact.DROPDOWN).contains("Multi Data").click() // Add multi-select picker to form - cy.addComponent("Form", "Multi-select Picker").then(componentId => { + cy.searchAndAddComponent("Multi-select Picker").then(componentId => { cy.get(interact.DATASOURCE_FIELD_CONTROL).type("Test Data").type("{enter}") cy.wait(1000) cy.getComponent(componentId).contains("Choose some options").click() diff --git a/packages/builder/cypress/integration/addRadioButtons.spec.js b/packages/builder/cypress/integration/addRadioButtons.spec.js index 578b519341..91cfd0c7fa 100644 --- a/packages/builder/cypress/integration/addRadioButtons.spec.js +++ b/packages/builder/cypress/integration/addRadioButtons.spec.js @@ -10,15 +10,13 @@ filterTests(['all'], () => { it("should add Radio Buttons options picker on form, add data, and confirm", () => { cy.navigateToFrontend() - cy.wait(500) - cy.addComponent("Form", "Form") - cy.addComponent("Form", "Options Picker").then((componentId) => { - // Provide field setting + cy.searchAndAddComponent("Form") + cy.searchAndAddComponent("Options Picker").then((componentId) => { + // Provide field setting cy.get(interact.DATASOURCE_FIELD_CONTROL).type("1") // Open dropdown and select Radio buttons cy.get(interact.OPTION_TYPE_PROP_CONTROL).click().then(() => { cy.get(interact.SPECTRUM_POPOVER).contains('Radio buttons') - .wait(500) .click() }) const radioButtonsTotal = 3 @@ -32,8 +30,8 @@ filterTests(['all'], () => { const addRadioButtonData = (totalRadioButtons) => { cy.get(interact.OPTION_SOURCE_PROP_CONROL).click().then(() => { cy.get(interact.SPECTRUM_POPOVER).contains('Custom') - .wait(500) .click() + .wait(1000) }) cy.addCustomSourceOptions(totalRadioButtons) } diff --git a/packages/builder/cypress/integration/appOverview.spec.js b/packages/builder/cypress/integration/appOverview.spec.js index dbfce3ce63..feaace6fb6 100644 --- a/packages/builder/cypress/integration/appOverview.spec.js +++ b/packages/builder/cypress/integration/appOverview.spec.js @@ -205,7 +205,7 @@ filterTests(["all"], () => { cy.navigateToFrontend() - cy.addComponent("Elements", "Headline").then(componentId => { + cy.searchAndAddComponent("Headline").then(componentId => { cy.getComponent(componentId).should("exist") }) diff --git a/packages/builder/cypress/integration/createBinding.spec.js b/packages/builder/cypress/integration/createBinding.spec.js index 5abe0b27d8..160f23d2d6 100644 --- a/packages/builder/cypress/integration/createBinding.spec.js +++ b/packages/builder/cypress/integration/createBinding.spec.js @@ -9,13 +9,13 @@ filterTests(['smoke', 'all'], () => { }) it("should add a current user binding", () => { - cy.addComponent("Elements", "Paragraph").then(() => { + cy.searchAndAddComponent("Paragraph").then(() => { addSettingBinding("text", "Current User._id") }) }) it("should handle an invalid binding", () => { - cy.addComponent("Elements", "Paragraph").then(componentId => { + cy.searchAndAddComponent("Paragraph").then(componentId => { // Cypress needs to escape curly brackets cy.get("[data-cy=setting-text] input") .type("{{}{{}{{} Current User._id {}}{}}") @@ -27,7 +27,7 @@ filterTests(['smoke', 'all'], () => { xit("should add a URL param binding", () => { const paramName = "foo" cy.createScreen(`/test/:${paramName}`) - cy.addComponent("Elements", "Paragraph").then(componentId => { + cy.searchAndAddComponent("Paragraph").then(componentId => { addSettingBinding("text", `URL.${paramName}`) // The builder preview pages don't have a real URL, so all we can do // is check that we were able to bind to the property, and that the @@ -37,7 +37,7 @@ filterTests(['smoke', 'all'], () => { }) it("should add a binding with a handlebars helper", () => { - cy.addComponent("Elements", "Paragraph").then(componentId => { + cy.searchAndAddComponent("Paragraph").then(componentId => { // Cypress needs to escape curly brackets cy.get("[data-cy=setting-text] input") .type("{{}{{} add 1 2 {}}{}}") diff --git a/packages/builder/cypress/integration/createComponents.spec.js b/packages/builder/cypress/integration/createComponents.spec.js index eff7fc216f..649a77e442 100644 --- a/packages/builder/cypress/integration/createComponents.spec.js +++ b/packages/builder/cypress/integration/createComponents.spec.js @@ -31,13 +31,13 @@ filterTests(["all"], () => { } it("should add a container", () => { - cy.addComponent("Layout", "Container").then(componentId => { + cy.searchAndAddComponent("Container").then(componentId => { cy.getComponent(componentId).should("exist") }) }) it("should add a headline", () => { - cy.addComponent("Elements", "Headline").then(componentId => { + cy.searchAndAddComponent("Headline").then(componentId => { headlineId = componentId cy.getComponent(headlineId).should("exist") }) @@ -63,11 +63,11 @@ filterTests(["all"], () => { }) it("should create a form and reset to match schema", () => { - cy.addComponent("Form", "Form").then(() => { + cy.searchAndAddComponent("Form").then(() => { cy.get("[data-cy=setting-dataSource]").contains("Custom").click() cy.get(interact.DROPDOWN).contains("dog").click() cy.wait(500) - cy.addComponent("Form", "Field Group").then(fieldGroupId => { + cy.searchAndAddComponent("Field Group").then(fieldGroupId => { cy.contains("Update form fields").click() cy.get(".spectrum-Modal") .get(".confirm-wrap .spectrum-Button") @@ -88,7 +88,7 @@ filterTests(["all"], () => { }) it("deletes a component", () => { - cy.addComponent("Elements", "Paragraph").then(componentId => { + cy.searchAndAddComponent("Paragraph").then(componentId => { cy.get("[data-cy=setting-_instanceName] input").type(componentId).blur() cy.get( ".nav-items-container .nav-item.selected .actions > div > .icon" @@ -104,7 +104,7 @@ filterTests(["all"], () => { }) it("should clear the iframe place holder when a form field has been set", () => { - cy.addComponent("Form", "Form").then(formId => { + cy.searchAndAddComponent("Form").then(formId => { //For deletion cy.get("[data-cy=setting-_instanceName] input") .clear() @@ -123,10 +123,7 @@ filterTests(["all"], () => { const testFieldFocusOnCreate = componentLabel => { cy.log("Adding: " + componentLabel) - return cy.addComponent("Form", componentLabel).then(componentId => { - cy.getComponent(componentId) - .find(".component-placeholder") - .should("exist") + return cy.searchAndAddComponent(componentLabel).then(componentId => { cy.get("[data-cy=setting-field] button.spectrum-Picker").click() //Click the first appropriate field. They are filtered by type @@ -157,7 +154,7 @@ filterTests(["all"], () => { }) it("should populate the provider for charts with a data provider in its path", () => { - cy.addComponent("Data", "Data Provider").then(providerId => { + cy.searchAndAddComponent("Data Provider").then(providerId => { //For deletion cy.get("[data-cy=setting-_instanceName] input") .clear() @@ -181,7 +178,7 @@ filterTests(["all"], () => { const testFocusOnCreate = chartLabel => { cy.log("Adding: " + chartLabel) - cy.addComponent("Chart", chartLabel).then(componentId => { + cy.searchAndAddComponent(chartLabel).then(componentId => { cy.get( "[data-cy=dataProvider-prop-control] .spectrum-Picker" ).should("not.have.class", "is-focused") @@ -207,7 +204,7 @@ filterTests(["all"], () => { }) it("should replace the placeholder when a url is set on an image", () => { - cy.addComponent("Elements", "Image").then(imageId => { + cy.searchAndAddComponent("Image").then(imageId => { cy.get("[data-cy=setting-_instanceName] input") .clear() .type(imageId) @@ -229,7 +226,7 @@ filterTests(["all"], () => { }) it("should add a markdown component.", () => { - cy.addComponent("Elements", "Markdown Viewer").then(markdownId => { + cy.searchAndAddComponent("Markdown Viewer").then(markdownId => { cy.get("[data-cy=setting-_instanceName] input") .clear() .type(markdownId) @@ -253,8 +250,7 @@ filterTests(["all"], () => { }) it("should direct the user when adding an Icon component.", () => { - cy.addComponent("Elements", "Icon").then(iconId => { - cy.getComponent(iconId).find(".component-placeholder").should("exist") + cy.searchAndAddComponent("Icon").then(iconId => { cy.get("[data-cy=setting-_instanceName] input") .clear() .type(iconId) diff --git a/packages/builder/cypress/integration/datasources/postgreSql.spec.js b/packages/builder/cypress/integration/datasources/postgreSql.spec.js index ccecfbd5df..0c3f2b9124 100644 --- a/packages/builder/cypress/integration/datasources/postgreSql.spec.js +++ b/packages/builder/cypress/integration/datasources/postgreSql.spec.js @@ -108,7 +108,7 @@ filterTests(["all"], () => { }) it("should delete a relationship", () => { - cy.get(".hierarchy-items-container").contains("PostgreSQL").click() + cy.get(".hierarchy-items-container").contains("PostgreSQL").click({ force: true }) cy.reload() // Delete one relationship cy.get(".spectrum-Table") @@ -156,7 +156,7 @@ filterTests(["all"], () => { it("should switch to schema with no tables", () => { // Switch Schema - To one without any tables - cy.get(".hierarchy-items-container").contains("PostgreSQL").click() + cy.get(".hierarchy-items-container").contains("PostgreSQL").click({ force: true }) switchSchema("randomText") // No tables displayed @@ -219,7 +219,7 @@ filterTests(["all"], () => { // Access query cy.get(".hierarchy-items-container", { timeout: 2000 }) .contains(queryName + " (1)") - .click() + .click({ force: true }) // Rename query cy.wait(1000) diff --git a/packages/builder/cypress/integration/revertApp.spec.js b/packages/builder/cypress/integration/revertApp.spec.js index 4c6f245b76..006b6854ba 100644 --- a/packages/builder/cypress/integration/revertApp.spec.js +++ b/packages/builder/cypress/integration/revertApp.spec.js @@ -30,7 +30,7 @@ filterTests(['smoke', 'all'], () => { cy.navigateToFrontend() // Add initial component - Paragraph - cy.addComponent("Elements", "Paragraph") + cy.searchAndAddComponent("Paragraph") // Publish app cy.get(interact.SPECTRUM_BUTTON).contains("Publish").click({ force: true }) cy.get(interact.SPECTRUM_BUTTON_GROUP).within(() => { @@ -42,7 +42,7 @@ filterTests(['smoke', 'all'], () => { }) // Add second component - Button - cy.addComponent("Elements", "Button") + cy.searchAndAddComponent("Button") // Click Revert cy.get(interact.TOP_RIGHT_NAV).within(() => { cy.get(interact.AREA_LABEL_REVERT).click({ force: true }) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 309d051483..65126bc3d2 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -4,8 +4,7 @@ Cypress.on("uncaught:exception", () => { // ACCOUNTS & USERS Cypress.Commands.add("login", (email, password) => { - cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 5000 }) - cy.wait(2000) + cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) cy.url().then(url => { if (url.includes("builder/admin")) { // create admin user @@ -210,7 +209,7 @@ Cypress.Commands.add("deleteApp", name => { cy.get(".app-overview-actions-icon").within(() => { cy.get(".spectrum-Icon").click({ force: true }) }) - cy.get(".spectrum-Menu").contains("Delete").click() + cy.get(".spectrum-Menu").contains("Delete").click({ force: true }) cy.get(".spectrum-Dialog-grid").within(() => { cy.get("input").type(name) }) @@ -491,29 +490,45 @@ Cypress.Commands.add("selectTable", tableName => { }) Cypress.Commands.add("addCustomSourceOptions", totalOptions => { - cy.get(".spectrum-ActionButton") - .contains("Define Options") - .click() - .then(() => { - for (let i = 0; i < totalOptions; i++) { - // Add radio button options - cy.get(".spectrum-Button") - .contains("Add Option") - .click({ force: true }) - .then(() => { - cy.get("[placeholder='Label']", { timeout: 500 }).eq(i).type(i) - cy.get("[placeholder='Value']").eq(i).type(i) - }) - } - // Save options - cy.get(".spectrum-Button").contains("Save").click({ force: true }) - }) + cy.get('[data-cy="customOptions-prop-control"]').within(() => { + cy.get(".spectrum-ActionButton-label").click({ force: true }) + }) + for (let i = 0; i < totalOptions; i++) { + // Add radio button options + cy.get(".spectrum-Button-label", { timeout: 1000 }) + .contains("Add Option") + .click({ force: true }) + .then(() => { + cy.get("[placeholder='Label']", { timeout: 500 }).eq(i).type(i) + cy.get("[placeholder='Value']").eq(i).type(i) + }) + } + // Save options + cy.get(".spectrum-Button").contains("Save").click({ force: true }) }) // DESIGN SECTION -Cypress.Commands.add("addComponent", (category, component) => { - cy.get(".spectrum-Button").contains("Component").click() +Cypress.Commands.add("searchAndAddComponent", component => { + // Open component menu + cy.get(".spectrum-Button").contains("Component").click({ force: true }) + // Search and add component + cy.get(".spectrum-Textfield-input").wait(500).clear().type(component) + cy.get(".body").within(() => { + cy.get(".component") + .contains(new RegExp("^" + component + "$"), { timeout: 3000 }) + .click({ force: true }) + }) + cy.wait(1000) + cy.location().then(loc => { + const params = loc.pathname.split("/") + const componentId = params[params.length - 1] + cy.getComponent(componentId, { timeout: 3000 }).should("exist") + return cy.wrap(componentId) + }) +}) + +Cypress.Commands.add("addComponent", (category, component) => { if (category) { cy.get(`[data-cy="category-${category}"]`, { timeout: 3000 }).click({ force: true, diff --git a/packages/builder/cypress/support/interact.js b/packages/builder/cypress/support/interact.js index 727c57bccc..b96e2692b4 100644 --- a/packages/builder/cypress/support/interact.js +++ b/packages/builder/cypress/support/interact.js @@ -12,7 +12,7 @@ export const APP_NAME_INPUT = "input" // we need to update this with atribute cy export const SPECTRUM_BUTTON_GROUP = ".spectrum-ButtonGroup" export const SPECTRUM_MODAL_INPUT = ".spectrum-Modal input" -//AddMultiOptionDatatype test +//AddMultiOptionDatatype export const CATEGORY_DATA = '[data-cy="category-Data"]' export const COMPONENT_DATA_PROVIDER = '[data-cy="component-Data Provider"]' export const DATASOURCE_PROP_CONTROL = '[data-cy="dataSource-prop-control"]' From 9fdcecf8da0fc334f394da5312e5c8278924e5ae Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Fri, 22 Jul 2022 16:54:17 +0100 Subject: [PATCH 18/21] Updated createApp.spec.js Including an extended timeout for the first test. Specifically when the test is looking for the create app button --- packages/builder/cypress/integration/createApp.spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/cypress/integration/createApp.spec.js b/packages/builder/cypress/integration/createApp.spec.js index 1dd0d2264f..516489b093 100644 --- a/packages/builder/cypress/integration/createApp.spec.js +++ b/packages/builder/cypress/integration/createApp.spec.js @@ -13,7 +13,7 @@ filterTests(['smoke', 'all'], () => { it("should show the new user UI/UX", () => { cy.visit(`${Cypress.config().baseUrl}/builder/portal/apps/create`, { timeout: 5000 }) //added /portal/apps/create cy.wait(1000) - cy.get(interact.CREATE_APP_BUTTON).contains('Start from scratch').should("exist") + cy.get(interact.CREATE_APP_BUTTON, { timeout: 10000 }).contains('Start from scratch').should("exist") cy.get(interact.TEMPLATE_CATEGORY_FILTER).should("exist") cy.get(interact.TEMPLATE_CATEGORY).should("exist") From 9eceb2b9b02c18237706edff0947fec0f11e8f70 Mon Sep 17 00:00:00 2001 From: Mitch-Budibase Date: Fri, 22 Jul 2022 17:39:38 +0100 Subject: [PATCH 19/21] Update command file Including a wait which seems necessary when logging in for the first time --- packages/builder/cypress/support/commands.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/cypress/support/commands.js b/packages/builder/cypress/support/commands.js index 65126bc3d2..cc92ca280a 100644 --- a/packages/builder/cypress/support/commands.js +++ b/packages/builder/cypress/support/commands.js @@ -5,6 +5,7 @@ Cypress.on("uncaught:exception", () => { // ACCOUNTS & USERS Cypress.Commands.add("login", (email, password) => { cy.visit(`${Cypress.config().baseUrl}/builder`, { timeout: 10000 }) + cy.wait(2000) cy.url().then(url => { if (url.includes("builder/admin")) { // create admin user From e2b6ebc16861185f7ffe3c823717e8177bc7d0bf Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 22 Jul 2022 17:12:47 +0000 Subject: [PATCH 20/21] v1.1.18-alpha.5 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 4 ++-- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 11 files changed, 29 insertions(+), 29 deletions(-) diff --git a/lerna.json b/lerna.json index 22cf4a1e83..0f8f5cf16f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index ad02630ccb..616c89e417 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "^1.1.18-alpha.4", + "@budibase/types": "^1.1.18-alpha.5", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 9a22fa3cea..feca151043 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "^1.2.1", - "@budibase/string-templates": "^1.1.18-alpha.4", + "@budibase/string-templates": "^1.1.18-alpha.5", "@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/avatar": "^3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index d1a8e29ff3..a3fb670911 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "license": "GPL-3.0", "private": true, "scripts": { @@ -69,10 +69,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.4", - "@budibase/client": "^1.1.18-alpha.4", - "@budibase/frontend-core": "^1.1.18-alpha.4", - "@budibase/string-templates": "^1.1.18-alpha.4", + "@budibase/bbui": "^1.1.18-alpha.5", + "@budibase/client": "^1.1.18-alpha.5", + "@budibase/frontend-core": "^1.1.18-alpha.5", + "@budibase/string-templates": "^1.1.18-alpha.5", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index bf28b34f0f..21cdbff7db 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,7 +26,7 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.4", + "@budibase/backend-core": "^1.1.18-alpha.5", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index e1efa3995b..4f14748a9c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.4", - "@budibase/frontend-core": "^1.1.18-alpha.4", - "@budibase/string-templates": "^1.1.18-alpha.4", + "@budibase/bbui": "^1.1.18-alpha.5", + "@budibase/frontend-core": "^1.1.18-alpha.5", + "@budibase/string-templates": "^1.1.18-alpha.5", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 6b77b38894..6a9ca9dbdb 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.1.18-alpha.4", + "@budibase/bbui": "^1.1.18-alpha.5", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index db6ea93c6f..9d3ebf8194 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^1.1.18-alpha.4", - "@budibase/client": "^1.1.18-alpha.4", + "@budibase/backend-core": "^1.1.18-alpha.5", + "@budibase/client": "^1.1.18-alpha.5", "@budibase/pro": "1.1.18-alpha.4", - "@budibase/string-templates": "^1.1.18-alpha.4", - "@budibase/types": "^1.1.18-alpha.4", + "@budibase/string-templates": "^1.1.18-alpha.5", + "@budibase/types": "^1.1.18-alpha.5", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 1fa97718ef..d55a3e17a7 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 3233361991..725f3edd49 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index b16c661f40..6e8d005df8 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.1.18-alpha.4", + "version": "1.1.18-alpha.5", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -35,10 +35,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.1.18-alpha.4", + "@budibase/backend-core": "^1.1.18-alpha.5", "@budibase/pro": "1.1.18-alpha.4", - "@budibase/string-templates": "^1.1.18-alpha.4", - "@budibase/types": "^1.1.18-alpha.4", + "@budibase/string-templates": "^1.1.18-alpha.5", + "@budibase/types": "^1.1.18-alpha.5", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 3286d842b673b9c8815ec0ed2c8120cfad809c2e Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 22 Jul 2022 17:14:37 +0000 Subject: [PATCH 21/21] Update pro version to 1.1.18-alpha.5 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 9d3ebf8194..8860026d4d 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^1.1.18-alpha.5", "@budibase/client": "^1.1.18-alpha.5", - "@budibase/pro": "1.1.18-alpha.4", + "@budibase/pro": "1.1.18-alpha.5", "@budibase/string-templates": "^1.1.18-alpha.5", "@budibase/types": "^1.1.18-alpha.5", "@bull-board/api": "3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 6e8d005df8..57db310c11 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -36,7 +36,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.1.18-alpha.5", - "@budibase/pro": "1.1.18-alpha.4", + "@budibase/pro": "1.1.18-alpha.5", "@budibase/string-templates": "^1.1.18-alpha.5", "@budibase/types": "^1.1.18-alpha.5", "@koa/router": "8.0.8",