fix(ui): the token revoke dialog runs the revoke it was opened for
deploy / plan (push) Successful in 8s
deploy / archied-image (push) Canceled after 0s
deploy / agent-image (push) Canceled after 0s
deploy / dist-zip (push) Canceled after 0s
deploy / gate (push) Canceled after 3m33s

This commit is contained in:
sam committed 2026-11-10 22:37:59 +11:00
1 parent 721e6332ed
commit 28a6ac8b98
1 file changed
+9 -3
+9 -3
View File
@@ -65,12 +65,18 @@ const create = () =>
const copy = () => navigator.clipboard.writeText(created.value);
// The token is kept until the next Revoke: Reka closes the dialog before the
// action's click runs, so clearing it on close would drop the revoke.
const pending = ref<PersonalToken | null>(null);
const dialogOpen = ref(false);
const revoke = (id: string) =>
run(async () => {
await api.revokeToken(id);
await load();
});
const confirmRevoke = () => {
if (pending.value) revoke(pending.value.id);
};
onMounted(load);
</script>
@@ -106,11 +112,11 @@ onMounted(load);
<span class="text-caption text-fg-subtle">Created <Timestamp :at="token.created_at" /></span>
<span class="text-caption text-fg-subtle">Expires <Timestamp v-if="token.expires_at" :at="token.expires_at" /><template v-else>Never</template></span>
<span class="text-caption text-fg-subtle">Last used <Timestamp v-if="token.last_used_at" :at="token.last_used_at" /><template v-else>Never</template></span>
<Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = token">Revoke</Button>
<Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = token; dialogOpen = true">Revoke</Button>
</Item>
</ItemGroup>
</Section>
<AlertDialog :open="pending !== null" @update:open="(v: boolean) => { if (!v) pending = null; }">
<AlertDialog :open="dialogOpen" @update:open="(v: boolean) => { dialogOpen = v; }">
<AlertDialogContent>
<AlertDialogHeader>
<AlertDialogTitle>Revoke token?</AlertDialogTitle>
@@ -118,7 +124,7 @@ onMounted(load);
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel>Cancel</AlertDialogCancel>
<AlertDialogAction @click="if (pending) { const t = pending; pending = null; revoke(t.id); }">Revoke token</AlertDialogAction>
<AlertDialogAction @click="confirmRevoke">Revoke token</AlertDialogAction>
</AlertDialogFooter>
</AlertDialogContent>
</AlertDialog>