fix(ui): let a pending channel link code be cancelled (#2095)
This commit is contained in:
1 file changed
+10
-1
@@ -76,6 +76,12 @@ const begin = (connector: string) =>
|
||||
poll();
|
||||
});
|
||||
|
||||
/** Hides a code the operator no longer wants to use. */
|
||||
function cancel(connector: string): void {
|
||||
delete pending.value[connector];
|
||||
if (!waiting.value) stop();
|
||||
}
|
||||
|
||||
const unlink = (link: ChannelLink) =>
|
||||
run(async () => {
|
||||
await api.unlinkChannel(link.connector, link.subject);
|
||||
@@ -99,7 +105,10 @@ onMounted(load);
|
||||
<div v-if="pending[connector]" class="flex flex-wrap items-center gap-4">
|
||||
<img :src="pending[connector].qr" :alt="`QR code to link ${label(connector)}`" width="192" height="192" class="rounded-md bg-white" />
|
||||
<div class="space-y-2">
|
||||
<Button as-child><a :href="pending[connector].url" target="_blank" rel="noopener">Open in {{ label(connector) }}</a></Button>
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button as-child><a :href="pending[connector].url" target="_blank" rel="noopener">Open in {{ label(connector) }}</a></Button>
|
||||
<Button variant="ghost" @click="cancel(connector)">Cancel</Button>
|
||||
</div>
|
||||
<p class="text-caption text-fg-muted">Scan the code or open the link, then press Start.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user