Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data section resource deletion warning #15499

Merged
merged 38 commits into from
Feb 7, 2025
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
6b566d8
TS conversions of components required to create generic deletion comp…
mike12345567 Jan 29, 2025
795df85
More TS fixes.
mike12345567 Jan 29, 2025
b8e5512
Remove table word, pass this in instead
mike12345567 Jan 29, 2025
1b8a229
Functions to get source type and usage endpoint for screens.
mike12345567 Jan 30, 2025
47fdd0f
Still requires tests, but main body of endpoint to check screen usage.
mike12345567 Jan 30, 2025
1d32474
Merge branch 'master' of github.com:Budibase/budibase into feature/pr…
mike12345567 Jan 31, 2025
d6fb87d
Creating structures for testing usage endpoint.
mike12345567 Jan 31, 2025
5a737ff
Completing test cases for usage endpoint.
mike12345567 Jan 31, 2025
be301df
Merge branch 'master' of github.com:Budibase/budibase into feature/pr…
mike12345567 Feb 3, 2025
b214019
Frontend usage of API.
mike12345567 Feb 3, 2025
a1409f4
implementing usage API in the modal.
mike12345567 Feb 3, 2025
be33f59
Getting tables and views to be deleted through the new generic modal.
mike12345567 Feb 3, 2025
c311d64
Updating queries to use the same mechanism.
mike12345567 Feb 3, 2025
6c0e33a
Merge branch 'master' of github.com:Budibase/budibase into feature/pr…
mike12345567 Feb 4, 2025
cbc13ad
Updating datasource to delete through it.
mike12345567 Feb 4, 2025
5c97771
Adding internal knowledge check to usage.
mike12345567 Feb 4, 2025
3bb0cde
Changing messaging for deletion.
mike12345567 Feb 4, 2025
4809973
Small fixes.
mike12345567 Feb 4, 2025
78c1633
Remove input.
mike12345567 Feb 5, 2025
877f30b
No input required for deletion.
mike12345567 Feb 5, 2025
555cc15
Updates to design, removing alert.
mike12345567 Feb 5, 2025
880f27e
Changing how messaging is generated.
mike12345567 Feb 5, 2025
d04ce5c
Merge branch 'master' of github.com:Budibase/budibase into feature/pr…
mike12345567 Feb 6, 2025
fdf82a6
Some updates, deleting external tables does delete data so warn about…
mike12345567 Feb 6, 2025
399cf0e
Removing unused elements.
mike12345567 Feb 6, 2025
e1f43c4
Merge branch 'master' into feature/pre-empt-data-source-deletion
mike12345567 Feb 6, 2025
e8c79bc
Most PR comments.
mike12345567 Feb 6, 2025
c060d46
Merge branch 'feature/pre-empt-data-source-deletion' of github.com:Bu…
mike12345567 Feb 6, 2025
83fdbcc
export directly.
mike12345567 Feb 6, 2025
a5f2a05
Linting.
mike12345567 Feb 6, 2025
5be6141
Merge branch 'master' into feature/pre-empt-data-source-deletion
mike12345567 Feb 6, 2025
f9c75a2
Final comments.
mike12345567 Feb 6, 2025
c098099
cleanup.
mike12345567 Feb 6, 2025
0750b74
Merge branch 'feature/pre-empt-data-source-deletion' of github.com:Bu…
mike12345567 Feb 6, 2025
ec3cd23
Merge branch 'master' of github.com:Budibase/budibase into feature/pr…
mike12345567 Feb 7, 2025
85b2db1
Majority of comments.
mike12345567 Feb 7, 2025
126befd
Updating UIEvent to an interface.
mike12345567 Feb 7, 2025
6435c9b
Linting.
mike12345567 Feb 7, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion packages/backend-core/src/docIds/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,15 @@ export function isViewId(id: string): boolean {
/**
* Check if a given ID is that of a datasource or datasource plus.
*/
export const isDatasourceId = (id: string): boolean => {
export function isDatasourceId(id: string): boolean {
// this covers both datasources and datasource plus
return !!id && id.startsWith(`${DocumentType.DATASOURCE}${SEPARATOR}`)
}

export function isQueryId(id: string): boolean {
return !!id && id.startsWith(`${DocumentType.QUERY}${SEPARATOR}`)
}

/**
* Gets parameters for retrieving workspaces.
*/
Expand Down
23 changes: 12 additions & 11 deletions packages/bbui/src/Form/Core/TextField.svelte
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<script lang="ts">
import "@spectrum-css/textfield/dist/index-vars.css"
import { createEventDispatcher, onMount, tick } from "svelte"
import type { UIEvent } from "@budibase/types"

export let value = null
export let value: string | null = null
export let placeholder: string | undefined = undefined
export let type = "text"
export let disabled = false
Expand All @@ -11,7 +12,7 @@
export let updateOnChange = true
export let quiet = false
export let align: "left" | "right" | "center" | undefined = undefined
export let autofocus = false
export let autofocus: boolean | null = false
export let autocomplete: boolean | undefined

const dispatch = createEventDispatcher()
Expand All @@ -24,7 +25,7 @@
return
}
if (type === "number") {
const float = parseFloat(newValue)
const float = parseFloat(newValue as string)
newValue = isNaN(float) ? null : float
}
dispatch("change", newValue)
Expand All @@ -37,31 +38,31 @@
focus = true
}

