Files
archie/ui/src/workflows/TriggerSettings.vue
T
sam 94f79177a2
deploy / gate (push) Successful in 4m53s
Quality / check (push) Successful in 6m42s
deploy / archied-image (push) Successful in 3m20s
deploy / agent-image (push) Successful in 11s
deploy / dist-zip (push) Skipped
fix(ui): adopt the type scale across components/ui and pages (#1758)
components/ui and the pages now use only the style.css scale:
text-[0.8rem]→text-label, text-[0.625rem]→text-micro, text-base/text-sm→
text-label (rows and controls), text-xs→text-caption (captions and
secondary text), text-lg/text-xl/text-2xl→text-title (panel and page
titles). Rendered markdown (ChatMarkdown/ChatInline/markdown.ts) keeps
Tailwind steps as the issue allows. 196 files, class-token swaps only.
2026-11-06 23:07:46 +11:00

65 lines
3.8 KiB
Vue

<script setup lang="ts">
import { ref } from "vue";
import { CalendarClock, Plus } from "@lucide/vue";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
import { statusKind, statusLabel, type Binding } from "@/bindings/binding-draft";
import BindEvent from "./BindEvent.vue";
import ScheduleTrigger from "./ScheduleTrigger.vue";
import SpecList from "./SpecList.vue";
import type { WorkflowTrigger } from "./workflow-triggers";
defineProps<{ yaml: string; triggers: WorkflowTrigger[]; error?: string }>();
const emit = defineEmits<{ "update:yaml": [string]; bound: []; reload: [] }>();
// The bind flow takes over the card; a null binding is a new one.
const binding = ref<Binding | null | undefined>();
const scheduled = ref<Binding | null | undefined>();
function bound(): void {
binding.value = undefined;
scheduled.value = undefined;
emit("bound");
}
function open(trigger: WorkflowTrigger): void {
if (trigger.kind === "schedule") scheduled.value = trigger.binding;
else binding.value = trigger.binding;
}
</script>
<template>
<BindEvent v-if="binding !== undefined" :yaml="yaml" :binding="binding" @back="binding = undefined" @saved="bound" />
<ScheduleTrigger v-else-if="scheduled !== undefined" :yaml="yaml" :binding="scheduled" @back="scheduled = undefined" @saved="bound" />
<div v-else class="space-y-4 px-3 py-3">
<section class="space-y-1.5">
<div class="flex justify-end">
<Button type="button" variant="ghost" size="xs" @click="scheduled = null"><CalendarClock data-icon="inline-start" />Add a schedule</Button>
<Button type="button" variant="ghost" size="xs" @click="binding = null"><Plus data-icon="inline-start" />Bind an event</Button>
</div>
<ul v-if="triggers.length" class="divide-y divide-border rounded-md border border-border">
<li v-for="trigger in triggers" :key="trigger.kind + trigger.label" class="text-label">
<Button v-if="trigger.binding" type="button" variant="ghost" class="h-auto w-full justify-start gap-2 rounded-none px-3 py-2 text-label font-normal" @click="open(trigger)">
<span class="truncate">{{ trigger.label }}</span>
<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-caption text-fg-subtle">{{ trigger.detail }}</span>
</Button>
<RouterLink v-else-if="trigger.kind === 'workflow' || trigger.kind === 'playbook'" :to="trigger.kind === 'workflow' ? { path: '/workflows', query: { workflow: trigger.label } } : { path: '/org/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-caption 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-caption text-fg-subtle">{{ trigger.detail }}</span>
</div>
</li>
</ul>
<div v-if="error" class="flex items-center gap-2 text-caption text-danger" role="alert">
{{ error }}
<Button variant="link" size="xs" class="px-0" @click="emit('reload')">Retry</Button>
</div>
<p v-else-if="!triggers.length" class="text-caption text-fg-subtle">Manual runs only.</p>
</section>
<SpecList :yaml="yaml" field="inputs" @update:yaml="emit('update:yaml', $event)" />
</div>
</template>