No input required for deletion.

This commit is contained in:
mike12345567 2025-02-05 16:29:21 +00:00
parent 78c16334b5
commit 877f30b7a0
2 changed files with 36 additions and 48 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts"> <script lang="ts">
import { InlineAlert, Link, Input, notifications } from "@budibase/bbui" import { InlineAlert, Link, notifications } from "@budibase/bbui"
import { import {
appStore, appStore,
datasources, datasources,
@ -22,7 +22,6 @@
let affectedScreens: { text: string; url: string }[] = [] let affectedScreens: { text: string; url: string }[] = []
let sourceType: SourceType | undefined = undefined let sourceType: SourceType | undefined = undefined
let isInternal: boolean = false let isInternal: boolean = false
let deleteSourceName: string | undefined
$: isInternalTable = isInternal && sourceType === SourceType.TABLE $: isInternalTable = isInternal && sourceType === SourceType.TABLE
@ -87,11 +86,7 @@
} }
function hideDeleteDialog() { function hideDeleteDialog() {
deleteSourceName = "" sourceType = undefined
}
const autofillSourceName = () => {
deleteSourceName = source?.name
} }
async function deleteTable(table: Table & { datasourceId?: string }) { async function deleteTable(table: Table & { datasourceId?: string }) {
@ -192,39 +187,40 @@
} }
</script> </script>
<ConfirmDialog {#if sourceType}
bind:this={confirmDeleteDialog} <ConfirmDialog
okText="Delete" bind:this={confirmDeleteDialog}
onOk={deleteSource} okText="Delete"
onCancel={hideDeleteDialog} onOk={deleteSource}
title={`Are you sure you want to delete ${source?.name}?`} onCancel={hideDeleteDialog}
disabled={deleteSourceName !== source?.name} title={`Are you sure you want to delete ${source?.name}?`}
> >
<div class="content"> <div class="content">
<p class="warning"> <p class="warning">
<!-- eslint-disable-next-line svelte/no-at-html-tags --> <!-- eslint-disable-next-line svelte/no-at-html-tags -->
{@html buildMessage()} {@html buildMessage()}
</p> </p>
{#if affectedScreens.length > 0} {#if affectedScreens.length > 0}
<div class="affectedScreens"> <div class="affectedScreens">
<InlineAlert <InlineAlert
header={`The following screens use this ${sourceType} and may no longer function as expected`} header={`The following screens use this ${sourceType} and may no longer function as expected`}
> >
<ul class="affectedScreensList"> <ul class="affectedScreensList">
{#each affectedScreens as item} {#each affectedScreens as item}
<li> <li>
<Link quiet overBackground target="_blank" href={item.url} <Link quiet overBackground target="_blank" href={item.url}
>{item.text}</Link >{item.text}</Link
> >
</li> </li>
{/each} {/each}
</ul> </ul>
</InlineAlert> </InlineAlert>
</div> </div>
{/if} {/if}
</div> </div>
</ConfirmDialog> </ConfirmDialog>
{/if}
<style> <style>
.content { .content {
@ -232,14 +228,6 @@
max-width: 320px; max-width: 320px;
} }
.sourceName {
flex-grow: 1;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
cursor: pointer;
}
.warning { .warning {
margin: 0; margin: 0;
max-width: 100%; max-width: 100%;

View File

@ -8,7 +8,7 @@
export let onOk = undefined export let onOk = undefined
export let onCancel = undefined export let onCancel = undefined
export let warning = true export let warning = true
export let disabled export let disabled = false
let modal let modal