const onBlur = (event: any) => {
const onBlur = (event: UIEvent) => {
if (readonly || disabled) {
return
}
focus = false
updateValue(event.target.value)
updateValue(event?.target?.value)
}

const onInput = (event: any) => {
const onInput = (event: UIEvent) => {
if (readonly || !updateOnChange || disabled) {
return
}
updateValue(event.target.value)
updateValue(event.target?.value)
}

const updateValueOnEnter = (event: any) => {
const updateValueOnEnter = (event: UIEvent) => {
if (readonly || disabled) {
return
}
if (event.key === "Enter") {
updateValue(event.target.value)
updateValue(event.target?.value)
}
}

const getInputMode = (type: any) => {
const getInputMode = (type: string) => {
if (type === "bigint") {
return "numeric"
}
Expand All @@ -77,7 +78,7 @@

onMount(async () => {
if (disabled) return
focus = autofocus
focus = autofocus || false
if (focus) {
await tick()
field.focus()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import IntegrationIcon from "@/components/backend/DatasourceNavigator/IntegrationIcon.svelte"
import { Icon } from "@budibase/bbui"
import UpdateDatasourceModal from "@/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte"
import DeleteConfirmationModal from "./DeleteConfirmationModal.svelte"
import DeleteDataConfirmModal from "@/components/backend/modals/DeleteDataConfirmationModal.svelte"

export let datasource

Expand Down Expand Up @@ -71,7 +71,10 @@
{/if}
</NavItem>
<UpdateDatasourceModal {datasource} bind:this={editModal} />
<DeleteConfirmationModal {datasource} bind:this={deleteConfirmationModal} />
<DeleteDataConfirmModal
source={datasource}
bind:this={deleteConfirmationModal}
/>

<style>
.datasource-icon {
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,18 @@
} from "@/helpers/data/utils"
import { goto as gotoStore, isActive } from "@roxi/routify"
import {
datasources,
queries,
userSelectedResourceMap,
contextMenuStore,
} from "@/stores/builder"
import NavItem from "@/components/common/NavItem.svelte"
import ConfirmDialog from "@/components/common/ConfirmDialog.svelte"
import DeleteDataConfirmModal from "@/components/backend/modals/DeleteDataConfirmationModal.svelte"
import { notifications, Icon } from "@budibase/bbui"

export let datasource
export let query

let confirmDeleteDialog
let confirmDeleteModal

// goto won't work in the context menu callback if the store is called directly
$: goto = $gotoStore
Expand All @@ -31,7 +30,7 @@
keyBind: null,
visible: true,
disabled: false,
callback: confirmDeleteDialog.show,
callback: confirmDeleteModal.show,
},
{
icon: "Duplicate",
Expand All @@ -51,20 +50,6 @@
]
}

async function deleteQuery() {
try {
// Go back to the datasource if we are deleting the active query
if ($queries.selectedQueryId === query._id) {
goto(`./datasource/${query.datasourceId}`)
}
await queries.delete(query)
await datasources.fetch()
notifications.success("Query deleted")
} catch (error) {
notifications.error("Error deleting query")
}
}

const openContextMenu = e => {
e.preventDefault()
e.stopPropagation()
Expand All @@ -90,14 +75,7 @@
<Icon size="S" hoverable name="MoreSmallList" on:click={openContextMenu} />
</NavItem>

<ConfirmDialog
bind:this={confirmDeleteDialog}
okText="Delete Query"
onOk={deleteQuery}
title="Confirm Deletion"
>
Are you sure you wish to delete this query? This action cannot be undone.
</ConfirmDialog>
<DeleteDataConfirmModal source={query} bind:this={confirmDeleteModal} />

<style>
</style>

This file was deleted.

Loading
Loading