fix(ui): destructive actions confirm via AlertDialog, naming the item (#1749)
Delete policy, remove member, revoke token, remove passkey and delete source now open the shared AlertDialog confirmation that names the item, matching the binding/mapping/event-type deletes that already confirmed.
This commit is contained in:
5 files changed
+74
-5
No files matched your search
@@ -3,6 +3,7 @@ import { Check, Copy, KeyRound, Lock, LockOpen, Plus, Trash2 } from "@lucide/vue
|
||||
import { onMounted, ref } from "vue";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Section } from "@/components/ui/section";
|
||||
@@ -53,6 +54,7 @@ const {
|
||||
remove,
|
||||
refusals,
|
||||
} = useSources();
|
||||
const pending = ref<Source | null>(null);
|
||||
|
||||
const customPath = ref("");
|
||||
const copied = ref<string | null>(null);
|
||||
@@ -214,7 +216,7 @@ function url(source: Source): string {
|
||||
size="icon-sm"
|
||||
aria-label="Delete source"
|
||||
:disabled="busy"
|
||||
@click="remove(source)"
|
||||
@click="pending = source"
|
||||
>
|
||||
<Trash2 />
|
||||
</Button>
|
||||
@@ -232,4 +234,16 @@ function url(source: Source): string {
|
||||
<EmptyHeader><EmptyTitle>No sources yet</EmptyTitle></EmptyHeader>
|
||||
</Empty>
|
||||
</section>
|
||||
<AlertDialog :open="pending !== null" @update:open="(v: boolean) => { if (!v) pending = null; }">
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete source?</AlertDialogTitle>
|
||||
<AlertDialogDescription>Delete the source "{{ pending?.path }}"? Its webhook endpoint stops accepting deliveries.</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
<AlertDialogAction @click="if (pending) { const src = pending; pending = null; remove(src); }">Delete source</AlertDialogAction>
|
||||
</AlertDialogFooter>
|
||||
</AlertDialogContent>
|
||||
</AlertDialog>
|
||||
</template>
|
||||
Reference in new issue
Block a user