diff --git a/lerna.json b/lerna.json index b6952a4d2a..215bdfdec5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.185-alpha.12", + "version": "0.9.185-alpha.14", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index ca4f5e322c..7ac1a6c21f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.185-alpha.12", + "version": "0.9.185-alpha.14", "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 4383afc0c3..d818ea7987 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.185-alpha.12", + "version": "0.9.185-alpha.14", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/bbui/src/Form/Core/TextField.svelte b/packages/bbui/src/Form/Core/TextField.svelte index 37989a291e..85c71338f7 100644 --- a/packages/bbui/src/Form/Core/TextField.svelte +++ b/packages/bbui/src/Form/Core/TextField.svelte @@ -11,6 +11,7 @@ export let readonly = false export let updateOnChange = true export let quiet = false + export let dataCy const dispatch = createEventDispatcher() let focus = false @@ -78,6 +79,7 @@ {disabled} {readonly} {id} + data-cy={dataCy} value={value || ""} placeholder={placeholder || ""} on:click diff --git a/packages/bbui/src/Form/Input.svelte b/packages/bbui/src/Form/Input.svelte index d1dbaff50b..1660b67799 100644 --- a/packages/bbui/src/Form/Input.svelte +++ b/packages/bbui/src/Form/Input.svelte @@ -13,6 +13,7 @@ export let error = null export let updateOnChange = true export let quiet = false + export let dataCy const dispatch = createEventDispatcher() const onChange = e => { @@ -23,6 +24,7 @@ { cy.get(".spectrum-Table-editIcon > use").click() cy.contains("Delete").click() cy.wait(50) + cy.get(`[data-cy="delete-column-confirm"]`).type("nameupdated") cy.contains("Delete Column").click() cy.contains("nameupdated").should("not.exist") }) @@ -66,6 +67,7 @@ context("Create a Table", () => { cy.get(".actions .spectrum-Icon").click({ force: true }) }) cy.get(".spectrum-Menu > :nth-child(2)").click() + cy.get(`[data-cy="delete-table-confirm"]`).type("dog") cy.contains("Delete Table").click() cy.contains("dog").should("not.exist") }) diff --git a/packages/builder/package.json b/packages/builder/package.json index 0a5426f223..84c2d66e53 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.185-alpha.12", + "version": "0.9.185-alpha.14", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.185-alpha.12", - "@budibase/client": "^0.9.185-alpha.12", + "@budibase/bbui": "^0.9.185-alpha.14", + "@budibase/client": "^0.9.185-alpha.14", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.185-alpha.12", + "@budibase/string-templates": "^0.9.185-alpha.14", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte index 83ed741b75..841e781cf2 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateEditColumn.svelte @@ -62,6 +62,7 @@ let indexes = [...($tables.selected.indexes || [])] let confirmDeleteDialog let deletion + let deleteColName $: checkConstraints(field) $: required = !!field?.constraints?.presence || primaryDisplay @@ -179,6 +180,7 @@ function hideDeleteDialog() { confirmDeleteDialog.hide() + deleteColName = "" deletion = false } @@ -408,9 +410,20 @@ + disabled={deleteColName !== field.name} +> +

+ Are you sure you wish to delete the column {field.name}? + Your data will be deleted and this action cannot be undone - enter the column + name to confirm. +

+ +
diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte index 04094b881a..6d8c5811ec 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditTablePopover.svelte @@ -21,8 +21,10 @@ let originalName = table.name let templateScreens let willBeDeleted + let deleteTableName $: external = table?.type === "external" + $: allowDeletion = !external || table?.created function showDeleteModal() { templateScreens = $allScreens.filter( @@ -36,18 +38,26 @@ async function deleteTable() { const wasSelectedTable = $tables.selected - await tables.delete(table) - store.actions.screens.delete(templateScreens) - await tables.fetch() - notifications.success("Table deleted") - if (table.type === "external") { - await datasources.fetch() - } - if (wasSelectedTable && wasSelectedTable._id === table._id) { - $goto("./table") + try { + await tables.delete(table) + await store.actions.screens.delete(templateScreens) + await tables.fetch() + if (table.type === "external") { + await datasources.fetch() + } + notifications.success("Table deleted") + if (wasSelectedTable && wasSelectedTable._id === table._id) { + $goto("./table") + } + } catch (err) { + notifications.error(err) } } + function hideDeleteDialog() { + deleteTableName = "" + } + async function save() { await tables.save(table) notifications.success("Table renamed successfully") @@ -67,7 +77,9 @@ Edit - Delete + {#if allowDeletion} + Delete + {/if} @@ -90,11 +102,15 @@ bind:this={confirmDeleteDialog} okText="Delete Table" onOk={deleteTable} + onCancel={hideDeleteDialog} title="Confirm Deletion" + disabled={deleteTableName !== table.name} > - Are you sure you wish to delete the table - {table.name}? - The following will also be deleted: +

+ Are you sure you wish to delete the table + {table.name}? + The following will also be deleted: +

{#each willBeDeleted as item} @@ -102,7 +118,15 @@ {/each}
- This action cannot be undone. +

+ This action cannot be undone - to continue please enter the table name below + to confirm. +

+