From 9e74acfec0543442937c000f62ef716b8e54b0cb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Fri, 1 Oct 2021 15:01:16 +0100 Subject: [PATCH 01/20] Prevent screen slot or something containing the screen slot from being deleted --- .../src/builderStore/store/frontend.js | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 09132f28cb..e92f47cae9 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -8,6 +8,7 @@ import { selectedComponent, selectedAccessRole, } from "builderStore" +import { notifications } from "@budibase/bbui" import { datasources, integrations, @@ -25,6 +26,7 @@ import { findComponentParent, findClosestMatchingComponent, findAllMatchingComponents, + findComponent, } from "../storeUtils" import { uuid } from "../uuid" import { removeBindings } from "../dataBinding" @@ -464,6 +466,28 @@ export const getFrontendStore = () => { if (!asset) { return } + + // Fetch full definition + component = findComponent(asset.props, component._id) + + // Ensure we aren't deleting the screen slot + if (component._component?.endsWith("/screenslot")) { + notifications.error("You can't delete the screen slot") + return + } + + // Ensure we aren't deleting something that contains the screen slot + const screenslot = findComponentType( + component, + "@budibase/standard-components/screenslot" + ) + if (screenslot != null) { + notifications.error( + "You can't delete a component that contains the screen slot" + ) + return + } + const parent = findComponentParent(asset.props, component._id) if (parent) { parent._children = parent._children.filter( From a41505f8a0c019a2321f417ba5b878028bd693eb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 4 Oct 2021 14:45:51 +0100 Subject: [PATCH 02/20] Rename primary color to accent color --- .../src/components/design/AppPreview/ThemeEditor.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte b/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte index ac70fb9b29..7b36de4fa8 100644 --- a/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte +++ b/packages/builder/src/components/design/AppPreview/ThemeEditor.svelte @@ -84,7 +84,7 @@
- +
- + Date: Mon, 4 Oct 2021 14:50:02 +0100 Subject: [PATCH 03/20] Update svelte-flatpickr and disable flatpickr attempting to use native datepickers on mobile, to fix mobile support --- packages/bbui/package.json | 2 +- packages/bbui/src/Form/Core/DatePicker.svelte | 1 + packages/bbui/yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 5d1c98dd0c..53220fe02a 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -78,7 +78,7 @@ "@spectrum-css/underlay": "^2.0.9", "@spectrum-css/vars": "^3.0.1", "dayjs": "^1.10.4", - "svelte-flatpickr": "^3.1.0", + "svelte-flatpickr": "^3.2.3", "svelte-portal": "^1.0.0" }, "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc" diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index 2516cb659d..176db9f497 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -26,6 +26,7 @@ altFormat: enableTime ? "F j Y, H:i" : "F j, Y", wrap: true, appendTo, + disableMobile: "true", } const handleChange = event => { diff --git a/packages/bbui/yarn.lock b/packages/bbui/yarn.lock index a3b20aa862..a492c83266 100644 --- a/packages/bbui/yarn.lock +++ b/packages/bbui/yarn.lock @@ -2415,10 +2415,10 @@ supports-color@^7.0.0, supports-color@^7.1.0: dependencies: has-flag "^4.0.0" -svelte-flatpickr@^3.1.0: - version "3.1.0" - resolved "https://registry.yarnpkg.com/svelte-flatpickr/-/svelte-flatpickr-3.1.0.tgz#ad83588430dbd55196a1a258b8ba27e7f9c1ee37" - integrity sha512-zKyV+ukeVuJ8CW0Ing3T19VSekc4bPkou/5Riutt1yATrLvSsanNqcgqi7Q5IePvIoOF9GJ5OtHvn1qK9Wx9BQ== +svelte-flatpickr@^3.2.3: + version "3.2.3" + resolved "https://registry.yarnpkg.com/svelte-flatpickr/-/svelte-flatpickr-3.2.3.tgz#db5dd7ad832ef83262b45e09737955ad3d591fc8" + integrity sha512-PNkqK4Napx8nTvCwkaUXdnKo8dISThaxEOK+szTUXcY6H0dQM0TSyuoMaVWY2yX7pM+PN5cpCQCcVe8YvTRFSw== dependencies: flatpickr "^4.5.2" From 32d79e38e02155d2de03e65514a8c88c73c5c98b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 4 Oct 2021 15:49:06 +0100 Subject: [PATCH 04/20] Update self-host upgrade text --- .../src/components/upgrade/UpgradeModal.svelte | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/builder/src/components/upgrade/UpgradeModal.svelte b/packages/builder/src/components/upgrade/UpgradeModal.svelte index 570dcc06a1..9ceef1ddf8 100644 --- a/packages/builder/src/components/upgrade/UpgradeModal.svelte +++ b/packages/builder/src/components/upgrade/UpgradeModal.svelte @@ -21,12 +21,12 @@ - Upgrade to Budibase self-hosting for free, and get SSO, unlimited apps, - and more - and it only takes a few minutes! + + Self-host Budibase for free, and get SSO, unlimited apps, and more - and + it only takes a few minutes! + From b0b0268b7da7ae58820a6a75432967ebbbb80876 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 4 Oct 2021 16:50:52 +0100 Subject: [PATCH 05/20] Give up on attempting to get jest to work with BBUI, change strategy for showing notifications when deleting invalid components --- .../builder/src/builderStore/store/frontend.js | 10 ++-------- .../design/AppPreview/CurrentItemPreview.svelte | 17 ++++++++++++++--- .../ComponentDropdownMenu.svelte | 8 ++++++-- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index e92f47cae9..c567454eff 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -8,7 +8,6 @@ import { selectedComponent, selectedAccessRole, } from "builderStore" -import { notifications } from "@budibase/bbui" import { datasources, integrations, @@ -16,7 +15,6 @@ import { database, tables, } from "stores/backend" - import { fetchComponentLibDefinitions } from "../loadComponentLibraries" import api from "../api" import { FrontendTypes } from "constants" @@ -472,8 +470,7 @@ export const getFrontendStore = () => { // Ensure we aren't deleting the screen slot if (component._component?.endsWith("/screenslot")) { - notifications.error("You can't delete the screen slot") - return + throw "You can't delete the screen slot" } // Ensure we aren't deleting something that contains the screen slot @@ -482,10 +479,7 @@ export const getFrontendStore = () => { "@budibase/standard-components/screenslot" ) if (screenslot != null) { - notifications.error( - "You can't delete a component that contains the screen slot" - ) - return + throw "You can't delete a component that contains the screen slot" } const parent = findComponentParent(asset.props, component._id) diff --git a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte index 4e51850fe1..d2d67bf99f 100644 --- a/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte +++ b/packages/builder/src/components/design/AppPreview/CurrentItemPreview.svelte @@ -6,7 +6,13 @@ import { Screen } from "builderStore/store/screenTemplates/utils/Screen" import { FrontendTypes } from "constants" import ConfirmDialog from "components/common/ConfirmDialog.svelte" - import { ProgressCircle, Layout, Heading, Body } from "@budibase/bbui" + import { + ProgressCircle, + Layout, + Heading, + Body, + notifications, + } from "@budibase/bbui" import ErrorSVG from "assets/error.svg?raw" import { findComponent, findComponentPath } from "builderStore/storeUtils" @@ -166,10 +172,15 @@ confirmDeleteDialog.show() } - const deleteComponent = () => { - store.actions.components.delete({ _id: idToDelete }) + const deleteComponent = async () => { + try { + await store.actions.components.delete({ _id: idToDelete }) + } catch (error) { + notifications.error(error) + } idToDelete = null } + const cancelDeleteComponent = () => { idToDelete = null } diff --git a/packages/builder/src/components/design/NavigationPanel/ComponentDropdownMenu.svelte b/packages/builder/src/components/design/NavigationPanel/ComponentDropdownMenu.svelte index 24050e1088..c3f51ee5df 100644 --- a/packages/builder/src/components/design/NavigationPanel/ComponentDropdownMenu.svelte +++ b/packages/builder/src/components/design/NavigationPanel/ComponentDropdownMenu.svelte @@ -3,7 +3,7 @@ import { store, currentAsset } from "builderStore" import ConfirmDialog from "components/common/ConfirmDialog.svelte" import { findComponentParent } from "builderStore/storeUtils" - import { ActionMenu, MenuItem, Icon } from "@budibase/bbui" + import { ActionMenu, MenuItem, Icon, notifications } from "@budibase/bbui" export let component @@ -51,7 +51,11 @@ } const deleteComponent = async () => { - await store.actions.components.delete(component) + try { + await store.actions.components.delete(component) + } catch (error) { + notifications.error(error) + } } const storeComponentForCopy = (cut = false) => { From 1f95c693ac421d5beda4935a519dcea780d6d39b Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 4 Oct 2021 17:59:25 +0100 Subject: [PATCH 06/20] As with the account portal, updating the monorepo to use the users name if it is available for some email templates. --- packages/worker/src/constants/templates/passwordRecovery.hbs | 2 +- packages/worker/src/constants/templates/welcome.hbs | 2 +- packages/worker/src/utilities/email.js | 5 +++++ 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/packages/worker/src/constants/templates/passwordRecovery.hbs b/packages/worker/src/constants/templates/passwordRecovery.hbs index 6ebe606467..128398cdb7 100644 --- a/packages/worker/src/constants/templates/passwordRecovery.hbs +++ b/packages/worker/src/constants/templates/passwordRecovery.hbs @@ -6,7 +6,7 @@
-

Hi {{ email }},

+

Hi {{#if name}}{{ name }}{{else}}{{ email }}{{/if}},

You recently requested to reset your password for your {{ company }} account in your Budibase platform. Use the button below to reset it. This password reset is only valid for the next 24 hours.

diff --git a/packages/worker/src/constants/templates/welcome.hbs b/packages/worker/src/constants/templates/welcome.hbs index b509ad5e31..18ea572bb0 100644 --- a/packages/worker/src/constants/templates/welcome.hbs +++ b/packages/worker/src/constants/templates/welcome.hbs @@ -6,7 +6,7 @@