feat(identity): add browser setup and user accounts
This commit is contained in:
1 parent
cf3455ef2e
commit
aa012a7c6e
91 files changed
+6823
-636
No files matched your search
@@ -4,6 +4,7 @@ import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select"
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import { ArrowLeft, Braces, Type } from "@lucide/vue";
|
||||
|
||||
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 { Spinner } from "@/components/ui/spinner";
|
||||
@@ -56,6 +57,7 @@ const rows = ref<Record<string, InputRow>>({});
|
||||
const repositoryPath = ref("");
|
||||
const preview = ref<Preview | null>(null);
|
||||
const saving = ref(false);
|
||||
const confirmRemove=ref(false);
|
||||
const creatingSource = ref(false);
|
||||
const revealed = ref<Source | null>(null);
|
||||
const error = ref("");
|
||||
@@ -221,6 +223,13 @@ async function transition(command: (id: string) => Promise<unknown>, next: strin
|
||||
error.value = err instanceof Error ? err.message : String(err);
|
||||
}
|
||||
}
|
||||
async function removeBinding():Promise<void>{
|
||||
if(!props.binding)return;
|
||||
saving.value=true;error.value="";
|
||||
try{await api.bindingDelete(props.binding.id);emit("saved")}
|
||||
catch(cause){error.value=cause instanceof Error?cause.message:String(cause)}
|
||||
finally{saving.value=false}
|
||||
}
|
||||
const approve = () => transition(api.bindingApprove, "armed");
|
||||
const pause = () => transition(api.bindingPause, "paused");
|
||||
const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
@@ -228,6 +237,9 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
|
||||
<template>
|
||||
<div class="flex h-full flex-col">
|
||||
<AlertDialog v-model:open="confirmRemove">
|
||||
<AlertDialogContent><AlertDialogHeader><AlertDialogTitle>Remove event binding?</AlertDialogTitle><AlertDialogDescription>This event will stop starting this workflow. The event source and mapping are kept.</AlertDialogDescription></AlertDialogHeader><AlertDialogFooter><AlertDialogCancel>Cancel</AlertDialogCancel><AlertDialogAction @click="removeBinding">Remove binding</AlertDialogAction></AlertDialogFooter></AlertDialogContent>
|
||||
</AlertDialog>
|
||||
<header class="flex items-center gap-2 border-b border-border px-4 py-3">
|
||||
<Button type="button" variant="ghost" size="icon-sm" aria-label="Back to settings" @click="emit('back')"><ArrowLeft /></Button>
|
||||
<div class="min-w-0 flex-1 truncate text-sm font-medium">{{ binding ? binding.name : "Bind an event" }}</div>
|
||||
@@ -321,11 +333,12 @@ const resume = () => transition(api.bindingResume, "pending_approval");
|
||||
<div class="space-y-2">
|
||||
<p v-if="error" role="alert" class="text-xs text-danger">{{ error }}</p>
|
||||
<p v-else-if="blockers.length" class="text-xs text-fg-subtle">Cannot save: {{ blockers[0] }}</p>
|
||||
<div class="flex gap-2">
|
||||
<div class="flex flex-wrap gap-2">
|
||||
<Button type="submit" size="sm" :disabled="saving || !!blockers.length"><Spinner v-if="saving" />Save binding</Button>
|
||||
<Button v-if="binding && status === 'pending_approval'" type="button" size="sm" variant="outline" @click="approve">Approve</Button>
|
||||
<Button v-if="binding && status === 'armed'" type="button" size="sm" variant="outline" @click="pause">Pause</Button>
|
||||
<Button v-if="binding && status === 'paused'" type="button" size="sm" variant="outline" @click="resume">Resume</Button>
|
||||
<Button v-if="binding" type="button" size="sm" variant="destructive" :disabled="saving" @click="confirmRemove=true">Remove binding</Button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -120,7 +120,7 @@ function place(store?: VueFlowStore): void {
|
||||
const reached = graph.value.nodes.find((node) => props.marks?.[node.id]) ?? graph.value.nodes.filter((node) => node.data.run).at(-1);
|
||||
const below = reached && 24 + (reached.position.y + 180) * ZOOM > height;
|
||||
const y = below ? height / 3 - reached.position.y * ZOOM : 24;
|
||||
void flow.setViewport({ x: width / 2 - NODE_WIDTH / 2, y, zoom: ZOOM }, { duration: animate ? 300 : 0 });
|
||||
void flow.setViewport({ x: width / 2 - NODE_WIDTH * ZOOM / 2, y, zoom: ZOOM }, { duration: animate ? 300 : 0 });
|
||||
}
|
||||
|
||||
watch(() => graph.value.nodes.filter((node) => node.data.run).length, () => place());
|
||||
|
||||
@@ -242,8 +242,8 @@ function syncScroll(event: Event): void {
|
||||
<template>
|
||||
<form class="space-y-4" @submit.prevent="saveDraft">
|
||||
<Tabs v-model="view" class="space-y-1.5">
|
||||
<div class="flex items-center gap-2">
|
||||
<TabsList>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<TabsList class="max-w-full justify-start overflow-x-auto">
|
||||
<TabsTrigger value="canvas">Canvas</TabsTrigger>
|
||||
<TabsTrigger value="yaml">YAML</TabsTrigger>
|
||||
<TabsTrigger v-if="stored !== undefined" value="history">History</TabsTrigger>
|
||||
@@ -318,7 +318,7 @@ function syncScroll(event: Event): void {
|
||||
enter-active-class="transition duration-200"
|
||||
leave-active-class="transition duration-150"
|
||||
>
|
||||
<div v-if="settingsOpen" class="absolute inset-y-0 right-0 overflow-hidden rounded-r-lg">
|
||||
<div v-if="settingsOpen" class="absolute inset-y-0 right-0 max-w-full overflow-hidden rounded-r-lg">
|
||||
<WorkflowSettings v-model:yaml="yaml" :triggers="triggers" @close="settingsOpen = false" @bound="reloadTriggers" />
|
||||
</div>
|
||||
</Transition>
|
||||
@@ -328,7 +328,7 @@ function syncScroll(event: Event): void {
|
||||
enter-active-class="transition duration-200"
|
||||
leave-active-class="transition duration-150"
|
||||
>
|
||||
<div v-if="selectedStep" class="absolute inset-y-0 right-0 flex flex-col overflow-hidden rounded-r-lg border-l border-border bg-card shadow-xl">
|
||||
<div v-if="selectedStep" class="absolute inset-y-0 right-0 flex max-w-full flex-col overflow-hidden rounded-r-lg border-l border-border bg-card shadow-xl">
|
||||
<template v-if="selectedNode?.run && watchedRun">
|
||||
<div class="flex items-center gap-2 border-b border-border px-3 py-2">
|
||||
<Tabs v-model="stepTab"><TabsList><TabsTrigger value="run">Run</TabsTrigger><TabsTrigger value="definition">Definition</TabsTrigger></TabsList></Tabs>
|
||||
|
||||
@@ -84,7 +84,7 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="flex h-full w-[24rem] flex-col border-l border-border bg-card shadow-xl">
|
||||
<aside class="flex h-full w-[24rem] max-w-full flex-col border-l border-border bg-card shadow-xl">
|
||||
<BindEvent v-if="binding !== undefined" :yaml="yaml" :binding="binding" @back="binding = undefined" @saved="bound" />
|
||||
<template v-else>
|
||||
<header class="flex items-center gap-2 border-b border-border px-4 py-3">
|
||||
@@ -206,8 +206,12 @@ function setNeeds(next: { captures?: boolean; gate_retries?: number }): void {
|
||||
<Badge v-if="trigger.binding.status !== 'armed'" :variant="statusKind(trigger.binding.status)">{{ statusLabel(trigger.binding.status) }}</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</button>
|
||||
<div v-else class="flex items-center gap-2 px-3 py-2">
|
||||
<RouterLink v-else-if="trigger.kind==='workflow' || trigger.kind==='playbook'" :to="trigger.kind==='workflow'?{path:'/workflows',query:{workflow:trigger.label}}:{path:'/settings/playbooks'}" class="flex items-center gap-2 px-3 py-2 hover:bg-secondary">
|
||||
<span class="truncate">{{trigger.label}}</span><span class="ml-auto truncate text-xs text-fg-subtle">{{trigger.detail}}</span>
|
||||
</RouterLink>
|
||||
<div v-else class="flex items-center gap-2 px-3 py-2" title="Built-in issue routing. Disable this workflow to stop it running automatically.">
|
||||
<span class="truncate">{{ trigger.label }}</span>
|
||||
<Badge v-if="trigger.kind==='issue'" variant="outline" class="ml-auto">Built-in</Badge>
|
||||
<span v-if="trigger.detail" class="ml-auto truncate text-xs text-fg-subtle">{{ trigger.detail }}</span>
|
||||
</div>
|
||||
</li>
|
||||
|
||||
@@ -193,8 +193,8 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
<p v-if="error" class="mb-4 text-sm text-danger" role="alert">Cannot reach archied: {{ error }}</p>
|
||||
|
||||
<div class="grid items-start gap-6 lg:grid-cols-[24rem_minmax(0,1fr)]">
|
||||
<ul class="flex flex-col gap-0.5" aria-label="Workflows">
|
||||
<li v-for="row in rows" :key="row.id">
|
||||
<ul class="flex gap-1 overflow-x-auto pb-2 lg:flex-col lg:gap-0.5 lg:overflow-visible lg:pb-0" aria-label="Workflows">
|
||||
<li v-for="row in rows" :key="row.id" class="min-w-36 shrink-0 lg:min-w-0">
|
||||
<button
|
||||
type="button"
|
||||
:aria-current="row.id === selected ? 'true' : undefined"
|
||||
@@ -227,7 +227,7 @@ const rate = (deliveredRuns = 0, total = 0) => (total ? deliveredRuns / total :
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</section>
|
||||
<section v-else class="min-w-0 rounded-lg border border-border bg-card px-5 py-4" aria-label="Workflow">
|
||||
<section v-else class="min-w-0 rounded-lg border border-border bg-card px-3 py-4 sm:px-5" aria-label="Workflow">
|
||||
<header class="mb-2 flex flex-wrap items-center gap-2">
|
||||
<h2 class="font-mono text-[15px] font-medium">{{ selected }}</h2>
|
||||
<Badge v-if="provenance" variant="outline">{{ provenance }}</Badge>
|
||||
|
||||
Reference in new issue
Block a user