From f35daee07f43120554991be35456a31a804df2c1 Mon Sep 17 00:00:00 2001 From: Dean Date: Wed, 8 Nov 2023 16:59:00 +0000 Subject: [PATCH 1/6] Added toggle-all functionality to the formblock and update context to the ComponentSettingsSection --- .../controls/EditComponentPopover.svelte | 2 + .../FieldConfiguration/CellEditor.svelte | 26 --- .../FieldConfiguration/ColumnDrawer.svelte | 202 ------------------ .../FieldConfiguration.svelte | 58 ++++- .../FieldConfiguration/FieldSetting.svelte | 10 +- .../Component/ComponentSettingsSection.svelte | 19 ++ 6 files changed, 84 insertions(+), 233 deletions(-) delete mode 100644 packages/builder/src/components/design/settings/controls/FieldConfiguration/CellEditor.svelte delete mode 100644 packages/builder/src/components/design/settings/controls/FieldConfiguration/ColumnDrawer.svelte diff --git a/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte b/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte index 26c1ced502..d0f6f24362 100644 --- a/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte +++ b/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte @@ -11,6 +11,7 @@ export let componentBindings export let bindings export let parseSettings + export let disabled const draggable = getContext("draggable") const dispatch = createEventDispatcher() @@ -90,6 +91,7 @@ open = true } }} + {disabled} /> - import { DrawerContent, Drawer, Button, Icon } from "@budibase/bbui" - import ValidationDrawer from "components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte" - export let column - export let type - - let drawer - - - - - - "{column.name}" field validation - - - -
- -
-
-
diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/ColumnDrawer.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/ColumnDrawer.svelte deleted file mode 100644 index 316bf56da3..0000000000 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/ColumnDrawer.svelte +++ /dev/null @@ -1,202 +0,0 @@ - - - -
- - {#if columns?.length} - -
-
- - -
-
-
-
- {#each columns as column (column.id)} -
-
(dragDisabled = false)} - > - -
- - - removeColumn(column.id)} - disabled={columns.length === 1} - /> -
- {/each} -
- - {:else} -
-
- Add columns to be included in your form below. -
-
- {/if} -
-
- - - {#if columns?.length} - - {/if} -
-
- -
- - - diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte index 6c74705ab0..2211f4a41b 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte @@ -1,4 +1,5 @@
+
+ + { + let update = fieldList.map(field => ({ + ...field, + active: selectAll, + })) + toggleAll(update) + }} + text="" + bind:value={selectAll} + thin + disabled={updating} + /> +
{#if fieldList?.length} listUpdated(e.detail)} on:itemChange={processItemUpdate} items={fieldList} listItemKey={"_id"} @@ -162,7 +193,9 @@ listTypeProps={{ componentBindings, bindings, + updating, }} + draggable={!updating} /> {/if}
@@ -171,4 +204,21 @@ .field-configuration :global(.spectrum-ActionButton) { width: 100%; } + .toggle-all { + display: flex; + justify-content: space-between; + } + .toggle-all :global(.spectrum-Switch) { + margin-right: 0px; + padding-right: calc(var(--spacing-s) - 1px); + min-height: unset; + } + .toggle-all :global(.spectrum-Switch .spectrum-Switch-switch) { + margin-top: 0px; + } + .toggle-all span { + color: var(--spectrum-global-color-gray-700); + font-size: 12px; + margin-left: calc(var(--spacing-s) - 1px); + } diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte index 1d9ce733b8..75e6599a6c 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte @@ -11,6 +11,7 @@ export let componentBindings export let bindings export let anchor + export let updating //or disabled const dispatch = createEventDispatcher() const onToggle = item => { @@ -49,6 +50,7 @@ {bindings} {parseSettings} on:change + disabled={updating} >
@@ -58,7 +60,13 @@
{readableText}
- +
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte index 65f010e4ec..3483f6d26f 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte @@ -8,6 +8,8 @@ import { getComponentForSetting } from "components/design/settings/componentSettings" import InfoDisplay from "./InfoDisplay.svelte" import analytics, { Events } from "analytics" + import { setContext } from "svelte" + import { writable } from "svelte/store" export let componentDefinition export let componentInstance @@ -19,6 +21,21 @@ export let includeHidden = false export let tag + let status = writable({ + status: null, + lastUpdate: null, + }) + + const updateStatus = resp => { + status.update(state => ({ + ...state, + resp, + lastUpdate: new Date().getTime(), + })) + } + + setContext("settings", status) + $: sections = getSections( componentInstance, componentDefinition, @@ -76,6 +93,7 @@ } else { await store.actions.components.updateSetting(setting.key, value) } + updateStatus("success") // Send event if required if (setting.sendEvents) { analytics.captureEvent(Events.COMPONENT_UPDATED, { @@ -85,6 +103,7 @@ }) } } catch (error) { + updateStatus("failed") notifications.error("Error updating component prop") } } From 4fd9d2262ec0433580e81b55b838ea12646e1179 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 10 Nov 2023 09:48:19 +0000 Subject: [PATCH 2/6] PR Feedback --- .../FieldConfiguration.svelte | 13 +------------ .../Component/ComponentSettingsSection.svelte | 19 ------------------- 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte index 2211f4a41b..965c1c2881 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldConfiguration.svelte @@ -9,7 +9,7 @@ } from "builderStore/dataBinding" import { currentAsset } from "builderStore" import DraggableList from "../DraggableList/DraggableList.svelte" - import { createEventDispatcher, getContext } from "svelte" + import { createEventDispatcher } from "svelte" import { store, selectedScreen } from "builderStore" import FieldSetting from "./FieldSetting.svelte" import { convertOldFieldFormat, getComponentForField } from "./utils" @@ -17,8 +17,6 @@ export let componentInstance export let value - const updates = getContext("settings") - const dispatch = createEventDispatcher() let sanitisedFields let fieldList @@ -29,7 +27,6 @@ let unconfigured let selectAll = true - let updating = false $: bindings = getBindableProperties($selectedScreen, componentInstance._id) $: actionType = componentInstance.actionType @@ -49,10 +46,6 @@ cachedValue = cloneDeep(value) } - $: if (typeof $updates.resp == "string") { - updating = false - } - const updateState = value => { schema = getSchema($currentAsset, datasource) options = Object.keys(schema || {}) @@ -161,7 +154,6 @@ } const toggleAll = update => { - updating = true listUpdated(update) } @@ -180,7 +172,6 @@ text="" bind:value={selectAll} thin - disabled={updating} />
{#if fieldList?.length} @@ -193,9 +184,7 @@ listTypeProps={{ componentBindings, bindings, - updating, }} - draggable={!updating} /> {/if}
diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte index 3483f6d26f..65f010e4ec 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Component/ComponentSettingsSection.svelte @@ -8,8 +8,6 @@ import { getComponentForSetting } from "components/design/settings/componentSettings" import InfoDisplay from "./InfoDisplay.svelte" import analytics, { Events } from "analytics" - import { setContext } from "svelte" - import { writable } from "svelte/store" export let componentDefinition export let componentInstance @@ -21,21 +19,6 @@ export let includeHidden = false export let tag - let status = writable({ - status: null, - lastUpdate: null, - }) - - const updateStatus = resp => { - status.update(state => ({ - ...state, - resp, - lastUpdate: new Date().getTime(), - })) - } - - setContext("settings", status) - $: sections = getSections( componentInstance, componentDefinition, @@ -93,7 +76,6 @@ } else { await store.actions.components.updateSetting(setting.key, value) } - updateStatus("success") // Send event if required if (setting.sendEvents) { analytics.captureEvent(Events.COMPONENT_UPDATED, { @@ -103,7 +85,6 @@ }) } } catch (error) { - updateStatus("failed") notifications.error("Error updating component prop") } } From a427d990a11eea5910526b378e4cd70b8a5e5aba Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 10 Nov 2023 11:58:07 +0000 Subject: [PATCH 3/6] Quick addition - if the object has been deleted but the key is still known, then CouchDB will alert us to the fact that it is deleted, leaving the response in a weird state. --- packages/backend-core/src/db/couch/DatabaseImpl.ts | 14 +++++++++++--- packages/backend-core/src/redis/redis.ts | 1 - 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/packages/backend-core/src/db/couch/DatabaseImpl.ts b/packages/backend-core/src/db/couch/DatabaseImpl.ts index 6a1e575ac9..8588a7157a 100644 --- a/packages/backend-core/src/db/couch/DatabaseImpl.ts +++ b/packages/backend-core/src/db/couch/DatabaseImpl.ts @@ -10,6 +10,7 @@ import { DatabaseDeleteIndexOpts, Document, isDocument, + RowResponse, } from "@budibase/types" import { getCouchInfo } from "./connections" import { directCouchUrlCall } from "./utils" @@ -127,12 +128,19 @@ export class DatabaseImpl implements Database { keys: ids, include_docs: true, }) - const NOT_FOUND = "not_found" - const rows = response.rows.filter(row => row.error !== NOT_FOUND) + const rowUnavailable = (row: RowResponse) => { + // row is deleted - key lookup can return this + if (row.doc == null || ("deleted" in row.value && row.value.deleted)) { + return true + } + return row.error === "not_found" + } + + const rows = response.rows.filter(row => !rowUnavailable(row)) const someMissing = rows.length !== response.rows.length // some were filtered out - means some missing if (!opts?.allowMissing && someMissing) { - const missing = response.rows.filter(row => row.error === NOT_FOUND) + const missing = response.rows.filter(row => rowUnavailable(row)) const missingIds = missing.map(row => row.key).join(", ") throw new Error(`Unable to get documents: ${missingIds}`) } diff --git a/packages/backend-core/src/redis/redis.ts b/packages/backend-core/src/redis/redis.ts index 6f1b573718..701e262091 100644 --- a/packages/backend-core/src/redis/redis.ts +++ b/packages/backend-core/src/redis/redis.ts @@ -28,7 +28,6 @@ const DEFAULT_SELECT_DB = SelectableDatabase.DEFAULT // for testing just generate the client once let CLOSED = false let CLIENTS: { [key: number]: any } = {} -0 let CONNECTED = false // mock redis always connected From f808b3e1117ee78f8d4a4cac5ee871d0b69985e3 Mon Sep 17 00:00:00 2001 From: Dean Date: Fri, 10 Nov 2023 12:02:11 +0000 Subject: [PATCH 4/6] PR Feedback --- .../settings/controls/EditComponentPopover.svelte | 1 - .../FieldConfiguration/FieldConfiguration.svelte | 6 +----- .../controls/FieldConfiguration/FieldSetting.svelte | 10 +--------- 3 files changed, 2 insertions(+), 15 deletions(-) diff --git a/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte b/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte index d0f6f24362..0ba502bbcb 100644 --- a/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte +++ b/packages/builder/src/components/design/settings/controls/EditComponentPopover.svelte @@ -91,7 +91,6 @@ open = true } }} - {disabled} /> { - listUpdated(update) - }
@@ -167,7 +163,7 @@ ...field, active: selectAll, })) - toggleAll(update) + listUpdated(update) }} text="" bind:value={selectAll} diff --git a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte index 75e6599a6c..1d9ce733b8 100644 --- a/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte +++ b/packages/builder/src/components/design/settings/controls/FieldConfiguration/FieldSetting.svelte @@ -11,7 +11,6 @@ export let componentBindings export let bindings export let anchor - export let updating //or disabled const dispatch = createEventDispatcher() const onToggle = item => { @@ -50,7 +49,6 @@ {bindings} {parseSettings} on:change - disabled={updating} >
@@ -60,13 +58,7 @@
{readableText}
- +
From 90aaa1d9c19762fc0993957b7631e6c532f1af79 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 10 Nov 2023 12:13:45 +0000 Subject: [PATCH 5/6] Bump version to 2.13.8 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index c0559d8346..e06cae80fd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.7", + "version": "2.13.8", "npmClient": "yarn", "packages": [ "packages/*" From e1f8b575689a730a9d38146b1b19e09107cea846 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 10 Nov 2023 12:54:49 +0000 Subject: [PATCH 6/6] Bump version to 2.13.9 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index e06cae80fd..aafb6b22ce 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.13.8", + "version": "2.13.9", "npmClient": "yarn", "packages": [ "packages/*"