From 14b842f521d5a2994bc6aed57edf04d795c5fb9d Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Fri, 17 Sep 2021 11:43:27 +0200 Subject: [PATCH 01/12] re-use sanitizeUrl utils method, add / if it's not added already --- .../design/NavigationPanel/NewScreenModal.svelte | 3 ++- .../PropertiesPanel/ScreenSettingsSection.svelte | 11 ++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte index ed0c764956..78f5d74e62 100644 --- a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte @@ -5,6 +5,7 @@ import { Input, Select, ModalContent, Toggle } from "@budibase/bbui" import getTemplates from "builderStore/store/screenTemplates" import analytics from "analytics" + import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" const CONTAINER = "@budibase/standard-components/container" @@ -84,7 +85,7 @@ if (!event.detail.startsWith("/")) { route = "/" + event.detail } - route = route.replace(/ +/g, "-") + route = sanitizeUrl(route) } diff --git a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte index d782d1cd44..97e1e8a2b5 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte @@ -7,13 +7,17 @@ import RoleSelect from "./PropertyControls/RoleSelect.svelte" import { currentAsset, store } from "builderStore" import { FrontendTypes } from "constants" + import sanitizeUrl from "builderStore/store/screenTemplates/utils/sanitizeUrl" export let componentInstance export let bindings function setAssetProps(name, value, parser) { if (parser && typeof parser === "function") { + console.log("before", value) value = parser(value) + console.log("after", value) + console.log("deepGet", deepGet($currentAsset, name)) } const selectedAsset = get(currentAsset) @@ -37,7 +41,12 @@ key: "routing.route", label: "Route", control: Input, - parser: val => val.replace(/ +/g, "-"), + parser: val => { + if (!val.startsWith("/")) { + val = "/" + val + } + return sanitizeUrl(val) + }, }, { key: "routing.roleId", label: "Access", control: RoleSelect }, { key: "layoutId", label: "Layout", control: LayoutSelect }, From a42747521d937137695d380a3efd19aefa153a87 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Wed, 22 Sep 2021 08:49:33 +0200 Subject: [PATCH 02/12] remove console.log --- .../design/PropertiesPanel/ScreenSettingsSection.svelte | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte index 97e1e8a2b5..efe51ebdac 100644 --- a/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/ScreenSettingsSection.svelte @@ -14,10 +14,7 @@ function setAssetProps(name, value, parser) { if (parser && typeof parser === "function") { - console.log("before", value) value = parser(value) - console.log("after", value) - console.log("deepGet", deepGet($currentAsset, name)) } const selectedAsset = get(currentAsset) From 1fc24e12e78652a6ed96da800c3317cfa47777fb Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 1 Oct 2021 16:05:48 +0100 Subject: [PATCH 03/12] Hide upgrade button / modal from non-root account holders --- .../builder/src/pages/builder/app/[application]/_layout.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/_layout.svelte index ae21a9dbb9..aaf948883d 100644 --- a/packages/builder/src/pages/builder/app/[application]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_layout.svelte @@ -92,7 +92,7 @@
- {#if $admin.cloud} + {#if $admin.cloud && $auth.user.account} {/if} From 61fcb672898b38e5eceb000c74d5c5bc75430b2a Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 1 Oct 2021 16:12:07 +0100 Subject: [PATCH 04/12] Load account portal url from environment --- packages/builder/src/components/upgrade/UpgradeModal.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/upgrade/UpgradeModal.svelte b/packages/builder/src/components/upgrade/UpgradeModal.svelte index 570dcc06a1..f78b7abdea 100644 --- a/packages/builder/src/components/upgrade/UpgradeModal.svelte +++ b/packages/builder/src/components/upgrade/UpgradeModal.svelte @@ -1,10 +1,11 @@ From a8806244dcb6b3c5519f617b00153fe5e5b11929 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 1 Oct 2021 15:41:08 +0000 Subject: [PATCH 05/12] v0.9.149-alpha.4 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 370edc641d..a6ede1d70f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 0a5cfdc4d2..c61d4b54f2 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 53f3896a3c..61e82d8706 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": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 1e255b5454..859d041080 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.149-alpha.3", - "@budibase/client": "^0.9.149-alpha.3", + "@budibase/bbui": "^0.9.149-alpha.4", + "@budibase/client": "^0.9.149-alpha.4", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.149-alpha.3", + "@budibase/string-templates": "^0.9.149-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 c5a9177c72..25eeb3f8a0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 51281424db..348ad6d5e2 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.149-alpha.3", + "version": "0.9.149-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": "^0.9.149-alpha.3", + "@budibase/bbui": "^0.9.149-alpha.4", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.149-alpha.3", + "@budibase/string-templates": "^0.9.149-alpha.4", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index b2244d4d51..2b67d869e4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.149-alpha.3", - "@budibase/client": "^0.9.149-alpha.3", - "@budibase/string-templates": "^0.9.149-alpha.3", + "@budibase/auth": "^0.9.149-alpha.4", + "@budibase/client": "^0.9.149-alpha.4", + "@budibase/string-templates": "^0.9.149-alpha.4", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 7c1b6627dc..6721370381 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index f4cd707c3c..09fc3c2d85 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.149-alpha.3", + "version": "0.9.149-alpha.4", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -27,8 +27,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.149-alpha.3", - "@budibase/string-templates": "^0.9.149-alpha.3", + "@budibase/auth": "^0.9.149-alpha.4", + "@budibase/string-templates": "^0.9.149-alpha.4", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From a343805feecf822327e3a3f90a89e6133c0aabf6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 1 Oct 2021 17:16:43 +0100 Subject: [PATCH 06/12] Fix for many to many relationships where the union table has arbituarily named foreign key constraint columns, an example has been provided in the scripts directory. --- .../CreateEditRelationship.svelte | 18 ++++++++ .../customer-categories/docker-compose.yml | 28 +++++++++++++ .../integrations/customer-categories/init.sql | 41 +++++++++++++++++++ .../integrations/customer-categories/reset.sh | 3 ++ .../api/controllers/row/ExternalRequest.ts | 16 ++++---- packages/server/src/definitions/common.ts | 2 + packages/server/src/definitions/datasource.ts | 2 + packages/server/src/integrations/base/sql.ts | 6 ++- 8 files changed, 107 insertions(+), 9 deletions(-) create mode 100644 packages/server/scripts/integrations/customer-categories/docker-compose.yml create mode 100644 packages/server/scripts/integrations/customer-categories/init.sql create mode 100755 packages/server/scripts/integrations/customer-categories/reset.sh diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte index fbc2b401ef..583ca5e887 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/CreateEditRelationship/CreateEditRelationship.svelte @@ -156,6 +156,8 @@ ...relateTo, through: through._id, fieldName: fromTable.primary[0], + throughFrom: relateFrom.throughTo, + throughTo: relateFrom.throughFrom, } } else { // the relateFrom.fieldName should remain the same, as it is the foreignKey in the other @@ -251,6 +253,22 @@ bind:error={errors.through} bind:value={fromRelationship.through} /> + {#if fromTable && toTable && through} + ($touched.toForeign = true)} + bind:error={errors.toForeign} + bind:value={fromRelationship.throughFrom} + /> + {/if} {:else if fromRelationship?.relationshipType && toTable}