From 0b2c6e531c4d8922ce63a6e641baa168ac7fddf9 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sun, 30 Jul 2023 13:07:01 +0100 Subject: [PATCH 1/9] Export Block and BlockComponent via SDK --- packages/client/src/sdk.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/packages/client/src/sdk.js b/packages/client/src/sdk.js index c9ff1eba36..237334ca57 100644 --- a/packages/client/src/sdk.js +++ b/packages/client/src/sdk.js @@ -18,6 +18,8 @@ import { styleable } from "utils/styleable" import { linkable } from "utils/linkable" import { getAction } from "utils/getAction" import Provider from "components/context/Provider.svelte" +import Block from "components/Block.svelte" +import BlockComponent from "components/BlockComponent.svelte" import { ActionTypes } from "./constants" import { fetchDatasourceSchema } from "./utils/schema.js" import { getAPIKey } from "./utils/api.js" @@ -44,4 +46,6 @@ export default { Provider, ActionTypes, getAPIKey, + Block, + BlockComponent, } From bbe6741ffde4979f8825d69e34a81ce7d281834f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sun, 30 Jul 2023 13:07:14 +0100 Subject: [PATCH 2/9] Support plugins in block components --- .../src/components/BlockComponent.svelte | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/packages/client/src/components/BlockComponent.svelte b/packages/client/src/components/BlockComponent.svelte index 24d9b4dee4..c9516b0d71 100644 --- a/packages/client/src/components/BlockComponent.svelte +++ b/packages/client/src/components/BlockComponent.svelte @@ -26,9 +26,9 @@ $: parentId = $component?.id $: inBuilder = $builderStore.inBuilder $: instance = { - _component: `@budibase/standard-components/${type}`, + _component: getComponent(type), _id: id, - _instanceName: name || type[0].toUpperCase() + type.slice(1), + _instanceName: getInstanceName(name, type), _styles: { ...styles, normal: styles?.normal || {}, @@ -45,6 +45,30 @@ } } + const getComponent = type => { + if (!type) { + return null + } + if (type.startsWith("plugin/")) { + return type + } else { + return `@budibase/standard-components/${type}` + } + } + + const getInstanceName = (name, type) => { + if (name) { + return name + } + if (!type) { + return "New component" + } + if (type.startsWith("plugin/")) { + type = type.split("plugin/")[1] + } + return type[0].toUpperCase() + type.slice(1) + } + onDestroy(() => { if (inBuilder) { block.unregisterComponent(id, parentId) From 527426ddbb8df2eabf0a2f4d5eb2cd39a03516cc Mon Sep 17 00:00:00 2001 From: andz-bb Date: Tue, 1 Aug 2023 16:29:04 +0100 Subject: [PATCH 3/9] fix for saving external data connector query param values --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 2 +- .../components/automation/SetupPanel/QueryParamSelector.svelte | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index cece075860..0ba909d56b 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -108,7 +108,7 @@ /****************************************************/ const getInputData = (testData, blockInputs) => { - let newInputData = testData || blockInputs + let newInputData = cloneDeep(testData || blockInputs) if (block.event === "app:trigger" && !newInputData?.fields) { newInputData = cloneDeep(blockInputs) } diff --git a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte index 9c47178b0e..52310001ff 100644 --- a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte @@ -4,7 +4,6 @@ import { Select } from "@budibase/bbui" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" - const dispatch = createEventDispatcher() export let value @@ -50,6 +49,7 @@ type="string" {bindings} fillWidth={true} + updateOnChange={false} /> {/each} From 5f084699d2b43b33ac8f6e9c6d033cfbaaf4553f Mon Sep 17 00:00:00 2001 From: Andrew Thompson <110921612+andz-bb@users.noreply.github.com> Date: Tue, 1 Aug 2023 17:09:52 +0100 Subject: [PATCH 4/9] didn't mean to remove a line --- .../components/automation/SetupPanel/QueryParamSelector.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte index 52310001ff..250d235266 100644 --- a/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte +++ b/packages/builder/src/components/automation/SetupPanel/QueryParamSelector.svelte @@ -4,6 +4,7 @@ import { Select } from "@budibase/bbui" import DrawerBindableInput from "../../common/bindings/DrawerBindableInput.svelte" import AutomationBindingPanel from "../../common/bindings/ServerBindingPanel.svelte" + const dispatch = createEventDispatcher() export let value From c372bb9a1882a3df79485484b9ca21f388937989 Mon Sep 17 00:00:00 2001 From: andz-bb Date: Wed, 2 Aug 2023 09:35:42 +0100 Subject: [PATCH 5/9] remove redundant cloneDeep --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 3 --- 1 file changed, 3 deletions(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 0ba909d56b..0ab933d925 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -109,9 +109,6 @@ const getInputData = (testData, blockInputs) => { let newInputData = cloneDeep(testData || blockInputs) - if (block.event === "app:trigger" && !newInputData?.fields) { - newInputData = cloneDeep(blockInputs) - } /** * TODO - Remove after November 2023 From ffb22f9f93fd3a0c5eadae61a6af9c1507fb4dd0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 2 Aug 2023 14:05:26 +0000 Subject: [PATCH 6/9] Bump version to 2.8.29-alpha.15 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 399c4e8b42..b49e796a92 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.14", + "version": "2.8.29-alpha.15", "npmClient": "yarn", "packages": [ "packages/*" From b370b89a0700b52d5f62ec81c7bf0cbcdab6e2b8 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 2 Aug 2023 15:52:20 +0000 Subject: [PATCH 7/9] Bump version to 2.8.29-alpha.16 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index b49e796a92..a8a8ad485c 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.15", + "version": "2.8.29-alpha.16", "npmClient": "yarn", "packages": [ "packages/*" From 4c26abc83d105db89e087abafd6286ad84d63d3f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 4 Aug 2023 08:41:04 +0100 Subject: [PATCH 8/9] Fix reactivity bug with normal user app list --- .../src/pages/builder/apps/index.svelte | 29 +++++++++---------- 1 file changed, 14 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index 6b74694c00..ca3617b589 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -28,25 +28,13 @@ let userInfoModal let changePasswordModal - onMount(async () => { - try { - await organisation.init() - await apps.load() - await groups.actions.init() - } catch (error) { - notifications.error("Error loading apps") - } - loaded = true - }) - const publishedAppsOnly = app => app.status === AppStatus.DEPLOYED - $: userGroups = $groups.filter(group => group.users.find(user => user._id === $auth.user?._id) ) - $: publishedApps = $apps.filter(publishedAppsOnly) - $: userApps = getUserApps($auth.user) + $: publishedApps = $apps.filter(app => app.status === AppStatus.DEPLOYED) + $: userApps = getUserApps(publishedApps, userGroups, $auth.user) - function getUserApps(user) { + function getUserApps(publishedApps, userGroups, user) { if (sdk.users.isAdmin(user)) { return publishedApps } @@ -84,6 +72,17 @@ // Swallow error and do nothing } } + + onMount(async () => { + try { + await organisation.init() + await apps.load() + await groups.actions.init() + } catch (error) { + notifications.error("Error loading apps") + } + loaded = true + }) {#if $auth.user && loaded} From 13ae01bcf44350feeda60734d9a93281ee752ad7 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 4 Aug 2023 08:26:03 +0000 Subject: [PATCH 9/9] Bump version to 2.8.29-alpha.17 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index a8a8ad485c..f33b6d0a7d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.8.29-alpha.16", + "version": "2.8.29-alpha.17", "npmClient": "yarn", "packages": [ "packages/*"