fix(ui): destructive actions confirm via AlertDialog, naming the item (#1749)
Quality / check (push) Canceled after 7m10s
deploy / gate (push) Successful in 4m49s
deploy / archied-image (push) Successful in 3m29s
deploy / agent-image (push) Successful in 12s
deploy / dist-zip (push) Skipped

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:
sam committed 2026-11-07 00:11:16 +11:00
1 parent ef623f6c68
commit 12eea5eee3
5 files changed
+74 -5

No files matched your search

+15 -1
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Spinner } from "@/components/ui/spinner";
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
import PageHeader from "@/base/PageHeader.vue";
import { computed, onMounted, ref } from "vue";
@@ -89,6 +90,7 @@ async function save(): Promise<void> {
}
}
const pending = ref<Policy | null>(null);
async function remove(p: Policy): Promise<void> {
try {
await api.deletePolicy(p);
@@ -128,7 +130,7 @@ onMounted(load);
</div>
<div class="flex shrink-0 gap-2">
<Button size="sm" variant="outline" @click="edit(p)">Edit</Button>
<Button size="sm" variant="outline" @click="remove(p)">Delete</Button>
<Button size="sm" variant="outline" @click="pending = p">Delete</Button>
</div>
</div>
</div>
@@ -172,4 +174,16 @@ onMounted(load);
</div>
</Section>
</div>
<AlertDialog :open="pending !== null" @update:open="(v: boolean) => { if (!v) pending = null; }">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Delete policy?</AlertDialogTitle>
<AlertDialogDescription>Delete the policy "{{ pending?.id }}". This cannot be undone.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction @click="if (pending) { const p = pending; pending = null; void remove(p); }">Delete policy</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>
+14
View File
@@ -1,5 +1,6 @@
<script setup lang="ts">
import { Tooltip, TooltipContent, TooltipTrigger } from "@/components/ui/tooltip";
import { AlertDialog, AlertDialogAction, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogFooter, AlertDialogHeader, AlertDialogTitle } from "@/components/ui/alert-dialog";
import { Alert, AlertDescription } from "@/components/ui/alert";
import PageHeader from "@/base/PageHeader.vue";
import CreateAccount from "@/accounts/CreateAccount.vue";
@@ -126,6 +127,7 @@ const setRole = (member: Member, role: unknown) =>
await load();
});
const pending = ref<Member | null>(null);
const remove = (member: Member) =>
run(member.identity_id + (member.workspace_id ?? ""), async () => {
if (!org.value) return;
@@ -247,4 +249,16 @@ const remove = (member: Member) =>
</Section>
</div>
</div>
<AlertDialog :open="pending !== null" @update:open="(v: boolean) => { if (!v) pending = null; }">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Remove member?</AlertDialogTitle>
<AlertDialogDescription>Remove {{ pending?.display_name }} from this organisation? Their access stops immediately.</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction @click="if (pending) { const m = pending; pending = null; remove(m); }">Remove member</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>
</template>