Merge pull request #13319 from Budibase/fix/10211

This commit is contained in:
Michael Drury 2024-03-21 08:47:09 +00:00 committed by GitHub
commit 2d3f3456ad
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 16 deletions

View File

@ -28,7 +28,6 @@
let deleteTableName
$: externalTable = table?.sourceType === DB_TYPE_EXTERNAL
$: allowDeletion = !externalTable || table?.created
function showDeleteModal() {
templateScreens = $screenStore.screens.filter(
@ -56,7 +55,7 @@
$goto(`./datasource/${table.datasourceId}`)
}
} catch (error) {
notifications.error("Error deleting table")
notifications.error(`Error deleting table - ${error.message}`)
}
}
@ -86,8 +85,7 @@
}
</script>
{#if allowDeletion}
<ActionMenu>
<ActionMenu>
<div slot="control" class="icon">
<Icon s hoverable name="MoreSmallList" />
</div>
@ -95,8 +93,7 @@
<MenuItem icon="Edit" on:click={editorModal.show}>Edit</MenuItem>
{/if}
<MenuItem icon="Delete" on:click={showDeleteModal}>Delete</MenuItem>
</ActionMenu>
{/if}
</ActionMenu>
<Modal bind:this={editorModal} on:show={initForm}>
<ModalContent

View File

@ -61,9 +61,6 @@ export async function destroy(ctx: UserCtx) {
const tableToDelete: TableRequest = await sdk.tables.getTable(
ctx.params.tableId
)
if (!tableToDelete || !tableToDelete.created) {
ctx.throw(400, "Cannot delete tables which weren't created in Budibase.")
}
const datasourceId = getDatasourceId(tableToDelete)
try {
const { datasource, table } = await sdk.tables.external.destroy(