update: lint and improve index deletion messages.

This commit is contained in:
Darshan
2025-07-17 13:13:46 +05:30
parent 7ca72570f4
commit 9ab367ab8a
2 changed files with 25 additions and 19 deletions
@@ -138,7 +138,8 @@
{/if}
</Layout.Stack>
</Spreadsheet.Cell>
<Spreadsheet.Cell column="type" {root} isEditable={false}>{index.type}</Spreadsheet.Cell>
<Spreadsheet.Cell column="type" {root} isEditable={false}
>{index.type}</Spreadsheet.Cell>
<Spreadsheet.Cell column="columns" {root} isEditable={false}>
{index.attributes.join(', ')}
</Spreadsheet.Cell>
@@ -237,7 +238,7 @@
</SideSheet>
{#if selectedIndex}
<Delete bind:showDelete selectedIndex={selectedIndex} />
<Delete bind:showDelete {selectedIndex} />
{:else if selectedIndexes && selectedIndexes.length}
<Delete bind:showDelete bind:selectedIndex={selectedIndexes} />
{/if}
@@ -8,15 +8,14 @@
import { invalidate } from '$app/navigation';
import { Dependencies } from '$lib/constants';
import Confirm from '$lib/components/confirm.svelte';
import { Typography } from '@appwrite.io/pink-svelte';
let {
showDelete = $bindable(false),
selectedIndex = $bindable(null),
selectedIndex = $bindable(null)
}: {
showDelete: boolean;
selectedIndex: Models.Index | string[]
} = $props()
selectedIndex: Models.Index | string[];
} = $props();
let error: string = $state(null);
let selectedKeys = $derived(getKeys(selectedIndex));
@@ -51,17 +50,23 @@
}
</script>
<Confirm onSubmit={handleDelete} title="Delete index" bind:open={showDelete} bind:error>
<Typography.Text>
{#if selectedKeys.length === 1}
Are you sure you want to delete <b>{selectedKeys[0]}</b> from
<b>{$collection.name}</b>?
{:else}
Are you sure you want to delete
<b>
{selectedKeys.join(', ')}
</b>
from <b>{$collection.name}</b>?
{/if}
</Typography.Text>
<Confirm
bind:error
confirmDeletion
title="Delete index"
bind:open={showDelete}
onSubmit={handleDelete}>
{#if selectedKeys.length === 1}
<p>Are you sure you want to delete <b>{selectedKeys[0]}</b>?</p>
<p>
Deleting this index may slow down queries that depend on it. This action is
irreversible.
</p>
{:else}
<p>Are you sure you want to delete <b>{selectedKeys.join(', ')}</b>?</p>
<p>
Deleting these indexes may slow down queries that depend on it. This action is
irreversible.
</p>
{/if}
</Confirm>