mirror of
https://github.com/appwrite/console.git
synced 2026-11-18 20:47:21 +00:00
add: friction to database deletion.
This commit is contained in:
1 parent
7cf70682a4
commit
60dd9f4a32
2 files changed
+48
-11
No files matched your search
@@ -4,13 +4,16 @@
|
||||
import { page } from '$app/stores';
|
||||
import { Submit, trackError, trackEvent } from '$lib/actions/analytics';
|
||||
import { Modal } from '$lib/components';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Button, InputCheckbox } from '$lib/elements/forms';
|
||||
import { addNotification } from '$lib/stores/notifications';
|
||||
import { sdk } from '$lib/stores/sdk';
|
||||
import { database } from './store';
|
||||
import { FormList } from '$lib/elements/forms/index.js';
|
||||
|
||||
const databaseId = $page.params.database;
|
||||
|
||||
export let showDelete = false;
|
||||
let confirmedDeletion = false;
|
||||
|
||||
const handleDelete = async () => {
|
||||
try {
|
||||
@@ -36,14 +39,31 @@
|
||||
title="Delete database"
|
||||
icon="exclamation"
|
||||
state="warning"
|
||||
size="small"
|
||||
bind:show={showDelete}
|
||||
onSubmit={handleDelete}
|
||||
headerDivider={false}>
|
||||
<p class="text" data-private>
|
||||
Are you sure you want to delete <b>{$database.name}</b>?
|
||||
</p>
|
||||
<FormList>
|
||||
<p class="text" data-private>
|
||||
Are you sure you want to delete <b>{$database.name}</b>?
|
||||
</p>
|
||||
|
||||
<p class="text" data-private>
|
||||
<b>Once deleted, this database cannot be restored. This action is irreversible.</b>
|
||||
</p>
|
||||
|
||||
<div class="input-check-box-friction">
|
||||
<InputCheckbox
|
||||
required
|
||||
size="small"
|
||||
id="delete_policy"
|
||||
bind:checked={confirmedDeletion}
|
||||
label="I understand and confirm" />
|
||||
</div>
|
||||
</FormList>
|
||||
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (showDelete = false)}>Cancel</Button>
|
||||
<Button secondary submit>Delete</Button>
|
||||
<Button secondary submit disabled={!confirmedDeletion}>Delete</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
@@ -7,7 +7,7 @@
|
||||
import { Id, Modal } from '$lib/components';
|
||||
import FloatingActionBar from '$lib/components/floatingActionBar.svelte';
|
||||
import { Dependencies } from '$lib/constants';
|
||||
import { Button } from '$lib/elements/forms';
|
||||
import { Button, FormList, InputCheckbox } from '$lib/elements/forms';
|
||||
import {
|
||||
TableBody,
|
||||
TableCell,
|
||||
@@ -33,6 +33,7 @@
|
||||
let selected: string[] = [];
|
||||
let showDelete = false;
|
||||
let deleting = false;
|
||||
let confirmedDeletion = false;
|
||||
|
||||
async function handleDelete() {
|
||||
showDelete = false;
|
||||
@@ -160,17 +161,33 @@
|
||||
title="Delete Database"
|
||||
icon="exclamation"
|
||||
state="warning"
|
||||
size="small"
|
||||
bind:show={showDelete}
|
||||
onSubmit={handleDelete}
|
||||
headerDivider={false}
|
||||
closable={!deleting}>
|
||||
<p class="text" data-private>
|
||||
Are you sure you want to delete <b>{selected.length}</b>
|
||||
{selected.length > 1 ? 'databases' : 'database'}?
|
||||
</p>
|
||||
<FormList>
|
||||
<p class="text" data-private>
|
||||
Are you sure you want to delete <b>{selected.length}</b>
|
||||
{selected.length > 1 ? 'databases' : 'database'}?
|
||||
</p>
|
||||
|
||||
<p class="text" data-private>
|
||||
<b>Once deleted, these databases cannot be restored. This action is irreversible.</b>
|
||||
</p>
|
||||
|
||||
<div class="input-check-box-friction">
|
||||
<InputCheckbox
|
||||
required
|
||||
size="small"
|
||||
id="delete_policy"
|
||||
bind:checked={confirmedDeletion}
|
||||
label="I understand and confirm" />
|
||||
</div>
|
||||
</FormList>
|
||||
<svelte:fragment slot="footer">
|
||||
<Button text on:click={() => (showDelete = false)} disabled={deleting}>Cancel</Button>
|
||||
<Button secondary submit disabled={deleting}>Delete</Button>
|
||||
<Button secondary submit disabled={deleting || !confirmedDeletion}>Delete</Button>
|
||||
</svelte:fragment>
|
||||
</Modal>
|
||||
|
||||
|
||||
Reference in new issue
Block a user