fix(ui/topbar): replace Jump to with a command palette, drop filler chrome (#1650)
* fix(ui/topbar): replace Jump to with a command palette, drop filler chrome Jump to opens a shadcn-vue Command dialog that finds pages, tasks and workflows by name. The connection indicator shows only when the stream is lost, the dead documentation link is gone, and the profile menu label has no stray whitespace. * fix(ui): trim stray whitespace from template text and drop em dashes from copy Element text that started or ended with a line break rendered with leading and trailing spaces. Also removes the unused 'soon' nav state and the nav group components no route reaches. * fix(ui): drop the space a hidden spinner left before button text * fix(ui/status): one dense Status page, full-width settings, problems-only apply status Status drops its tabs and the duplicate health card; services list only what is wrong. Settings pages use the full width, the resizable sidebar handle is gone, and apply status shows only processes that have not applied a change. PageHeader puts the title and actions on one line. * refactor(ui): use shadcn ToggleGroup and Badge, drop SegmentedControl and StatusPill Status badges show only when a state needs attention: no Running, Enabled, Active, Listening or live pills next to healthy rows. Removes the unused pagination, radio-group and scroll-area components. * fix(ui/history): use the shadcn Table with fixed columns so nothing is clipped * fix(ui/workflows): apply ?workflow= only once the workflow is listed Selecting it before the definitions loaded opened an empty canvas. * refactor(ui/workflows): use shadcn Input, NativeSelect, Checkbox and Button in editors Replaces hand-rolled inputs, selects, the repository mode switch and icon buttons in the workflow editor, bind dialog, harness page, sources panel and review gate. Adds the upstream shadcn-vue NativeSelect. * style(ui): rounded-rectangle controls instead of pills Halves the radius scale so inputs, selects and buttons stop reading as pills, and badges and chips lose their full rounding. * fix(ui/alerts): centre the bell's failed state and stop it contradicting Needs you * fix(ui/tasks): one header line, aligned columns, no placeholder issue numbers Tasks puts its filters beside the title and drops the stat tiles the dashboard already shows. Sort headers align with their cells, chat tasks no longer show their synthetic issue number, and Logs and the task not-found page use the shared header. * fix(ui/dashboard): shared header and cards, empty cards stay silent Needs you uses the shadcn Card and drops its duplicate Open button; quality gates and token outlook render only when there is something to show; the throughput strip moves into the dashboard, its only user. * refactor(ui/stores): one Pinia store per feature Splits the site-wide control-plane store and the module-level refs into settings, workflows, tasks, events, org and session stores. Identity requests move into lib/api. Drops store fields nothing read: per-resource stream state, the states map and loadApplyStatus. * fix(ui/org): one header for the org area, sections drop their repeated titles The org name is the page title with the admin's org switcher and New org beside it; Members and Workspaces tables sit in cards like other pages. * fix(ui/events): shadcn Tabs for the capture, map and bind steps Replaces the numbered step strip with line tabs that carry each step's count; the Listening pill is gone and Capture off shows only when it is. * fix(ui/workflows): confirm a workflow delete in an AlertDialog, not window.confirm * style(ui/settings): denser setting rows
This commit is contained in:
1 parent
94d2f98cc0
commit
3bf64933b0
209 files changed
+2158
-3175
No files matched your search
+8
-13
@@ -1,19 +1,22 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted } from "vue";
|
||||
import { computed, onMounted } from "vue";
|
||||
|
||||
import ChatLauncher from "@/chat/ChatLauncher.vue";
|
||||
import CommandPalette from "@/components/command-palette/CommandPalette.vue";
|
||||
import Topbar from "@/components/topbar/Topbar.vue";
|
||||
import SettingsShell from "@/settings/SettingsShell.vue";
|
||||
import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { hidden, loadCapabilities } from "@/lib/capabilities";
|
||||
import { hiddenPaths } from "@/lib/nav";
|
||||
import { loadTaskMeta } from "@/lib/task-meta";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
|
||||
const session = useSessionStore();
|
||||
const hidden = computed(() => hiddenPaths(session.sections));
|
||||
|
||||
onMounted(() => {
|
||||
// Asked for once, after the shell is up: the nav paints immediately and
|
||||
// loses the entries this process cannot back a moment later, rather than
|
||||
// holding the page behind a request. A failed read hides nothing.
|
||||
void loadCapabilities();
|
||||
void session.loadCapabilities();
|
||||
|
||||
// The lifecycle vocabulary -- status labels, pill severity, "needs you"
|
||||
// grouping, and the operator actions -- is served by /api/task-meta. Asked
|
||||
@@ -41,7 +44,7 @@ onMounted(() => {
|
||||
class="flex min-h-[calc(100vh-2rem)] flex-col overflow-clip rounded-xl border border-[var(--hairline)] bg-[var(--workspace)] shadow-[var(--shadow-workspace)] backdrop-blur-[28px] backdrop-saturate-[1.2] max-lg:min-h-screen max-lg:rounded-none max-lg:border-0 max-lg:shadow-none"
|
||||
>
|
||||
<Topbar :hidden="hidden" />
|
||||
<main class="w-full flex-1 overflow-x-clip p-8 max-lg:p-4">
|
||||
<main class="w-full flex-1 overflow-x-clip px-6 py-5 max-lg:p-4">
|
||||
<!--
|
||||
Keyed on the path and its parameters but not the query: a query-only
|
||||
change is an entry state, so the page keeps the operator's filters,
|
||||
@@ -65,13 +68,5 @@ onMounted(() => {
|
||||
ride off the bottom of a long page.
|
||||
-->
|
||||
<ChatLauncher />
|
||||
|
||||
<!--
|
||||
Outside the shell for the same reason as the launcher above: the frame's
|
||||
backdrop-filter would otherwise become the containing block for the
|
||||
palette's fixed overlay. One instance for the whole app -- its global
|
||||
shortcut listener lives and dies with this mount.
|
||||
-->
|
||||
<CommandPalette :hidden="hidden" />
|
||||
</TooltipProvider>
|
||||
</template>
|
||||
@@ -7,7 +7,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Popover, PopoverContent, PopoverTrigger } from "@/components/ui/popover";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveUpdatesStore } from "@/stores/live-updates";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
import { groupBySeverity, type AlertSeverity, type OperatorAlert } from "./alerts";
|
||||
|
||||
const alerts = ref<OperatorAlert[]>([]);
|
||||
@@ -35,7 +35,7 @@ async function dismiss(alert: OperatorAlert) {
|
||||
// The bell follows the event stream: the store records every alert change as
|
||||
// an event, so the newest alert event's id moving means the list moved. A
|
||||
// reconnect re-reads, since events may have been missed while it was down.
|
||||
const live = useLiveUpdatesStore();
|
||||
const live = useSessionStore();
|
||||
const { activity, connectionRevision } = storeToRefs(live);
|
||||
watch(() => activity.value.find((event) => event.kind === "alert")?.id, load);
|
||||
watch(connectionRevision, load);
|
||||
@@ -67,8 +67,8 @@ function failedDeliveries(alert: OperatorAlert): number {
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent align="end" class="w-96 max-w-[calc(100vw-1.5rem)] p-0">
|
||||
<p v-if="failed" class="px-3 pt-3 text-xs text-danger" role="alert">Alerts could not be loaded.</p>
|
||||
<p v-else-if="!groups.length" class="px-3 py-6 text-center text-sm text-fg-subtle">Nothing needs you.</p>
|
||||
<p v-if="failed" class="px-3 py-6 text-center text-sm text-danger" role="alert">Alerts could not be loaded.</p>
|
||||
<p v-else-if="!groups.length" class="px-3 py-6 text-center text-sm text-fg-subtle">No alerts.</p>
|
||||
<div v-else class="max-h-96 overflow-y-auto">
|
||||
<section v-for="group in groups" :key="group.severity" class="border-b p-3 last:border-b-0">
|
||||
<h3 class="mb-2 text-xs font-medium text-fg-subtle">{{ group.label }}</h3>
|
||||
@@ -79,9 +79,7 @@ function failedDeliveries(alert: OperatorAlert): number {
|
||||
{{ alert.title }}
|
||||
</RouterLink>
|
||||
<span v-else class="text-sm font-medium">{{ alert.title }}</span>
|
||||
<Button variant="ghost" size="sm" class="h-6 shrink-0 px-2 text-xs" @click="dismiss(alert)">
|
||||
Dismiss
|
||||
</Button>
|
||||
<Button variant="ghost" size="xs" class="shrink-0" @click="dismiss(alert)">Dismiss</Button>
|
||||
</div>
|
||||
<p v-if="alert.body" class="text-xs text-fg-subtle">{{ alert.body }}</p>
|
||||
<p class="text-xs text-fg-subtle">
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* The shared page title and its actions. A component rather than per-page
|
||||
* markup because hand-built copies drift.
|
||||
*/
|
||||
/** Every page's title, with its actions on the same line. */
|
||||
defineProps<{ title: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-6 flex flex-wrap items-start justify-between gap-5">
|
||||
<h1 class="text-2xl font-semibold tracking-[-0.02em]">{{ title }}</h1>
|
||||
<div class="flex flex-wrap items-center gap-2">
|
||||
<header class="mb-4 flex min-h-9 flex-wrap items-center justify-between gap-x-4 gap-y-2">
|
||||
<h1 class="text-xl font-semibold tracking-tight">{{ title }}</h1>
|
||||
<div v-if="$slots.default" class="flex flex-wrap items-center gap-2">
|
||||
<slot />
|
||||
</div>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
@@ -1,53 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
|
||||
/**
|
||||
* Inline SVG sparkline. Shows shape, not exact values: the tile's headline
|
||||
* number carries the precision.
|
||||
*/
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
series: number[];
|
||||
stroke?: string;
|
||||
width?: number;
|
||||
height?: number;
|
||||
}>(),
|
||||
{ stroke: "var(--ok)", width: 220, height: 34 },
|
||||
);
|
||||
|
||||
const points = computed(() => {
|
||||
const max = Math.max(...props.series, 1);
|
||||
const min = Math.min(...props.series, 0);
|
||||
const span = max - min || 1;
|
||||
const step =
|
||||
props.series.length > 1
|
||||
? props.width / (props.series.length - 1)
|
||||
: props.width;
|
||||
|
||||
return props.series
|
||||
.map(
|
||||
(v, i) =>
|
||||
`${(i * step).toFixed(1)},${(props.height - ((v - min) / span) * props.height).toFixed(1)}`,
|
||||
)
|
||||
.join(" ");
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<svg
|
||||
class="mt-3 block h-[34px] w-full"
|
||||
:viewBox="`0 0 ${props.width} ${props.height}`"
|
||||
preserveAspectRatio="none"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<polyline
|
||||
:points="points"
|
||||
fill="none"
|
||||
:stroke="props.stroke"
|
||||
stroke-width="1.5"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
vector-effect="non-scaling-stroke"
|
||||
/>
|
||||
</svg>
|
||||
</template>
|
||||
@@ -1,81 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { TrendingDown, TrendingUp } from "@lucide/vue";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import {
|
||||
Card,
|
||||
CardAction,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import Sparkline from "./Sparkline.vue";
|
||||
|
||||
/**
|
||||
* A KPI tile: label, big value, trend against a stated comparison window, and
|
||||
* a sparkline. The comparison line is not decoration -- a number without a
|
||||
* baseline cannot be acted on, so `compare` is required.
|
||||
*
|
||||
* trend > 0 renders as an increase. `goodDirection` says whether that is good,
|
||||
* because rising latency and rising success rate are not the same news.
|
||||
*
|
||||
* The headline value is rendered whatever its type, including 0 and "": a tile
|
||||
* that showed a label and a comparison line with no number above them read as
|
||||
* a broken dashboard on every fresh install.
|
||||
*/
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
label: string;
|
||||
value: string | number;
|
||||
unit?: string;
|
||||
trend?: number | null;
|
||||
compare: string;
|
||||
series?: number[];
|
||||
goodDirection?: "up" | "down";
|
||||
}>(),
|
||||
{ series: () => [], goodDirection: "up" },
|
||||
);
|
||||
|
||||
const dir = computed(() =>
|
||||
props.trend == null ? null : props.trend >= 0 ? "up" : "down",
|
||||
);
|
||||
const good = computed(() =>
|
||||
dir.value == null ? null : dir.value === props.goodDirection,
|
||||
);
|
||||
const trendIcon = computed(() =>
|
||||
dir.value === "up" ? TrendingUp : TrendingDown,
|
||||
);
|
||||
const trendLabel = computed(() => `${Math.abs(props.trend ?? 0).toFixed(1)}%`);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<CardHeader>
|
||||
<CardTitle>{{ props.label }}</CardTitle>
|
||||
<CardDescription v-if="props.compare">{{
|
||||
props.compare
|
||||
}}</CardDescription>
|
||||
<CardAction v-if="dir">
|
||||
<Badge :variant="good ? 'ok' : 'danger'">
|
||||
<component :is="trendIcon" />
|
||||
{{ trendLabel }}
|
||||
</Badge>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<div class="text-3xl font-semibold tracking-[-0.03em]">
|
||||
{{ props.value
|
||||
}}<span v-if="props.unit" class="ml-1 text-lg text-fg-muted">{{
|
||||
props.unit
|
||||
}}</span>
|
||||
</div>
|
||||
<Sparkline
|
||||
v-if="props.series.length > 1"
|
||||
:series="props.series"
|
||||
:stroke="good === false ? 'var(--danger)' : 'var(--ok)'"
|
||||
/>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -140,9 +140,7 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
<DialogContent class="max-h-[85vh] overflow-y-auto sm:max-w-lg">
|
||||
<DialogHeader>
|
||||
<DialogTitle>{{ title }}</DialogTitle>
|
||||
<DialogDescription>
|
||||
Editing returns this binding to pending approval.
|
||||
</DialogDescription>
|
||||
<DialogDescription>Editing returns this binding to pending approval.</DialogDescription>
|
||||
</DialogHeader>
|
||||
|
||||
<form @submit.prevent="emit('save', draft)">
|
||||
@@ -232,8 +230,7 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
</Field>
|
||||
|
||||
<Field v-for="[name, spec] in declaredInputs" :key="name">
|
||||
<FieldLabel :for="`binding-input-${name}`">
|
||||
Input <span class="font-mono">{{ name }}</span>
|
||||
<FieldLabel :for="`binding-input-${name}`">Input <span class="font-mono">{{ name }}</span>
|
||||
<span class="text-fg-muted"
|
||||
>({{ spec.type }}{{ spec.required ? ", required" : "" }})</span
|
||||
>
|
||||
@@ -283,8 +280,7 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
v-for="field in stringParams"
|
||||
:key="field.name"
|
||||
:value="field.name"
|
||||
>
|
||||
Parameter {{ field.name }}
|
||||
>Parameter {{ field.name }}
|
||||
</SelectItem>
|
||||
</SelectGroup>
|
||||
</SelectContent>
|
||||
@@ -306,9 +302,7 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
<Input id="binding-repo" v-model="draft.repo" />
|
||||
</Field>
|
||||
</div>
|
||||
<FieldDescription>
|
||||
Both or neither; blank uses the configured repo.
|
||||
</FieldDescription>
|
||||
<FieldDescription>Both or neither; blank uses the configured repo.</FieldDescription>
|
||||
</Field>
|
||||
</FieldGroup>
|
||||
|
||||
@@ -329,8 +323,7 @@ const title = computed(() => (props.binding ? "Edit binding" : "New binding"));
|
||||
>Cancel</Button
|
||||
>
|
||||
<Button type="submit" :disabled="props.saving">
|
||||
<Spinner v-if="props.saving" data-icon="inline-start" />
|
||||
{{ props.saving ? "Saving" : "Save" }}
|
||||
<Spinner v-if="props.saving" data-icon="inline-start" />{{ props.saving ? "Saving" : "Save" }}
|
||||
</Button>
|
||||
</DialogFooter>
|
||||
</form>
|
||||
|
||||
@@ -79,8 +79,7 @@ const emit = defineEmits<{
|
||||
@click="emit('edit', props.binding)"
|
||||
>
|
||||
<Pencil data-icon="inline-start" />
|
||||
Edit
|
||||
</Button>
|
||||
Edit</Button>
|
||||
<!-- Only a pending binding can be approved. An armed binding is
|
||||
already firing, so the button would be a no-op -- or worse, a
|
||||
misleading one. -->
|
||||
@@ -90,8 +89,7 @@ const emit = defineEmits<{
|
||||
@click="emit('approve', props.binding)"
|
||||
>
|
||||
<Check data-icon="inline-start" />
|
||||
Approve
|
||||
</Button>
|
||||
Approve</Button>
|
||||
<Button
|
||||
v-if="props.binding.status === 'armed'"
|
||||
variant="outline"
|
||||
@@ -99,8 +97,7 @@ const emit = defineEmits<{
|
||||
@click="emit('pause', props.binding)"
|
||||
>
|
||||
<Pause data-icon="inline-start" />
|
||||
Pause
|
||||
</Button>
|
||||
Pause</Button>
|
||||
<!-- Resuming returns the binding to pending approval, so it is
|
||||
approved again before it fires. -->
|
||||
<Button
|
||||
@@ -110,16 +107,14 @@ const emit = defineEmits<{
|
||||
@click="emit('resume', props.binding)"
|
||||
>
|
||||
<Play data-icon="inline-start" />
|
||||
Resume
|
||||
</Button>
|
||||
Resume</Button>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
@click="emit('delete', props.binding)"
|
||||
>
|
||||
<Trash2 data-icon="inline-start" />
|
||||
Delete
|
||||
</Button>
|
||||
Delete</Button>
|
||||
</div>
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { onMounted, ref } from "vue";
|
||||
|
||||
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { useLiveResource } from "@/stores/session";
|
||||
import BindingEditor from "./BindingEditor.vue";
|
||||
import BindingsTable from "./BindingsTable.vue";
|
||||
import DeleteBindingDialog from "./DeleteBindingDialog.vue";
|
||||
@@ -77,8 +77,7 @@ async function handleDelete(binding: Binding): Promise<void> {
|
||||
<div class="mb-4 flex flex-wrap items-center justify-end gap-2">
|
||||
<Button v-if="!failure" @click="startCreate">
|
||||
<Plus data-icon="inline-start" />
|
||||
New binding
|
||||
</Button>
|
||||
New binding</Button>
|
||||
</div>
|
||||
|
||||
<!-- A mutation that failed leaves the list on screen accurate, so its
|
||||
|
||||
@@ -62,9 +62,7 @@ const failureTitle = computed(() =>
|
||||
<Empty v-else-if="!loading && !rows.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No bindings yet</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
None yet. A mapping + a workflow make a binding.
|
||||
</EmptyDescription>
|
||||
<EmptyDescription>None yet. A mapping + a workflow make a binding.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
|
||||
@@ -35,9 +35,7 @@ function onOpenChange(open: boolean): void {
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete "{{ props.binding?.name }}"?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
It stops dispatching immediately and cannot be recovered.
|
||||
</AlertDialogDescription>
|
||||
<AlertDialogDescription>It stops dispatching immediately and cannot be recovered.</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
|
||||
@@ -79,7 +79,5 @@ const captureLink = (id: string) => ({
|
||||
<span>{{ ago(d.dispatched_at) }}</span>
|
||||
</li>
|
||||
</ul>
|
||||
<p v-else-if="props.kind !== 'tasks'" class="text-xs text-fg-muted">
|
||||
No dispatches yet.
|
||||
</p>
|
||||
<p v-else-if="props.kind !== 'tasks'" class="text-xs text-fg-muted">No dispatches yet.</p>
|
||||
</template>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
import { eventsWorkspace } from "@/events/workspace";
|
||||
import { useEventsStore } from "@/stores/events";
|
||||
import { api, ApiError } from "@/lib/api";
|
||||
import type { EventType } from "@/captures/event-types";
|
||||
import {
|
||||
@@ -56,7 +56,7 @@ export function useBindings() {
|
||||
failure.value = null;
|
||||
try {
|
||||
const [b, m, w, t] = await Promise.all([
|
||||
api.bindings<{ bindings?: Binding[] }>(eventsWorkspace.value),
|
||||
api.bindings<{ bindings?: Binding[] }>(useEventsStore().workspace),
|
||||
api.mappings<{ mappings?: MappingOption[] }>(),
|
||||
api.workflows<{ definitions?: WorkflowOption[] }>(),
|
||||
api.eventTypes<{ event_types?: EventType[] }>(),
|
||||
|
||||
@@ -111,9 +111,7 @@ function onOpenChange(open: boolean) {
|
||||
:disabled="saving || !draft.name.trim() || !draft.source.trim()"
|
||||
@click="saveDraft"
|
||||
>
|
||||
<Spinner v-if="saving" />
|
||||
Save
|
||||
</Button>
|
||||
<Spinner v-if="saving" />Save</Button>
|
||||
</DialogFooter>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
|
||||
@@ -163,9 +163,7 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
<Empty v-if="!proposals.length && !eventTypes.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No event types yet</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Nothing is dispatched until a type matches.
|
||||
</EmptyDescription>
|
||||
<EmptyDescription>Nothing is dispatched until a type matches.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
</CardContent>
|
||||
@@ -182,10 +180,8 @@ function fieldCount(schema: Record<string, string> | null | undefined): number {
|
||||
<AlertDialogContent>
|
||||
<AlertDialogHeader>
|
||||
<AlertDialogTitle>Delete this event type?</AlertDialogTitle>
|
||||
<AlertDialogDescription>
|
||||
Events matching "{{ pendingDelete?.name }}" will arrive unidentified
|
||||
and will not dispatch.
|
||||
</AlertDialogDescription>
|
||||
<AlertDialogDescription>Events matching "{{ pendingDelete?.name }}" will arrive unidentified
|
||||
and will not dispatch.</AlertDialogDescription>
|
||||
</AlertDialogHeader>
|
||||
<AlertDialogFooter>
|
||||
<AlertDialogCancel>Cancel</AlertDialogCancel>
|
||||
|
||||
@@ -65,8 +65,7 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
class="w-fit"
|
||||
@click="headers().push({ name: '', value: '' })"
|
||||
>
|
||||
<Plus /> Header
|
||||
</Button>
|
||||
<Plus /> Header</Button>
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-2">
|
||||
@@ -118,8 +117,7 @@ function asOp(value: unknown): PayloadCondition["op"] {
|
||||
class="w-fit"
|
||||
@click="payload().push({ path: '', op: 'equals', value: '' })"
|
||||
>
|
||||
<Plus /> Payload condition
|
||||
</Button>
|
||||
<Plus /> Payload condition</Button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,6 +1,6 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
import { eventsWorkspace } from "@/events/workspace";
|
||||
import { useEventsStore } from "@/stores/events";
|
||||
import { api } from "@/lib/api";
|
||||
import { captures } from "./state";
|
||||
import {
|
||||
@@ -48,7 +48,7 @@ export const saveError = ref<string | null>(null);
|
||||
|
||||
export async function loadEventTypes(): Promise<void> {
|
||||
try {
|
||||
const res = await api.eventTypes<EventTypesResponse>(eventsWorkspace.value);
|
||||
const res = await api.eventTypes<EventTypesResponse>(useEventsStore().workspace);
|
||||
eventTypesEnabled.value = res.enabled !== false;
|
||||
eventTypes.value = res.event_types || [];
|
||||
proposals.value = res.proposals || [];
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { useLiveResource } from "@/stores/session";
|
||||
import { loadEventTypes } from "./event-type-state";
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
NumberFieldInput,
|
||||
} from "@/components/ui/number-field";
|
||||
import { SettingRow } from "@/components/ui/setting-row";
|
||||
import { StatusPill } from "@/components/ui/status-pill";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import {
|
||||
TagsInput,
|
||||
@@ -28,8 +28,8 @@ import {
|
||||
} from "@/components/ui/tags-input";
|
||||
import { api } from "@/lib/api";
|
||||
import SecretRefField from "@/settings/SecretRefField.vue";
|
||||
import { resourcesForPage, useControlPlaneStore } from "@/stores/control-plane";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { resourcesForPage, useSettingsStore } from "@/stores/settings";
|
||||
import { useLiveResource } from "@/stores/session";
|
||||
|
||||
const KIND = "channel-settings";
|
||||
|
||||
@@ -55,7 +55,7 @@ interface ChannelStatus {
|
||||
detail?: string;
|
||||
}
|
||||
|
||||
const store = useControlPlaneStore();
|
||||
const store = useSettingsStore();
|
||||
const { catalog, catalogError } = storeToRefs(store);
|
||||
const resources = computed(() => resourcesForPage(catalog.value, "channels"));
|
||||
const chat = computed(() => store.drafts[KIND]?.value as ChannelSettings | undefined);
|
||||
@@ -77,10 +77,10 @@ onMounted(() => Promise.all([loadStatus(), store.load()]));
|
||||
function statusOf(id: string) {
|
||||
const state = statuses.value.find((s) => s.id === id)?.state;
|
||||
if (!state) return undefined;
|
||||
if (state === "running") return { label: "Running", tone: "neutral", dot: "live" } as const;
|
||||
if (state === "failed") return { label: "Failed", tone: "danger", dot: "danger" } as const;
|
||||
if (state === "degraded") return { label: "Degraded", tone: "warn", dot: "warn" } as const;
|
||||
return { label: state[0]!.toUpperCase() + state.slice(1), tone: "neutral", dot: "idle" } as const;
|
||||
if (state === "running") return undefined;
|
||||
if (state === "failed") return { label: "Failed", tone: "danger" } as const;
|
||||
if (state === "degraded") return { label: "Degraded", tone: "warn" } as const;
|
||||
return { label: state[0]!.toUpperCase() + state.slice(1), tone: "idle" } as const;
|
||||
}
|
||||
|
||||
// A channel is set up once its enabling field is filled in, the rule the
|
||||
@@ -135,14 +135,11 @@ const models = computed({
|
||||
<div class="min-w-0 flex-1">
|
||||
<h2 :id="`ch-${channel.id}`" class="text-[15px] font-medium">{{ channel.title }}</h2>
|
||||
</div>
|
||||
<StatusPill v-if="statusOf(channel.id)" :tone="statusOf(channel.id)!.tone" :dot="statusOf(channel.id)!.dot">
|
||||
{{ statusOf(channel.id)!.label }}
|
||||
</StatusPill>
|
||||
<Badge v-if="configured[channel.id] && statusOf(channel.id)" :variant="statusOf(channel.id)!.tone">{{
|
||||
statusOf(channel.id)!.label
|
||||
}}</Badge>
|
||||
<template v-if="!configured[channel.id]">
|
||||
<StatusPill>Not set up</StatusPill>
|
||||
<Button v-if="!opened[channel.id]" variant="outline" size="sm" @click="opened[channel.id] = true">
|
||||
Set up
|
||||
</Button>
|
||||
<Button v-if="!opened[channel.id]" variant="outline" size="sm" @click="opened[channel.id] = true">Set up</Button>
|
||||
</template>
|
||||
</header>
|
||||
|
||||
@@ -168,9 +165,7 @@ const models = computed({
|
||||
</section>
|
||||
|
||||
<section class="mt-8 rounded-lg border border-border bg-card px-5 pt-4 pb-2" aria-labelledby="ch-defaults">
|
||||
<h2 id="ch-defaults" class="text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase">
|
||||
Chat session defaults
|
||||
</h2>
|
||||
<h2 id="ch-defaults" class="text-[11px] font-medium tracking-[0.06em] text-fg-subtle uppercase">Chat session defaults</h2>
|
||||
<SettingRow label="Workspace" for="cs-workspace" hint="Empty disables file tools.">
|
||||
<Input id="cs-workspace" v-model="chat.workspace" class="max-w-md font-mono" />
|
||||
</SettingRow>
|
||||
|
||||
@@ -23,7 +23,7 @@ defineProps<{ attachment: ChatMedia }>();
|
||||
:target="attachment.url ? '_blank' : undefined"
|
||||
:rel="attachment.url ? 'noopener noreferrer' : undefined"
|
||||
:title="mediaDetail(attachment)"
|
||||
class="inline-flex max-w-full items-center gap-1.5 rounded-full border border-border bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground"
|
||||
class="inline-flex max-w-full items-center gap-1.5 rounded-md border border-border bg-muted px-2.5 py-1 text-xs font-medium text-muted-foreground"
|
||||
>
|
||||
<Paperclip aria-hidden="true" class="size-3.5 shrink-0" />
|
||||
<span class="truncate">{{ mediaLabel(attachment) }}</span>
|
||||
|
||||
@@ -22,18 +22,14 @@ const PROMPTS = [
|
||||
class="mx-auto mb-3 grid size-9 place-items-center rounded-xl border border-border-strong font-bold text-link"
|
||||
>A</span
|
||||
>
|
||||
<h2 class="text-lg font-semibold tracking-[-0.02em]">
|
||||
What are we working on?
|
||||
</h2>
|
||||
<p class="mt-2 mb-4 text-sm text-fg-muted">
|
||||
Ask Archie anything, or start with one of these prompts.
|
||||
</p>
|
||||
<h2 class="text-lg font-semibold tracking-[-0.02em]">What are we working on?</h2>
|
||||
<p class="mt-2 mb-4 text-sm text-fg-muted">Ask Archie anything, or start with one of these prompts.</p>
|
||||
<div class="grid gap-2">
|
||||
<button
|
||||
v-for="prompt in PROMPTS"
|
||||
:key="prompt"
|
||||
type="button"
|
||||
class="rounded-full border border-border bg-muted px-3 py-2 text-left text-sm text-fg-muted transition-colors hover:border-border-strong hover:text-foreground"
|
||||
class="rounded-md border border-border bg-muted px-3 py-2 text-left text-sm text-fg-muted transition-colors hover:border-border-strong hover:text-foreground"
|
||||
@click="emit('prompt', prompt)"
|
||||
>
|
||||
{{ prompt }}
|
||||
|
||||
@@ -18,7 +18,7 @@ defineProps<{ path: string; label?: string }>();
|
||||
<RouterLink
|
||||
:to="path"
|
||||
:title="`Go to ${label || path}`"
|
||||
class="inline-flex max-w-full items-center gap-1.5 rounded-full border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
|
||||
class="inline-flex max-w-full items-center gap-1.5 rounded-md border border-primary/45 bg-primary-soft px-2.5 py-1 text-xs font-semibold text-link transition-colors hover:border-primary hover:bg-primary/15 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-primary"
|
||||
>
|
||||
<ArrowUpRight aria-hidden="true" class="size-3.5 shrink-0" />
|
||||
<span class="truncate">{{ label || path }}</span>
|
||||
|
||||
@@ -99,9 +99,7 @@ const bubbles = computed(() => messages.value.map(parts));
|
||||
size="sm"
|
||||
class="mt-2"
|
||||
@click="sendMessage({ turn: streamingTurn.turn })"
|
||||
>
|
||||
Retry
|
||||
</Button>
|
||||
>Retry</Button>
|
||||
<ChatAskCard v-if="streamingTurn.ask" :ask="streamingTurn.ask" />
|
||||
</ChatBubble>
|
||||
</MessageScrollerItem>
|
||||
|
||||
@@ -64,9 +64,7 @@ async function later() {
|
||||
<p v-else-if="state === 'deferred'" class="mt-2 text-fg-muted">Skipped until a newer release.</p>
|
||||
<p v-else-if="state === 'done'" class="mt-2 text-ok">{{ result }}</p>
|
||||
<p v-else class="mt-2 text-danger">{{ result }}</p>
|
||||
<p v-if="state === 'idle' && !update.can_install" class="mt-2 text-xs text-fg-muted">
|
||||
This host has no install script, so the update can't be installed from here.
|
||||
</p>
|
||||
<p v-if="state === 'idle' && !update.can_install" class="mt-2 text-xs text-fg-muted">This host has no install script, so the update can't be installed from here.</p>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@@ -566,7 +566,7 @@ export async function sendMessage(retryOpts?: RetryOptions): Promise<void> {
|
||||
turn: turn ? retryChatTurn(turn) : undefined,
|
||||
isRetry,
|
||||
};
|
||||
statusText.value = "Error — retry available";
|
||||
statusText.value = "Error. Retry available.";
|
||||
}
|
||||
} finally {
|
||||
clearTimeout(timeoutId);
|
||||
|
||||
@@ -1,226 +1,139 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { computed, onMounted, onUnmounted, ref, watch } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { Search } from "@lucide/vue";
|
||||
|
||||
import { navEntries, type NavEntry } from "@/lib/nav";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import {
|
||||
CommandDialog,
|
||||
CommandEmpty,
|
||||
CommandGroup,
|
||||
CommandInput,
|
||||
CommandItem,
|
||||
CommandList,
|
||||
} from "@/components/ui/command";
|
||||
import { Kbd } from "@/components/ui/kbd";
|
||||
import { api } from "@/lib/api";
|
||||
import { navEntries } from "@/lib/nav";
|
||||
import { statusLabel } from "@/lib/task-meta";
|
||||
|
||||
/**
|
||||
* The command palette: every section the nav can reach, opened with Cmd/Ctrl+K
|
||||
* or '/' from anywhere. It is a jump list, not a data search -- the topbar's
|
||||
* SearchBar owns the same list with prefix matching from a visible field; this
|
||||
* one adds substring matching and arrow-key selection from a shortcut.
|
||||
*
|
||||
* Styling and keyboard handling mirror ChatSlashPalette, the in-app palette
|
||||
* precedent: a bordered popover surface, mousedown prevented on the options so
|
||||
* choosing with the pointer never steals focus from the filter, and the list
|
||||
* scrolled so the highlighted row stays visible. Nothing here animates, so the
|
||||
* shell's prefers-reduced-motion rule has nothing to quiet.
|
||||
* Jump to a page, a task or a workflow by name. Opened from the top bar, with
|
||||
* Cmd/Ctrl+K, or with '/' when no field has focus. Tasks and workflows are
|
||||
* read when the palette opens, so it never shows a stale list for long.
|
||||
*/
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const open = ref(false);
|
||||
const query = ref("");
|
||||
const selection = ref(0);
|
||||
const field = ref<HTMLInputElement | null>(null);
|
||||
const list = ref<HTMLElement | null>(null);
|
||||
|
||||
// The same list the topbar's SearchBar and Nav read: navEntries flattens the
|
||||
// nav tree and drops what this composition cannot back, so the palette can
|
||||
// never offer a destination the server cannot serve.
|
||||
const allEntries = computed(() =>
|
||||
navEntries(props.hidden).filter((entry) => !entry.soon),
|
||||
);
|
||||
|
||||
// Substring, not prefix: an operator who remembers "where do channels live"
|
||||
// types a word from the description, not the start of the label.
|
||||
const matches = computed(() => {
|
||||
const needle = query.value.trim().toLowerCase();
|
||||
if (!needle) return allEntries.value;
|
||||
return allEntries.value.filter((entry) =>
|
||||
`${entry.label} ${entry.description} ${entry.path}`
|
||||
.toLowerCase()
|
||||
.includes(needle),
|
||||
);
|
||||
});
|
||||
watch(query, () => {
|
||||
selection.value = 0;
|
||||
});
|
||||
// Capabilities can land while the palette is open and shrink the list; the
|
||||
// highlight must not point past the last row.
|
||||
watch(matches, () => {
|
||||
if (selection.value >= matches.value.length) selection.value = 0;
|
||||
});
|
||||
|
||||
function optionId(index: number): string {
|
||||
return `command-palette-option-${index}`;
|
||||
interface TaskEntry {
|
||||
id: number | string;
|
||||
title?: string;
|
||||
status?: string;
|
||||
}
|
||||
|
||||
async function show(): Promise<void> {
|
||||
query.value = "";
|
||||
selection.value = 0;
|
||||
open.value = true;
|
||||
await nextTick();
|
||||
field.value?.focus();
|
||||
const pages = computed(() => navEntries(props.hidden));
|
||||
const tasks = ref<TaskEntry[]>([]);
|
||||
const workflows = ref<string[]>([]);
|
||||
const shortcut = navigator.platform.startsWith("Mac") ? "⌘K" : "Ctrl K";
|
||||
const showWorkflows = computed(() => !props.hidden.includes("/workflows"));
|
||||
|
||||
// A failed read leaves that group empty: the pages still work, and the
|
||||
// palette is not the place to report a broken task list.
|
||||
async function loadEntries(): Promise<void> {
|
||||
const [taskPage, workflowList] = await Promise.all([
|
||||
api.taskPage<TaskEntry>({ limit: 100 }).catch(() => null),
|
||||
showWorkflows.value
|
||||
? api.workflows<{ definitions?: { id: string }[] }>().catch(() => null)
|
||||
: null,
|
||||
]);
|
||||
tasks.value = taskPage?.tasks ?? [];
|
||||
workflows.value = (workflowList?.definitions ?? []).map(({ id }) => id);
|
||||
}
|
||||
|
||||
function close(): void {
|
||||
watch(open, (value) => {
|
||||
if (value) void loadEntries();
|
||||
});
|
||||
|
||||
function go(path: string): void {
|
||||
open.value = false;
|
||||
field.value?.blur();
|
||||
void router.push(path);
|
||||
}
|
||||
|
||||
function toggle(): void {
|
||||
if (open.value) close();
|
||||
else void show();
|
||||
}
|
||||
|
||||
// '/' opens only when the keystroke was meant for a field, not for the page:
|
||||
// typing a slash into the composer or the topbar search must stay typing.
|
||||
// '/' opens only when the keystroke was not meant for a field.
|
||||
function isEditableTarget(event: KeyboardEvent): boolean {
|
||||
const el = event.target;
|
||||
return (
|
||||
el instanceof HTMLElement &&
|
||||
(el.isContentEditable ||
|
||||
el.tagName === "INPUT" ||
|
||||
el.tagName === "TEXTAREA" ||
|
||||
el.tagName === "SELECT")
|
||||
(el.isContentEditable || ["INPUT", "TEXTAREA", "SELECT"].includes(el.tagName))
|
||||
);
|
||||
}
|
||||
|
||||
// Registered on document in the bubble phase (capture: false): the palette is
|
||||
// the last thing that should see a keystroke, after any focused field has had
|
||||
// its turn.
|
||||
function onGlobalKeydown(event: KeyboardEvent): void {
|
||||
if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === "k") {
|
||||
event.preventDefault();
|
||||
toggle();
|
||||
return;
|
||||
}
|
||||
if (event.key === "/" && !open.value && !isEditableTarget(event)) {
|
||||
open.value = !open.value;
|
||||
} else if (event.key === "/" && !open.value && !isEditableTarget(event)) {
|
||||
event.preventDefault();
|
||||
void show();
|
||||
open.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
onMounted(() => document.addEventListener("keydown", onGlobalKeydown));
|
||||
onUnmounted(() => document.removeEventListener("keydown", onGlobalKeydown));
|
||||
|
||||
function onKeydown(event: KeyboardEvent): void {
|
||||
if (event.key === "Escape") {
|
||||
// Consumed here so closing the palette is not also read as a dismissal of
|
||||
// whatever is open behind it (ChatLauncher watches defaultPrevented).
|
||||
event.preventDefault();
|
||||
close();
|
||||
return;
|
||||
}
|
||||
if (event.key === "ArrowDown") {
|
||||
event.preventDefault();
|
||||
if (matches.value.length)
|
||||
selection.value = Math.min(selection.value + 1, matches.value.length - 1);
|
||||
return;
|
||||
}
|
||||
if (event.key === "ArrowUp") {
|
||||
event.preventDefault();
|
||||
selection.value = Math.max(selection.value - 1, 0);
|
||||
return;
|
||||
}
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
const entry = matches.value[selection.value];
|
||||
if (entry) choose(entry);
|
||||
}
|
||||
}
|
||||
|
||||
function choose(entry: NavEntry): void {
|
||||
void router.push(entry.path);
|
||||
close();
|
||||
}
|
||||
|
||||
// The pointer and the keyboard share one highlight, so a scroll must never
|
||||
// move it: when the list scrolls under a stationary pointer (including the
|
||||
// scrollIntoView below) the browser reports a move with no delta, and
|
||||
// letting it steal selection puts the highlight on the wrong row.
|
||||
function onHover(index: number, event: MouseEvent): void {
|
||||
if (event.movementX === 0 && event.movementY === 0) return;
|
||||
selection.value = index;
|
||||
}
|
||||
|
||||
// Keep the highlighted row visible once matches run past the rows that fit.
|
||||
// block: 'nearest' scrolls the minimum distance and never animates, so reduced
|
||||
// motion needs no handling here. Optional call: not every environment
|
||||
// implements scrollIntoView.
|
||||
watch([selection, matches], async () => {
|
||||
if (!open.value) return;
|
||||
await nextTick();
|
||||
list.value
|
||||
?.querySelector('[aria-selected="true"]')
|
||||
?.scrollIntoView?.({ block: "nearest" });
|
||||
});
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div v-if="open" class="fixed inset-0 isolate z-50" @mousedown.self="close">
|
||||
<div
|
||||
class="bg-black/10 supports-backdrop-filter:backdrop-blur-xs absolute inset-0"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
<div
|
||||
role="dialog"
|
||||
aria-label="Command palette"
|
||||
class="bg-popover text-popover-foreground border-border-strong shadow-md relative mx-auto mt-[15vh] w-[calc(100%-2rem)] max-w-lg overflow-hidden rounded-xl border"
|
||||
>
|
||||
<div class="border-border flex items-center gap-2 border-b px-3">
|
||||
<Search :size="15" class="text-muted-foreground shrink-0" />
|
||||
<input
|
||||
ref="field"
|
||||
v-model="query"
|
||||
type="text"
|
||||
role="combobox"
|
||||
aria-label="Filter sections"
|
||||
aria-expanded="true"
|
||||
aria-controls="command-palette-list"
|
||||
:aria-activedescendant="
|
||||
matches[selection] ? optionId(selection) : undefined
|
||||
"
|
||||
class="h-11 w-full bg-transparent text-sm outline-none placeholder:text-muted-foreground"
|
||||
placeholder="Jump to a section…"
|
||||
@keydown="onKeydown"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
id="command-palette-list"
|
||||
ref="list"
|
||||
role="listbox"
|
||||
aria-label="Sections"
|
||||
class="max-h-72 overflow-x-hidden overflow-y-auto p-1.5"
|
||||
>
|
||||
<button
|
||||
v-for="(entry, index) in matches"
|
||||
:id="optionId(index)"
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="text-muted-foreground w-44 justify-start max-lg:w-auto"
|
||||
aria-label="Jump to"
|
||||
@click="open = true"
|
||||
>
|
||||
<Search data-icon="inline-start" />
|
||||
<span class="max-lg:hidden">Jump to</span>
|
||||
<Kbd class="ml-auto max-lg:hidden">{{ shortcut }}</Kbd>
|
||||
</Button>
|
||||
<CommandDialog v-model:open="open" title="Jump to" description="Find a page, task or workflow.">
|
||||
<CommandInput placeholder="Find a page, task or workflow" />
|
||||
<CommandList>
|
||||
<CommandEmpty>No matches.</CommandEmpty>
|
||||
<CommandGroup heading="Pages">
|
||||
<CommandItem
|
||||
v-for="entry in pages"
|
||||
:key="entry.path"
|
||||
type="button"
|
||||
role="option"
|
||||
:aria-selected="index === selection"
|
||||
class="hover:bg-muted aria-selected:bg-muted flex flex-col gap-0.5 rounded-md px-2.5 py-2 text-left outline-none"
|
||||
@mousedown.prevent
|
||||
@mousemove="onHover(index, $event)"
|
||||
@click="choose(entry)"
|
||||
:value="`page:${entry.path}`"
|
||||
@select="go(entry.path)"
|
||||
>
|
||||
<span class="truncate text-sm text-foreground min-w-0">{{
|
||||
entry.label
|
||||
{{ entry.label }}
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
<CommandGroup v-if="workflows.length" heading="Workflows">
|
||||
<CommandItem
|
||||
v-for="id in workflows"
|
||||
:key="id"
|
||||
:value="`workflow:${id}`"
|
||||
@select="go(`/workflows?workflow=${encodeURIComponent(id)}`)"
|
||||
>
|
||||
{{ id }}
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
<CommandGroup v-if="tasks.length" heading="Tasks">
|
||||
<CommandItem
|
||||
v-for="task in tasks"
|
||||
:key="task.id"
|
||||
:value="`task:${task.id}`"
|
||||
@select="go(`/tasks/${task.id}`)"
|
||||
>
|
||||
<span class="text-muted-foreground shrink-0 tabular-nums">#{{ task.id }}</span>
|
||||
<span class="truncate">{{ task.title }}</span>
|
||||
<span v-if="task.status" class="text-muted-foreground ml-auto shrink-0 text-xs">{{
|
||||
statusLabel(task.status)
|
||||
}}</span>
|
||||
<span
|
||||
v-if="entry.description"
|
||||
class="text-fg-muted truncate text-xs min-w-0"
|
||||
>{{ entry.description }}</span
|
||||
>
|
||||
</button>
|
||||
<p v-if="!matches.length" class="text-fg-muted px-2.5 py-3 text-sm">
|
||||
No matching section.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</CommandItem>
|
||||
</CommandGroup>
|
||||
</CommandList>
|
||||
</CommandDialog>
|
||||
</template>
|
||||
@@ -1,22 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import { storeToRefs } from "pinia";
|
||||
|
||||
import { connectionStatus } from "@/lib/connection";
|
||||
import { useLiveUpdatesStore } from "@/stores/live-updates";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
|
||||
const { streamState } = storeToRefs(useLiveUpdatesStore());
|
||||
const status = computed(() => connectionStatus(streamState.value));
|
||||
const look = {
|
||||
ok: { dot: "bg-primary", text: "text-fg-subtle" },
|
||||
warn: { dot: "bg-warn", text: "text-warn" },
|
||||
danger: { dot: "bg-danger", text: "text-danger" },
|
||||
} as const;
|
||||
// Silent while the stream is live or opening for the first time; only a lost
|
||||
// stream is worth the operator's attention.
|
||||
const { streamState } = storeToRefs(useSessionStore());
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span role="status" class="inline-flex items-center gap-1.5 px-1 text-xs max-sm:hidden" :class="look[status.tone].text">
|
||||
<span class="size-1.5 rounded-full" :class="look[status.tone].dot" aria-hidden="true" />
|
||||
{{ status.label }}
|
||||
<span
|
||||
v-if="streamState === 'reconnecting' || streamState === 'unavailable'"
|
||||
role="status"
|
||||
class="inline-flex items-center gap-1.5 px-1 text-xs max-sm:hidden"
|
||||
:class="streamState === 'unavailable' ? 'text-danger' : 'text-warn'"
|
||||
>
|
||||
<span
|
||||
class="size-1.5 rounded-full"
|
||||
:class="streamState === 'unavailable' ? 'bg-danger' : 'bg-warn'"
|
||||
aria-hidden="true"
|
||||
/>
|
||||
{{ streamState === "unavailable" ? "Disconnected" : "Reconnecting" }}
|
||||
</span>
|
||||
</template>
|
||||
@@ -2,14 +2,14 @@
|
||||
import { computed } from "vue";
|
||||
import { useRoute } from "vue-router";
|
||||
|
||||
import { activeNavPath, navTree } from "@/lib/nav";
|
||||
import NavGroup from "./NavGroup.vue";
|
||||
import NavTrigger from "./NavTrigger.vue";
|
||||
import { activeNavPath, navTree, type NavEntry } from "@/lib/nav";
|
||||
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
|
||||
const route = useRoute();
|
||||
const tree = computed(() => navTree(props.hidden));
|
||||
const links = computed(() =>
|
||||
navTree(props.hidden).flatMap((node): NavEntry[] => (node.kind === "link" ? [node.entry] : [])),
|
||||
);
|
||||
const activePath = computed(() => activeNavPath(route.path));
|
||||
</script>
|
||||
|
||||
@@ -18,23 +18,14 @@ const activePath = computed(() => activeNavPath(route.path));
|
||||
aria-label="Sections"
|
||||
class="flex min-w-0 flex-1 items-center gap-0.5 overflow-x-auto [scrollbar-width:none]"
|
||||
>
|
||||
<template
|
||||
v-for="node in tree"
|
||||
:key="node.kind === 'link' ? node.entry.path : node.label"
|
||||
<RouterLink
|
||||
v-for="entry in links"
|
||||
:key="entry.path"
|
||||
:to="entry.path"
|
||||
:aria-current="activePath === entry.path ? 'page' : undefined"
|
||||
:data-current="activePath === entry.path ? '' : undefined"
|
||||
class="text-muted-foreground hover:text-foreground hover:bg-accent data-current:text-foreground data-current:bg-accent focus-visible:ring-ring/50 inline-flex h-8 shrink-0 items-center rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-[3px]"
|
||||
>{{ entry.label }}</RouterLink
|
||||
>
|
||||
<NavTrigger
|
||||
v-if="node.kind === 'link'"
|
||||
:to="node.entry.path"
|
||||
:current="activePath === node.entry.path"
|
||||
>
|
||||
{{ node.entry.label }}
|
||||
</NavTrigger>
|
||||
<NavGroup
|
||||
v-else
|
||||
:label="node.label"
|
||||
:items="node.items"
|
||||
:active-path="activePath"
|
||||
/>
|
||||
</template>
|
||||
</nav>
|
||||
</template>
|
||||
@@ -1,75 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { ref } from "vue";
|
||||
import { ChevronDown } from "@lucide/vue";
|
||||
|
||||
import {
|
||||
DropdownMenu,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuLabel,
|
||||
DropdownMenuSeparator,
|
||||
DropdownMenuTrigger,
|
||||
} from "@/components/ui/dropdown-menu";
|
||||
import type { NavEntry } from "@/lib/nav";
|
||||
import NavItem from "./NavItem.vue";
|
||||
import NavTrigger from "./NavTrigger.vue";
|
||||
|
||||
const props = defineProps<{
|
||||
label: string;
|
||||
items: NavEntry[];
|
||||
activePath: string;
|
||||
}>();
|
||||
|
||||
const holds = (path: string) => props.activePath === path;
|
||||
|
||||
/**
|
||||
* Hover-open, click-toggling menu.
|
||||
*
|
||||
* Pointing at the group opens it; leaving it closes it after a short grace
|
||||
* period, so the move from trigger to content cannot close what you are
|
||||
* moving towards (the content carries its own enter/leave handlers, and the
|
||||
* delay covers the gap between two teleported elements). The trigger keeps
|
||||
* its click and keyboard semantics: reka still emits update:open on
|
||||
* activation, this only controls how long the menu stays open.
|
||||
*/
|
||||
const open = ref(false);
|
||||
let closeTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
|
||||
function openMenu() {
|
||||
clearTimeout(closeTimer);
|
||||
open.value = true;
|
||||
}
|
||||
|
||||
function closeMenuSoon() {
|
||||
clearTimeout(closeTimer);
|
||||
closeTimer = setTimeout(() => {
|
||||
open.value = false;
|
||||
}, 140);
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenu :open="open" @update:open="open = $event">
|
||||
<div class="flex" @pointerenter="openMenu" @pointerleave="closeMenuSoon">
|
||||
<DropdownMenuTrigger as-child>
|
||||
<NavTrigger :current="items.some((item) => holds(item.path))">
|
||||
{{ props.label }}
|
||||
<ChevronDown :size="14" class="opacity-60" />
|
||||
</NavTrigger>
|
||||
</DropdownMenuTrigger>
|
||||
</div>
|
||||
<DropdownMenuContent
|
||||
align="start"
|
||||
class="w-52"
|
||||
@pointerenter="openMenu"
|
||||
@pointerleave="closeMenuSoon"
|
||||
>
|
||||
<template v-for="(item, index) in items" :key="item.path">
|
||||
<DropdownMenuSeparator v-if="item.dividerBefore && index > 0" />
|
||||
<DropdownMenuLabel v-if="item.dividerBefore">{{
|
||||
item.dividerBefore
|
||||
}}</DropdownMenuLabel>
|
||||
<NavItem :entry="item" :current="holds(item.path)" />
|
||||
</template>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
</template>
|
||||
@@ -1,24 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { DropdownMenuItem } from "@/components/ui/dropdown-menu";
|
||||
import type { NavEntry } from "@/lib/nav";
|
||||
|
||||
defineProps<{ entry: NavEntry; current: boolean }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<DropdownMenuItem
|
||||
as-child
|
||||
:data-current="current ? '' : undefined"
|
||||
:disabled="entry.soon"
|
||||
class="data-current:text-foreground data-current:bg-accent/60 px-2 py-1.5"
|
||||
>
|
||||
<RouterLink :to="entry.path" class="w-full cursor-pointer">
|
||||
<span class="flex-1">{{ entry.label }}</span>
|
||||
<span
|
||||
v-if="entry.soon"
|
||||
class="text-muted-foreground text-[11px] tracking-wide uppercase"
|
||||
>soon</span
|
||||
>
|
||||
</RouterLink>
|
||||
</DropdownMenuItem>
|
||||
</template>
|
||||
@@ -1,16 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
defineProps<{ to?: string; current?: boolean }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<component
|
||||
:is="to ? 'RouterLink' : 'button'"
|
||||
:to="to"
|
||||
:type="to ? undefined : 'button'"
|
||||
:aria-current="to && current ? 'page' : undefined"
|
||||
:data-current="current ? '' : undefined"
|
||||
class="text-muted-foreground hover:text-foreground hover:bg-accent data-current:text-foreground data-current:bg-accent focus-visible:ring-ring/50 inline-flex h-8 shrink-0 items-center gap-1 rounded-md px-2.5 text-sm font-medium whitespace-nowrap transition-colors outline-none focus-visible:ring-[3px]"
|
||||
>
|
||||
<slot />
|
||||
</component>
|
||||
</template>
|
||||
@@ -21,14 +21,13 @@ import {
|
||||
</Avatar>
|
||||
</DropdownMenuTrigger>
|
||||
<DropdownMenuContent align="end" class="w-48">
|
||||
<DropdownMenuLabel class="text-muted-foreground text-xs font-normal">
|
||||
Signed in locally
|
||||
</DropdownMenuLabel>
|
||||
<DropdownMenuLabel class="text-muted-foreground text-xs font-normal">Signed in locally</DropdownMenuLabel>
|
||||
<DropdownMenuSeparator />
|
||||
<DropdownMenuItem as-child>
|
||||
<RouterLink to="/settings/appearance" class="w-full cursor-pointer"
|
||||
>Appearance</RouterLink
|
||||
>
|
||||
<RouterLink to="/settings/appearance" class="w-full cursor-pointer">Appearance</RouterLink>
|
||||
</DropdownMenuItem>
|
||||
<DropdownMenuItem as-child>
|
||||
<RouterLink to="/logs" class="w-full cursor-pointer">Logs</RouterLink>
|
||||
</DropdownMenuItem>
|
||||
</DropdownMenuContent>
|
||||
</DropdownMenu>
|
||||
|
||||
@@ -1,84 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, nextTick, ref } from "vue";
|
||||
import { useRouter } from "vue-router";
|
||||
import { Search } from "@lucide/vue";
|
||||
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { navEntries } from "@/lib/nav";
|
||||
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
|
||||
const router = useRouter();
|
||||
const field = ref<{ $el: HTMLInputElement } | null>(null);
|
||||
const query = ref("");
|
||||
const open = ref(false);
|
||||
|
||||
const entries = computed(() =>
|
||||
navEntries(props.hidden).filter((entry) => !entry.soon),
|
||||
);
|
||||
|
||||
// Jumping between sections, deliberately not a data search: each section owns
|
||||
// its own filtering, and one box that means something different on every page
|
||||
// is worse than none.
|
||||
const hit = computed(() => {
|
||||
const wanted = query.value.trim().toLowerCase();
|
||||
if (!wanted) return undefined;
|
||||
return entries.value.find((entry) =>
|
||||
entry.label.toLowerCase().startsWith(wanted),
|
||||
);
|
||||
});
|
||||
|
||||
async function toggle() {
|
||||
open.value = !open.value;
|
||||
if (!open.value) return;
|
||||
await nextTick();
|
||||
field.value?.$el.focus();
|
||||
}
|
||||
|
||||
function onKeydown(event: KeyboardEvent) {
|
||||
const input = event.target as HTMLInputElement;
|
||||
if (event.key === "Escape") {
|
||||
// Consumed here so a dismissal of the field is not also read as a
|
||||
// dismissal of whatever is open behind it.
|
||||
event.preventDefault();
|
||||
query.value = "";
|
||||
open.value = false;
|
||||
input.blur();
|
||||
return;
|
||||
}
|
||||
if (event.key !== "Enter" || !hit.value) return;
|
||||
void router.push(hit.value.path);
|
||||
query.value = "";
|
||||
open.value = false;
|
||||
input.blur();
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="flex items-center">
|
||||
<button
|
||||
type="button"
|
||||
class="text-muted-foreground hover:text-foreground hover:bg-accent focus-visible:ring-ring/50 inline-flex size-8 items-center justify-center rounded-md outline-none focus-visible:ring-[3px] lg:hidden"
|
||||
aria-label="Jump to a section"
|
||||
:aria-expanded="open"
|
||||
@click="toggle()"
|
||||
>
|
||||
<Search :size="16" />
|
||||
</button>
|
||||
<div class="relative" :class="open ? 'block' : 'hidden lg:block'">
|
||||
<Search
|
||||
:size="15"
|
||||
class="text-muted-foreground pointer-events-none absolute top-1/2 left-2.5 -translate-y-1/2"
|
||||
/>
|
||||
<Input
|
||||
ref="field"
|
||||
v-model="query"
|
||||
type="search"
|
||||
class="h-8 w-44 pl-8 text-sm"
|
||||
placeholder="Jump to…"
|
||||
aria-label="Jump to a section"
|
||||
@keydown="onKeydown"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,26 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { CircleQuestionMark } from "@lucide/vue";
|
||||
|
||||
import {
|
||||
Tooltip,
|
||||
TooltipContent,
|
||||
TooltipTrigger,
|
||||
} from "@/components/ui/tooltip";
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Tooltip>
|
||||
<TooltipTrigger as-child>
|
||||
<a
|
||||
href="https://github.com/samcharles93/archie-core/tree/main/docs"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
class="text-muted-foreground hover:text-foreground hover:bg-accent focus-visible:ring-ring/50 inline-flex size-8 items-center justify-center rounded-md outline-none focus-visible:ring-[3px]"
|
||||
aria-label="Documentation"
|
||||
>
|
||||
<CircleQuestionMark :size="16" />
|
||||
</a>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent :side-offset="8">Documentation</TooltipContent>
|
||||
</Tooltip>
|
||||
</template>
|
||||
@@ -1,12 +1,11 @@
|
||||
<script setup lang="ts">
|
||||
import AlertsBell from "@/alerts/AlertsBell.vue";
|
||||
import CommandPalette from "@/components/command-palette/CommandPalette.vue";
|
||||
import NewTaskButton from "@/tasks/NewTaskButton.vue";
|
||||
import Brand from "./Brand.vue";
|
||||
import ConnectionPill from "./ConnectionPill.vue";
|
||||
import Nav from "./Nav.vue";
|
||||
import ProfileDropdown from "./ProfileDropdown.vue";
|
||||
import SearchBar from "./SearchBar.vue";
|
||||
import SupportLink from "./SupportLink.vue";
|
||||
|
||||
const props = defineProps<{ hidden: string[] }>();
|
||||
</script>
|
||||
@@ -18,11 +17,10 @@ const props = defineProps<{ hidden: string[] }>();
|
||||
<Brand />
|
||||
<Nav :hidden="props.hidden" />
|
||||
<div class="flex shrink-0 items-center gap-2">
|
||||
<SearchBar :hidden="props.hidden" />
|
||||
<ConnectionPill />
|
||||
<CommandPalette :hidden="props.hidden" />
|
||||
<NewTaskButton v-if="!props.hidden.includes('/workflows')" />
|
||||
<AlertsBell />
|
||||
<ConnectionPill />
|
||||
<SupportLink />
|
||||
<ProfileDropdown />
|
||||
</div>
|
||||
</header>
|
||||
|
||||
@@ -4,7 +4,7 @@ import { cva } from "class-variance-authority";
|
||||
export { default as Badge } from "./Badge.vue";
|
||||
|
||||
export const badgeVariants = cva(
|
||||
"h-5 gap-1 rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none",
|
||||
"h-5 gap-1 rounded-sm border border-transparent px-2 py-0.5 text-xs font-medium transition-all has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&>svg]:size-3! group/badge inline-flex w-fit shrink-0 items-center justify-center overflow-hidden whitespace-nowrap focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none",
|
||||
{
|
||||
variants: {
|
||||
variant: {
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
<script setup lang="ts">
|
||||
import type { ListboxRootEmits, ListboxRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { ListboxRoot, useFilter, useForwardPropsEmits } from 'reka-ui'
|
||||
import { reactive, ref, watch } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { provideCommandContext } from '.'
|
||||
|
||||
const props = withDefaults(defineProps<ListboxRootProps & { class?: HTMLAttributes['class'] }>(), {
|
||||
modelValue: '',
|
||||
highlightOnHover: true,
|
||||
})
|
||||
|
||||
const emits = defineEmits<ListboxRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
|
||||
const allItems = ref<Map<string, string>>(new Map())
|
||||
const allGroups = ref<Map<string, Set<string>>>(new Map())
|
||||
|
||||
const { contains } = useFilter({ sensitivity: 'base' })
|
||||
const filterState = reactive({
|
||||
search: '',
|
||||
filtered: {
|
||||
/** The count of all visible items. */
|
||||
count: 0,
|
||||
/** Map from visible item id to its search score. */
|
||||
items: new Map() as Map<string, number>,
|
||||
/** Set of groups with at least one visible item. */
|
||||
groups: new Set() as Set<string>,
|
||||
},
|
||||
})
|
||||
|
||||
function filterItems() {
|
||||
if (!filterState.search) {
|
||||
filterState.filtered.count = allItems.value.size
|
||||
// Do nothing, each item will know to show itself because search is empty
|
||||
return
|
||||
}
|
||||
|
||||
// Reset the groups
|
||||
filterState.filtered.groups = new Set()
|
||||
let itemCount = 0
|
||||
|
||||
// Check which items should be included
|
||||
for (const [id, value] of allItems.value) {
|
||||
const score = contains(value, filterState.search)
|
||||
filterState.filtered.items.set(id, score ? 1 : 0)
|
||||
if (score)
|
||||
itemCount++
|
||||
}
|
||||
|
||||
// Check which groups have at least 1 item shown
|
||||
for (const [groupId, group] of allGroups.value) {
|
||||
for (const itemId of group) {
|
||||
if (filterState.filtered.items.get(itemId)! > 0) {
|
||||
filterState.filtered.groups.add(groupId)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
filterState.filtered.count = itemCount
|
||||
}
|
||||
|
||||
watch(() => filterState.search, () => {
|
||||
filterItems()
|
||||
})
|
||||
|
||||
provideCommandContext({
|
||||
allItems,
|
||||
allGroups,
|
||||
filterState,
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ListboxRoot
|
||||
data-slot="command"
|
||||
v-bind="forwarded"
|
||||
:class="cn('bg-popover text-popover-foreground rounded-xl! p-1 flex size-full flex-col overflow-hidden', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</ListboxRoot>
|
||||
</template>
|
||||
@@ -0,0 +1,39 @@
|
||||
<script setup lang="ts">
|
||||
import type { DialogRootEmits, DialogRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from '@/components/ui/dialog'
|
||||
import Command from './Command.vue'
|
||||
|
||||
const props = withDefaults(defineProps<DialogRootProps & {
|
||||
title?: string
|
||||
description?: string
|
||||
class?: HTMLAttributes['class']
|
||||
showCloseButton?: boolean
|
||||
}>(), {
|
||||
title: 'Command Palette',
|
||||
description: 'Search for a command to run...',
|
||||
showCloseButton: false,
|
||||
})
|
||||
const emits = defineEmits<DialogRootEmits>()
|
||||
|
||||
const forwarded = useForwardPropsEmits(props, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Dialog v-slot="slotProps" v-bind="forwarded">
|
||||
<DialogContent
|
||||
:class="cn('rounded-xl! top-1/3 translate-y-0 overflow-hidden p-0', props.class)"
|
||||
:show-close-button="showCloseButton"
|
||||
>
|
||||
<DialogHeader class="sr-only">
|
||||
<DialogTitle>{{ title }}</DialogTitle>
|
||||
<DialogDescription>{{ description }}</DialogDescription>
|
||||
</DialogHeader>
|
||||
<Command>
|
||||
<slot v-bind="slotProps" />
|
||||
</Command>
|
||||
</DialogContent>
|
||||
</Dialog>
|
||||
</template>
|
||||
@@ -0,0 +1,28 @@
|
||||
<script setup lang="ts">
|
||||
import type { PrimitiveProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { Primitive } from 'reka-ui'
|
||||
import { computed } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useCommand } from '.'
|
||||
|
||||
const props = defineProps<PrimitiveProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const { filterState } = useCommand()
|
||||
const isRender = computed(() => !!filterState.search && filterState.filtered.count === 0,
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Primitive
|
||||
v-if="isRender"
|
||||
data-slot="command-empty"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('py-6 text-center text-sm', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Primitive>
|
||||
</template>
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import type { ListboxGroupProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { ListboxGroup, ListboxGroupLabel, useId } from 'reka-ui'
|
||||
import { computed, onMounted, onUnmounted } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { provideCommandGroupContext, useCommand } from '.'
|
||||
|
||||
const props = defineProps<ListboxGroupProps & {
|
||||
class?: HTMLAttributes['class']
|
||||
heading?: string
|
||||
}>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const { allGroups, filterState } = useCommand()
|
||||
const id = useId()
|
||||
|
||||
const isRender = computed(() => !filterState.search ? true : filterState.filtered.groups.has(id))
|
||||
|
||||
provideCommandGroupContext({ id })
|
||||
onMounted(() => {
|
||||
if (!allGroups.value.has(id))
|
||||
allGroups.value.set(id, new Set())
|
||||
})
|
||||
onUnmounted(() => {
|
||||
allGroups.value.delete(id)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ListboxGroup
|
||||
v-bind="delegatedProps"
|
||||
:id="id"
|
||||
data-slot="command-group"
|
||||
:class="cn('text-foreground **:[[cmdk-group-heading]]:text-muted-foreground overflow-hidden p-1 **:[[cmdk-group-heading]]:px-2 **:[[cmdk-group-heading]]:py-1.5 **:[[cmdk-group-heading]]:text-xs **:[[cmdk-group-heading]]:font-medium', props.class)"
|
||||
:hidden="isRender ? undefined : true"
|
||||
>
|
||||
<ListboxGroupLabel v-if="heading" data-slot="command-group-heading" class="">
|
||||
{{ heading }}
|
||||
</ListboxGroupLabel>
|
||||
<slot />
|
||||
</ListboxGroup>
|
||||
</template>
|
||||
@@ -0,0 +1,45 @@
|
||||
<script setup lang="ts">
|
||||
import type { ListboxFilterProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { SearchIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { ListboxFilter, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { InputGroup, InputGroupAddon } from '@/components/ui/input-group'
|
||||
import { useCommand } from '.'
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const props = defineProps<ListboxFilterProps & {
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
|
||||
const { filterState } = useCommand()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
data-slot="command-input-wrapper"
|
||||
class="p-1 pb-0"
|
||||
>
|
||||
<InputGroup class="bg-input/30 border-input/30 h-8! rounded-lg! shadow-none! *:data-[slot=input-group-addon]:pl-2!">
|
||||
<ListboxFilter
|
||||
v-bind="{ ...forwardedProps, ...$attrs }"
|
||||
v-model="filterState.search"
|
||||
data-slot="command-input"
|
||||
auto-focus
|
||||
:class="cn('w-full text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50', props.class)"
|
||||
/>
|
||||
<InputGroupAddon>
|
||||
<SearchIcon class="size-4 shrink-0 opacity-50" />
|
||||
</InputGroupAddon>
|
||||
</InputGroup>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,79 @@
|
||||
<script setup lang="ts">
|
||||
import type { ListboxItemEmits, ListboxItemProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { CheckIcon } from '@lucide/vue'
|
||||
import { reactiveOmit, useCurrentElement } from '@vueuse/core'
|
||||
import { ListboxItem, useForwardPropsEmits, useId } from 'reka-ui'
|
||||
import { computed, onMounted, onUnmounted, ref } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
import { useCommand, useCommandGroup } from '.'
|
||||
|
||||
const props = defineProps<ListboxItemProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<ListboxItemEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
|
||||
const id = useId()
|
||||
const { filterState, allItems, allGroups } = useCommand()
|
||||
const groupContext = useCommandGroup()
|
||||
|
||||
const isRender = computed(() => {
|
||||
if (!filterState.search) {
|
||||
return true
|
||||
}
|
||||
else {
|
||||
const filteredCurrentItem = filterState.filtered.items.get(id)
|
||||
// If the filtered items is undefined means not in the all times map yet
|
||||
// Do the first render to add into the map
|
||||
if (filteredCurrentItem === undefined) {
|
||||
return true
|
||||
}
|
||||
|
||||
// Check with filter
|
||||
return filteredCurrentItem > 0
|
||||
}
|
||||
})
|
||||
|
||||
const itemRef = ref()
|
||||
const currentElement = useCurrentElement(itemRef)
|
||||
onMounted(() => {
|
||||
if (!(currentElement.value instanceof HTMLElement))
|
||||
return
|
||||
|
||||
// textValue to perform filter
|
||||
allItems.value.set(id, currentElement.value.textContent ?? (props.value?.toString() ?? ''))
|
||||
|
||||
const groupId = groupContext?.id
|
||||
if (groupId) {
|
||||
if (!allGroups.value.has(groupId)) {
|
||||
allGroups.value.set(groupId, new Set([id]))
|
||||
}
|
||||
else {
|
||||
allGroups.value.get(groupId)?.add(id)
|
||||
}
|
||||
}
|
||||
})
|
||||
onUnmounted(() => {
|
||||
allItems.value.delete(id)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ListboxItem
|
||||
v-if="isRender"
|
||||
v-bind="forwarded"
|
||||
:id="id"
|
||||
ref="itemRef"
|
||||
data-slot="command-item"
|
||||
:class="cn('data-highlighted:bg-muted data-highlighted:text-foreground data-highlighted:*:[svg]:text-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none in-data-[slot=dialog-content]:rounded-lg! [&_svg:not([class*=size-])]:size-4 group/command-item data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0', props.class)"
|
||||
@select="() => {
|
||||
filterState.search = ''
|
||||
}"
|
||||
>
|
||||
<slot />
|
||||
<CheckIcon class="ml-auto opacity-0 group-has-data-[slot=command-shortcut]/command-item:hidden group-data-[checked=true]/command-item:opacity-100" />
|
||||
</ListboxItem>
|
||||
</template>
|
||||
@@ -0,0 +1,25 @@
|
||||
<script setup lang="ts">
|
||||
import type { ListboxContentProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { ListboxContent, useForwardProps } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<ListboxContentProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ListboxContent
|
||||
data-slot="command-list"
|
||||
v-bind="forwarded"
|
||||
:class="cn('no-scrollbar max-h-72 scroll-py-1 outline-none overflow-x-hidden overflow-y-auto', props.class)"
|
||||
>
|
||||
<div role="presentation">
|
||||
<slot />
|
||||
</div>
|
||||
</ListboxContent>
|
||||
</template>
|
||||
@@ -0,0 +1,21 @@
|
||||
<script setup lang="ts">
|
||||
import type { SeparatorProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { Separator } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<SeparatorProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Separator
|
||||
data-slot="command-separator"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('bg-border -mx-1 h-px', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</Separator>
|
||||
</template>
|
||||
@@ -0,0 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{
|
||||
class?: HTMLAttributes['class']
|
||||
}>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span
|
||||
data-slot="command-shortcut"
|
||||
:class="cn('text-muted-foreground group-data-highlighted/command-item:text-foreground ml-auto text-xs tracking-widest', props.class)"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
</template>
|
||||
@@ -0,0 +1,25 @@
|
||||
import type { Ref } from 'vue'
|
||||
import { createContext } from 'reka-ui'
|
||||
|
||||
export { default as Command } from './Command.vue'
|
||||
export { default as CommandDialog } from './CommandDialog.vue'
|
||||
export { default as CommandEmpty } from './CommandEmpty.vue'
|
||||
export { default as CommandGroup } from './CommandGroup.vue'
|
||||
export { default as CommandInput } from './CommandInput.vue'
|
||||
export { default as CommandItem } from './CommandItem.vue'
|
||||
export { default as CommandList } from './CommandList.vue'
|
||||
export { default as CommandSeparator } from './CommandSeparator.vue'
|
||||
export { default as CommandShortcut } from './CommandShortcut.vue'
|
||||
|
||||
export const [useCommand, provideCommandContext] = createContext<{
|
||||
allItems: Ref<Map<string, string>>
|
||||
allGroups: Ref<Map<string, Set<string>>>
|
||||
filterState: {
|
||||
search: string
|
||||
filtered: { count: number, items: Map<string, number>, groups: Set<string> }
|
||||
}
|
||||
}>('Command')
|
||||
|
||||
export const [useCommandGroup, provideCommandGroupContext] = createContext<{
|
||||
id?: string
|
||||
}>('CommandGroup')
|
||||
@@ -27,7 +27,7 @@ const props = withDefaults(
|
||||
>
|
||||
<slot />
|
||||
<DialogClose v-if="showCloseButton" as-child>
|
||||
<Button variant="outline"> Close </Button>
|
||||
<Button variant="outline">Close</Button>
|
||||
</DialogClose>
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script setup lang="ts">
|
||||
import type { AcceptableValue } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { ChevronDownIcon } from '@lucide/vue'
|
||||
import { reactiveOmit, useVModel } from '@vueuse/core'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
defineOptions({
|
||||
inheritAttrs: false,
|
||||
})
|
||||
|
||||
const props = defineProps<{
|
||||
modelValue?: AcceptableValue | AcceptableValue[]
|
||||
class?: HTMLAttributes['class']
|
||||
size?: 'sm' | 'default'
|
||||
}>()
|
||||
|
||||
const emit = defineEmits<{
|
||||
'update:modelValue': [value: AcceptableValue]
|
||||
}>()
|
||||
|
||||
const modelValue = useVModel(props, 'modelValue', emit, {
|
||||
passive: true,
|
||||
defaultValue: '',
|
||||
})
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class', 'size')
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div
|
||||
:class="cn('group/native-select relative w-fit has-[select:disabled]:opacity-50', props.class)"
|
||||
data-slot="native-select-wrapper"
|
||||
:data-size="props.size ?? 'default'"
|
||||
>
|
||||
<select
|
||||
v-bind="{ ...$attrs, ...delegatedProps }"
|
||||
v-model="modelValue"
|
||||
data-slot="native-select"
|
||||
class="border-input placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground dark:bg-input/30 dark:hover:bg-input/50 focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive dark:aria-invalid:border-destructive/50 h-8 w-full min-w-0 appearance-none rounded-lg border bg-transparent py-1 pr-8 pl-2.5 text-sm transition-colors select-none focus-visible:ring-3 aria-invalid:ring-3 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-[size=sm]:py-0.5 outline-none disabled:pointer-events-none disabled:cursor-not-allowed"
|
||||
:data-size="props.size ?? 'default'"
|
||||
>
|
||||
<slot />
|
||||
</select>
|
||||
<ChevronDownIcon class="text-muted-foreground top-1/2 right-2.5 size-4 -translate-y-1/2 pointer-events-none absolute select-none" aria-hidden="true" data-slot="native-select-icon" />
|
||||
</div>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{ class?: HTMLAttributes['class'] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<optgroup data-slot="native-select-optgroup" :class="cn('bg-[Canvas] text-[CanvasText]', props.class)">
|
||||
<slot />
|
||||
</optgroup>
|
||||
</template>
|
||||
@@ -0,0 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<{ class?: HTMLAttributes['class'] }>()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<option data-slot="native-select-option" :class="cn('bg-[Canvas] text-[CanvasText]', props.class)">
|
||||
<slot />
|
||||
</option>
|
||||
</template>
|
||||
@@ -0,0 +1,3 @@
|
||||
export { default as NativeSelect } from './NativeSelect.vue'
|
||||
export { default as NativeSelectOptGroup } from './NativeSelectOptGroup.vue'
|
||||
export { default as NativeSelectOption } from './NativeSelectOption.vue'
|
||||
@@ -1,28 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationRootEmits, PaginationRootProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationRoot, useForwardPropsEmits } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<
|
||||
PaginationRootProps & {
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>();
|
||||
const emits = defineEmits<PaginationRootEmits>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="pagination"
|
||||
v-bind="forwarded"
|
||||
:class="cn('mx-auto flex w-full justify-center', props.class)"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</PaginationRoot>
|
||||
</template>
|
||||
@@ -1,24 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationListProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationList } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<
|
||||
PaginationListProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationList
|
||||
v-slot="slotProps"
|
||||
data-slot="pagination-content"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('gap-0.5 flex items-center', props.class)"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</PaginationList>
|
||||
</template>
|
||||
@@ -1,33 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationEllipsisProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { MoreHorizontalIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationEllipsis } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = defineProps<
|
||||
PaginationEllipsisProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationEllipsis
|
||||
data-slot="pagination-ellipsis"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
'size-8 [&_svg:not([class*=size-])]:size-4 flex items-center justify-center',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot>
|
||||
<MoreHorizontalIcon />
|
||||
<span class="sr-only">More pages</span>
|
||||
</slot>
|
||||
</PaginationEllipsis>
|
||||
</template>
|
||||
@@ -1,39 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationFirstProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { ChevronsLeftIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationFirst, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
PaginationFirstProps & {
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: "default",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
const forwarded = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationFirst
|
||||
data-slot="pagination-first"
|
||||
:class="cn(buttonVariants({ variant: 'ghost', size }), '', props.class)"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot>
|
||||
<ChevronsLeftIcon data-icon="inline-start" />
|
||||
<span class="hidden sm:block">First</span>
|
||||
</slot>
|
||||
</PaginationFirst>
|
||||
</template>
|
||||
@@ -1,42 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationListItemProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationListItem } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
PaginationListItemProps & {
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
isActive?: boolean;
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: "icon",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size", "isActive");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationListItem
|
||||
data-slot="pagination-item"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
buttonVariants({
|
||||
variant: isActive ? 'outline' : 'ghost',
|
||||
size,
|
||||
}),
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</PaginationListItem>
|
||||
</template>
|
||||
@@ -1,39 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationLastProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { ChevronsRightIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationLast, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
PaginationLastProps & {
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: "default",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
const forwarded = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationLast
|
||||
data-slot="pagination-last"
|
||||
:class="cn(buttonVariants({ variant: 'ghost', size }), '', props.class)"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot>
|
||||
<span class="hidden sm:block">Last</span>
|
||||
<ChevronsRightIcon data-icon="inline-end" />
|
||||
</slot>
|
||||
</PaginationLast>
|
||||
</template>
|
||||
@@ -1,40 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
href?: string;
|
||||
size?: ButtonVariants["size"];
|
||||
isActive?: boolean;
|
||||
class?: HTMLAttributes["class"];
|
||||
}>(),
|
||||
{
|
||||
size: "icon",
|
||||
isActive: false,
|
||||
},
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<a
|
||||
:href="href"
|
||||
data-slot="pagination-link"
|
||||
:data-active="isActive ? '' : undefined"
|
||||
:aria-current="isActive ? 'page' : undefined"
|
||||
:class="
|
||||
cn(
|
||||
buttonVariants({
|
||||
variant: isActive ? 'outline' : 'ghost',
|
||||
size,
|
||||
}),
|
||||
'',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<slot />
|
||||
</a>
|
||||
</template>
|
||||
@@ -1,41 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationNextProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { ChevronRightIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationNext, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
PaginationNextProps & {
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: "default",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
const forwarded = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationNext
|
||||
data-slot="pagination-next"
|
||||
:class="
|
||||
cn(buttonVariants({ variant: 'ghost', size }), 'pr-1.5!', props.class)
|
||||
"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot>
|
||||
<ChevronRightIcon data-icon="inline-start" class="cn-rtl-flip" />
|
||||
<span class="sr-only">Next attempt</span>
|
||||
</slot>
|
||||
</PaginationNext>
|
||||
</template>
|
||||
@@ -1,41 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { PaginationPrevProps } from "reka-ui";
|
||||
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import type { ButtonVariants } from "@/components/ui/button";
|
||||
import { ChevronLeftIcon } from "@lucide/vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { PaginationPrev, useForwardProps } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { buttonVariants } from "@/components/ui/button";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<
|
||||
PaginationPrevProps & {
|
||||
size?: ButtonVariants["size"];
|
||||
class?: HTMLAttributes["class"];
|
||||
}
|
||||
>(),
|
||||
{
|
||||
size: "default",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class", "size");
|
||||
const forwarded = useForwardProps(delegatedProps);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<PaginationPrev
|
||||
data-slot="pagination-previous"
|
||||
:class="
|
||||
cn(buttonVariants({ variant: 'ghost', size }), 'pl-1.5!', props.class)
|
||||
"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot>
|
||||
<ChevronLeftIcon data-icon="inline-start" class="cn-rtl-flip" />
|
||||
<span class="sr-only">Previous attempt</span>
|
||||
</slot>
|
||||
</PaginationPrev>
|
||||
</template>
|
||||
@@ -1,9 +0,0 @@
|
||||
export { default as Pagination } from "./Pagination.vue";
|
||||
export { default as PaginationContent } from "./PaginationContent.vue";
|
||||
export { default as PaginationEllipsis } from "./PaginationEllipsis.vue";
|
||||
export { default as PaginationFirst } from "./PaginationFirst.vue";
|
||||
export { default as PaginationItem } from "./PaginationItem.vue";
|
||||
export { default as PaginationLast } from "./PaginationLast.vue";
|
||||
export { default as PaginationLink } from "./PaginationLink.vue";
|
||||
export { default as PaginationNext } from "./PaginationNext.vue";
|
||||
export { default as PaginationPrevious } from "./PaginationPrevious.vue";
|
||||
@@ -1,25 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { RadioGroupRootEmits, RadioGroupRootProps } from 'reka-ui'
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import { RadioGroupRoot, useForwardPropsEmits } from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<RadioGroupRootProps & { class?: HTMLAttributes['class'] }>()
|
||||
const emits = defineEmits<RadioGroupRootEmits>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwarded = useForwardPropsEmits(delegatedProps, emits)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupRoot
|
||||
v-slot="slotProps"
|
||||
data-slot="radio-group"
|
||||
:class="cn('grid gap-2 w-full', props.class)"
|
||||
v-bind="forwarded"
|
||||
>
|
||||
<slot v-bind="slotProps" />
|
||||
</RadioGroupRoot>
|
||||
</template>
|
||||
@@ -1,41 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { RadioGroupItemProps } from 'reka-ui'
|
||||
|
||||
import type { HTMLAttributes } from 'vue'
|
||||
import { CircleIcon } from '@lucide/vue'
|
||||
import { reactiveOmit } from '@vueuse/core'
|
||||
import {
|
||||
RadioGroupIndicator,
|
||||
RadioGroupItem,
|
||||
useForwardProps,
|
||||
} from 'reka-ui'
|
||||
import { cn } from '@/lib/utils'
|
||||
|
||||
const props = defineProps<RadioGroupItemProps & { class?: HTMLAttributes['class'] }>()
|
||||
|
||||
const delegatedProps = reactiveOmit(props, 'class')
|
||||
|
||||
const forwardedProps = useForwardProps(delegatedProps)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupItem
|
||||
data-slot="radio-group-item"
|
||||
v-bind="forwardedProps"
|
||||
:class="
|
||||
cn(
|
||||
'border-input dark:bg-input/30 data-checked:bg-primary data-checked:text-primary-foreground dark:data-checked:bg-primary data-checked:border-primary aria-invalid:aria-checked:border-primary aria-invalid:border-destructive focus-visible:border-ring focus-visible:ring-ring/50 aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 dark:aria-invalid:border-destructive/50 flex size-4 rounded-full focus-visible:ring-3 aria-invalid:ring-3 group/radio-group-item peer relative aspect-square shrink-0 border outline-none after:absolute after:-inset-x-3 after:-inset-y-2 disabled:cursor-not-allowed disabled:opacity-50',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<RadioGroupIndicator
|
||||
data-slot="radio-group-indicator"
|
||||
class="flex size-4 items-center justify-center"
|
||||
>
|
||||
<slot>
|
||||
<CircleIcon class="bg-primary-foreground absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full" />
|
||||
</slot>
|
||||
</RadioGroupIndicator>
|
||||
</RadioGroupItem>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
export { default as RadioGroup } from './RadioGroup.vue'
|
||||
export { default as RadioGroupItem } from './RadioGroupItem.vue'
|
||||
@@ -1,31 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { ScrollAreaRootProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { ScrollAreaCorner, ScrollAreaRoot, ScrollAreaViewport } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
import ScrollBar from "./ScrollBar.vue";
|
||||
|
||||
const props = defineProps<
|
||||
ScrollAreaRootProps & { class?: HTMLAttributes["class"] }
|
||||
>();
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ScrollAreaRoot
|
||||
data-slot="scroll-area"
|
||||
v-bind="delegatedProps"
|
||||
:class="cn('relative', props.class)"
|
||||
>
|
||||
<ScrollAreaViewport
|
||||
data-slot="scroll-area-viewport"
|
||||
class="size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-3 focus-visible:ring-ring/50 focus-visible:outline-1"
|
||||
>
|
||||
<slot />
|
||||
</ScrollAreaViewport>
|
||||
<ScrollBar />
|
||||
<ScrollAreaCorner />
|
||||
</ScrollAreaRoot>
|
||||
</template>
|
||||
@@ -1,35 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import type { ScrollAreaScrollbarProps } from "reka-ui";
|
||||
import type { HTMLAttributes } from "vue";
|
||||
import { reactiveOmit } from "@vueuse/core";
|
||||
import { ScrollAreaScrollbar, ScrollAreaThumb } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<ScrollAreaScrollbarProps & { class?: HTMLAttributes["class"] }>(),
|
||||
{
|
||||
orientation: "vertical",
|
||||
},
|
||||
);
|
||||
|
||||
const delegatedProps = reactiveOmit(props, "class");
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ScrollAreaScrollbar
|
||||
data-slot="scroll-area-scrollbar"
|
||||
:data-orientation="orientation"
|
||||
v-bind="delegatedProps"
|
||||
:class="
|
||||
cn(
|
||||
'data-horizontal:h-2.5 data-horizontal:flex-col data-horizontal:border-t data-horizontal:border-t-transparent data-vertical:h-full data-vertical:w-2.5 data-vertical:border-l data-vertical:border-l-transparent flex touch-none p-px transition-colors select-none',
|
||||
props.class,
|
||||
)
|
||||
"
|
||||
>
|
||||
<ScrollAreaThumb
|
||||
data-slot="scroll-area-thumb"
|
||||
class="rounded-full relative flex-1 bg-border"
|
||||
/>
|
||||
</ScrollAreaScrollbar>
|
||||
</template>
|
||||
@@ -1,2 +0,0 @@
|
||||
export { default as ScrollArea } from "./ScrollArea.vue";
|
||||
export { default as ScrollBar } from "./ScrollBar.vue";
|
||||
@@ -24,15 +24,11 @@ defineEmits<{ change: [] }>();
|
||||
<span class="text-muted-foreground">{{ engine }}</span>
|
||||
<span class="text-muted-foreground" aria-hidden="true">/</span>
|
||||
<span class="min-w-0 flex-1 truncate">{{ secretKey }}</span>
|
||||
<Button variant="ghost" size="sm" class="h-7" :disabled="disabled" @click="$emit('change')">
|
||||
Change
|
||||
</Button>
|
||||
<Button variant="ghost" size="sm" class="h-7" :disabled="disabled" @click="$emit('change')">Change</Button>
|
||||
</div>
|
||||
<p v-if="resolved === true" class="flex items-center gap-1.5 text-xs text-ok">
|
||||
<CircleCheck class="size-3.5" aria-hidden="true" /> Credential resolved
|
||||
</p>
|
||||
<CircleCheck class="size-3.5" aria-hidden="true" /> Credential resolved</p>
|
||||
<p v-else-if="resolved === false" class="flex items-center gap-1.5 text-xs text-danger">
|
||||
<CircleAlert class="size-3.5" aria-hidden="true" /> Credential not found
|
||||
</p>
|
||||
<CircleAlert class="size-3.5" aria-hidden="true" /> Credential not found</p>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,32 +0,0 @@
|
||||
<script setup lang="ts" generic="T extends string">
|
||||
import { RadioGroupItem, RadioGroupRoot } from "reka-ui";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineProps<{
|
||||
options: { value: T; label: string }[];
|
||||
label: string;
|
||||
disabled?: boolean;
|
||||
class?: string;
|
||||
}>();
|
||||
const model = defineModel<T>({ required: true });
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RadioGroupRoot
|
||||
v-model="model"
|
||||
:aria-label="label"
|
||||
:disabled="disabled"
|
||||
orientation="horizontal"
|
||||
loop
|
||||
:class="cn('inline-flex h-9 items-center gap-0.5 rounded-md border border-input bg-background p-0.5', $props.class)"
|
||||
>
|
||||
<RadioGroupItem
|
||||
v-for="option in options"
|
||||
:key="option.value"
|
||||
:value="option.value"
|
||||
class="h-full rounded-sm px-3 text-[13px] font-medium text-muted-foreground transition-colors hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring data-[state=checked]:bg-secondary data-[state=checked]:text-foreground disabled:opacity-50"
|
||||
>
|
||||
{{ option.label }}
|
||||
</RadioGroupItem>
|
||||
</RadioGroupRoot>
|
||||
</template>
|
||||
@@ -1 +0,0 @@
|
||||
export { default as SegmentedControl } from "./SegmentedControl.vue";
|
||||
@@ -16,7 +16,7 @@ defineProps<{
|
||||
<div
|
||||
:class="
|
||||
cn(
|
||||
'grid gap-2 border-t border-border py-4 md:grid-cols-[17rem_1fr] md:gap-8',
|
||||
'grid gap-2 border-t border-border py-3 md:grid-cols-[17rem_1fr] md:gap-8',
|
||||
tone === 'danger' && 'rounded-md border border-danger/40 bg-danger-soft px-4',
|
||||
$props.class,
|
||||
)
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
defineProps<{
|
||||
cells: { label: string; value: string | number; sub?: string; tone?: "default" | "warn" | "danger" }[];
|
||||
class?: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<dl
|
||||
:class="cn('grid auto-cols-fr grid-flow-col divide-x divide-border rounded-lg border border-border bg-card max-md:grid-flow-row max-md:divide-x-0 max-md:divide-y', $props.class)"
|
||||
>
|
||||
<div v-for="cell in cells" :key="cell.label" class="min-w-0 px-5 py-4">
|
||||
<dt class="truncate text-xs text-fg-subtle">{{ cell.label }}</dt>
|
||||
<dd
|
||||
:class="
|
||||
cn(
|
||||
'mt-1 truncate text-3xl font-semibold tabular-nums',
|
||||
cell.tone === 'warn' && 'text-warn',
|
||||
cell.tone === 'danger' && 'text-danger',
|
||||
)
|
||||
"
|
||||
>
|
||||
{{ cell.value }}
|
||||
</dd>
|
||||
<dd v-if="cell.sub" class="mt-1 truncate text-xs text-fg-subtle">{{ cell.sub }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</template>
|
||||
@@ -1 +0,0 @@
|
||||
export { default as StatStrip } from "./StatStrip.vue";
|
||||
@@ -1,33 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import { cva, type VariantProps } from "class-variance-authority";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
const pill = cva(
|
||||
"inline-flex h-6 shrink-0 items-center gap-1.5 whitespace-nowrap rounded-full border px-2.5 text-xs font-medium",
|
||||
{
|
||||
variants: {
|
||||
tone: {
|
||||
neutral: "border-border bg-secondary text-muted-foreground",
|
||||
accent: "border-primary/50 bg-transparent text-primary",
|
||||
warn: "border-warn/40 bg-warn-soft text-warn",
|
||||
danger: "border-danger/40 bg-danger-soft text-danger",
|
||||
},
|
||||
dot: {
|
||||
none: "",
|
||||
live: "before:size-1.5 before:rounded-full before:bg-primary",
|
||||
warn: "before:size-1.5 before:rounded-full before:bg-warn",
|
||||
danger: "before:size-1.5 before:rounded-full before:bg-danger",
|
||||
idle: "before:size-1.5 before:rounded-full before:bg-idle",
|
||||
},
|
||||
},
|
||||
defaultVariants: { tone: "neutral", dot: "none" },
|
||||
},
|
||||
);
|
||||
|
||||
type PillVariants = VariantProps<typeof pill>;
|
||||
defineProps<{ tone?: PillVariants["tone"]; dot?: PillVariants["dot"]; class?: string }>();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<span :class="cn(pill({ tone, dot }), $props.class)"><slot /></span>
|
||||
</template>
|
||||
@@ -1 +0,0 @@
|
||||
export { default as StatusPill } from "./StatusPill.vue";
|
||||
@@ -27,8 +27,7 @@ const props = defineProps<{ action: CuratorActionEntry }>();
|
||||
</p>
|
||||
<!-- The reason is the point of this list: an action without one is not
|
||||
reviewable. -->
|
||||
<p v-if="props.action.reason" class="mt-1 text-xs text-fg-subtle">
|
||||
Why: {{ props.action.reason }}
|
||||
<p v-if="props.action.reason" class="mt-1 text-xs text-fg-subtle">Why: {{ props.action.reason }}
|
||||
</p>
|
||||
</li>
|
||||
</template>
|
||||
@@ -7,7 +7,7 @@ import { Textarea } from "@/components/ui/textarea";
|
||||
import { Switch } from "@/components/ui/switch";
|
||||
import { DurationInput } from "@/components/ui/duration-input";
|
||||
import { SettingRow } from "@/components/ui/setting-row";
|
||||
import { useControlPlaneStore } from "@/stores/control-plane";
|
||||
import { useSettingsStore } from "@/stores/settings";
|
||||
import ApplyStatusRows from "@/settings/ApplyStatusRows.vue";
|
||||
import HistoryLink from "@/settings/HistoryLink.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
@@ -18,7 +18,7 @@ import {
|
||||
EmptyTitle,
|
||||
} from "@/components/ui/empty";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { useLiveResource } from "@/stores/session";
|
||||
import CuratorCard, { type Curator } from "./CuratorCard.vue";
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ interface Definition {
|
||||
on_input: boolean; tools: string[]; skills: boolean; memory_engine: string; conversations: boolean; model: string;
|
||||
}
|
||||
const KIND = "curators";
|
||||
const store = useControlPlaneStore();
|
||||
const store = useSettingsStore();
|
||||
onMounted(store.load);
|
||||
const definitions = computed(() => store.drafts[KIND]?.value as Definition[] | null);
|
||||
const editing = ref(false);
|
||||
@@ -101,9 +101,7 @@ onMounted(load);
|
||||
<Empty v-else-if="!curators.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No curators registered</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
Curators are background agent loops that maintain memory and skills.
|
||||
</EmptyDescription>
|
||||
<EmptyDescription>Curators are background agent loops that maintain memory and skills.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<CuratorCard v-for="c in curators" v-else :key="c.name" :curator="c" />
|
||||
|
||||
@@ -4,7 +4,7 @@ import { computed } from "vue";
|
||||
import { TableCell, TableRow } from "@/components/ui/table";
|
||||
import { ago } from "@/lib/format";
|
||||
import { activityDetail } from "./activity-detail";
|
||||
import { taskIDFor, type ActivityEvent } from "./state";
|
||||
import { useTasksStore, type ActivityEvent } from "@/stores/tasks";
|
||||
|
||||
/**
|
||||
* One row of the live activity table. A row whose event resolves to a task is
|
||||
@@ -14,7 +14,8 @@ import { taskIDFor, type ActivityEvent } from "./state";
|
||||
const props = defineProps<{ event: ActivityEvent }>();
|
||||
const emit = defineEmits<{ open: [taskID: number] }>();
|
||||
|
||||
const taskID = computed(() => taskIDFor(props.event));
|
||||
const tasks = useTasksStore();
|
||||
const taskID = computed(() => tasks.taskIDFor(props.event));
|
||||
// The detail is cut to one line by activityDetail and clamped again in the
|
||||
// cell so a long unbroken token (a path, a URL, a hash) cannot widen the column
|
||||
// past the table. Unclamped, this made the dashboard 7,481px tall.
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
import { AlignLeft } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { attentionStatusIds } from "@/lib/task-meta";
|
||||
import { headline } from "./headline";
|
||||
import { error, summary } from "./state";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { error, summary } = storeToRefs(useTasksStore());
|
||||
|
||||
const text = computed(() => {
|
||||
const counts = summary.value?.statuses ?? {};
|
||||
@@ -16,17 +19,17 @@ const text = computed(() => {
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-6 flex flex-wrap items-center justify-between gap-4">
|
||||
<header class="mb-4 flex min-h-9 flex-wrap items-center justify-between gap-x-4 gap-y-2">
|
||||
<div class="min-w-0">
|
||||
<h1 v-if="summary" class="text-2xl font-semibold">
|
||||
<h1 v-if="summary" class="text-xl font-semibold tracking-tight">
|
||||
{{ text.running }}<span class="text-fg-subtle"> · </span
|
||||
><span :class="text.urgent && 'text-warn'">{{ text.attention }}</span>
|
||||
</h1>
|
||||
<h1 v-else class="text-2xl font-semibold">Dashboard</h1>
|
||||
<h1 v-else class="text-xl font-semibold tracking-tight">Dashboard</h1>
|
||||
<p v-if="error" class="mt-1 text-sm text-danger" role="alert">Cannot reach archied: {{ error }}</p>
|
||||
</div>
|
||||
<Button variant="outline" size="sm" as-child>
|
||||
<RouterLink to="/logs"><AlignLeft data-icon="inline-start" /> Logs</RouterLink>
|
||||
<RouterLink to="/logs"><AlignLeft data-icon="inline-start" />Logs</RouterLink>
|
||||
</Button>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
@@ -1,13 +1,16 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
import DashboardHero from "./DashboardHero.vue";
|
||||
import GatePulseCard from "./GatePulseCard.vue";
|
||||
import LiveActivityCard from "./LiveActivityCard.vue";
|
||||
import NeedsYouCard from "./NeedsYouCard.vue";
|
||||
import SetupPanel from "./SetupPanel.vue";
|
||||
import { setupPanelState } from "./setup-preference";
|
||||
import { setup, summary, useDashboard } from "./state";
|
||||
import { useDashboard } from "./state";
|
||||
import ThroughputTiles from "./ThroughputTiles.vue";
|
||||
import TokenOutlookCard from "./TokenOutlookCard.vue";
|
||||
|
||||
@@ -16,6 +19,7 @@ import TokenOutlookCard from "./TokenOutlookCard.vue";
|
||||
* column, health and spend in the rail. Composes the panels; it holds no
|
||||
* state of its own.
|
||||
*/
|
||||
const { setup, summary } = storeToRefs(useTasksStore());
|
||||
useDashboard();
|
||||
|
||||
const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "incomplete");
|
||||
@@ -23,14 +27,14 @@ const setupIncomplete = computed(() => setupPanelState(setup.value).kind === "in
|
||||
|
||||
<template>
|
||||
<DashboardHero />
|
||||
<SetupPanel v-if="setupIncomplete" class="mb-6" />
|
||||
<ThroughputTiles v-if="summary" class="mb-6" />
|
||||
<div class="grid items-start gap-6 lg:grid-cols-[minmax(0,1fr)_380px]">
|
||||
<div class="grid min-w-0 gap-6">
|
||||
<SetupPanel v-if="setupIncomplete" class="mb-4" />
|
||||
<ThroughputTiles v-if="summary" class="mb-4" />
|
||||
<div class="grid items-start gap-4 lg:grid-cols-[minmax(0,1fr)_380px]">
|
||||
<div class="grid min-w-0 gap-4">
|
||||
<NeedsYouCard />
|
||||
<LiveActivityCard v-if="summary" />
|
||||
</div>
|
||||
<div class="grid min-w-0 gap-6">
|
||||
<div class="grid min-w-0 gap-4">
|
||||
<GatePulseCard />
|
||||
<TokenOutlookCard v-if="summary" />
|
||||
</div>
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { delivered } from "@/lib/delivered";
|
||||
import { STATUS_FILL } from "@/lib/status";
|
||||
import { passBar } from "./pass-bar";
|
||||
import { workflows, type WorkflowStat } from "./state";
|
||||
import { useTasksStore, type WorkflowStat } from "@/stores/tasks";
|
||||
|
||||
const { workflows } = storeToRefs(useTasksStore());
|
||||
|
||||
/** Sharer of runs: how much of the work that finished passed its gates. */
|
||||
const stats = computed(() => workflows.value?.workflows ?? []);
|
||||
@@ -35,17 +37,11 @@ const rowBar = (stat: WorkflowStat) =>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card v-if="workflows">
|
||||
<Card v-if="workflows && totals.runs">
|
||||
<CardHeader>
|
||||
<CardTitle>Quality gates</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Empty v-if="!totals.runs">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>No completed runs yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<template v-else>
|
||||
<!--
|
||||
Two sections, read left to right: the rate on its own, and the
|
||||
per-workflow counts that explain it. Parked tasks are not listed
|
||||
@@ -91,7 +87,6 @@ const rowBar = (stat: WorkflowStat) =>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -13,7 +13,7 @@ import {
|
||||
CardTitle,
|
||||
} from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { SegmentedControl } from "@/components/ui/segmented-control";
|
||||
import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group";
|
||||
import {
|
||||
Table,
|
||||
TableBody,
|
||||
@@ -23,7 +23,7 @@ import {
|
||||
TableRow,
|
||||
} from "@/components/ui/table";
|
||||
import { ago } from "@/lib/format";
|
||||
import { useLiveUpdatesStore } from "@/stores/live-updates";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
import ActivityRow from "./ActivityRow.vue";
|
||||
import { activityDetail } from "./activity-detail";
|
||||
import {
|
||||
@@ -42,8 +42,8 @@ import { groupActivity, type ActivityGroup } from "./activity-group";
|
||||
*/
|
||||
|
||||
const router = useRouter();
|
||||
const { activity, streamKind, streamState } = storeToRefs(
|
||||
useLiveUpdatesStore(),
|
||||
const { activity } = storeToRefs(
|
||||
useSessionStore(),
|
||||
);
|
||||
|
||||
/** Which view of the feed is showing: everything, task runs, or the daemon's
|
||||
@@ -88,12 +88,9 @@ function openTask(taskID: number) {
|
||||
<CardHeader>
|
||||
<CardTitle>Live activity</CardTitle>
|
||||
<CardAction class="flex items-center gap-2">
|
||||
<SegmentedControl
|
||||
v-model="filter"
|
||||
label="Filter activity"
|
||||
:options="ACTIVITY_FILTERS"
|
||||
/>
|
||||
<Badge :variant="streamKind">{{ streamState }}</Badge>
|
||||
<ToggleGroup type="single" variant="outline" size="sm" :model-value="filter" aria-label="Filter activity" @update:model-value="(value) => { if (value) filter = value as typeof filter; }">
|
||||
<ToggleGroupItem v-for="option in ACTIVITY_FILTERS" :key="option.value" :value="option.value">{{ option.label }}</ToggleGroupItem>
|
||||
</ToggleGroup>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
|
||||
@@ -1,12 +1,17 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { StatusPill } from "@/components/ui/status-pill";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { Card, CardAction, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { attentionStatusIds, statusLabel } from "@/lib/task-meta";
|
||||
import TaskRowActions from "@/tasks/TaskRowActions.vue";
|
||||
import type { Task } from "@/tasks/TaskRow.vue";
|
||||
import { loadDashboard, tasks } from "./state";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { tasks } = storeToRefs(useTasksStore());
|
||||
const loadDashboard = useTasksStore().load;
|
||||
|
||||
/** Tasks waiting on a human, each with the reason and the next action. */
|
||||
type AttentionTask = Task & { park_reason?: string };
|
||||
@@ -17,32 +22,32 @@ const waiting = computed(() => {
|
||||
});
|
||||
|
||||
function meta(task: AttentionTask): string {
|
||||
const where = task.owner && task.repo ? `${task.owner}/${task.repo}${task.issue_number ? ` #${task.issue_number}` : ""}` : "";
|
||||
const where = task.owner && task.repo ? `${task.owner}/${task.repo}${task.issue_number && task.source !== "chat" ? ` #${task.issue_number}` : ""}` : "";
|
||||
return [where, task.workflow, task.park_reason].filter(Boolean).join(" · ");
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="rounded-lg border border-border bg-card" aria-labelledby="needs-you">
|
||||
<header class="flex items-center gap-2 border-b border-border px-5 py-3.5">
|
||||
<h2 id="needs-you" class="text-[15px] font-medium">Needs you</h2>
|
||||
<StatusPill v-if="waiting.length" tone="warn">{{ waiting.length }}</StatusPill>
|
||||
<RouterLink to="/tasks?status=needs_you" class="ml-auto text-xs text-fg-muted hover:text-foreground">All tasks</RouterLink>
|
||||
</header>
|
||||
<p v-if="tasks === null" class="px-5 py-6 text-sm text-fg-subtle">Not loaded.</p>
|
||||
<p v-else-if="!waiting.length" class="px-5 py-6 text-sm text-fg-muted">Nothing waiting.</p>
|
||||
<ul v-else class="divide-y divide-border">
|
||||
<li v-for="task in waiting" :key="task.id" class="flex flex-wrap items-center gap-3 px-5 py-3">
|
||||
<StatusPill tone="warn" class="shrink-0">{{ statusLabel(task.status ?? "") }}</StatusPill>
|
||||
<div class="min-w-0 flex-1">
|
||||
<RouterLink :to="`/tasks/${task.id}`" class="block truncate text-sm font-medium hover:underline">
|
||||
{{ task.title || `Task ${task.id}` }}
|
||||
</RouterLink>
|
||||
<p class="truncate font-mono text-xs text-fg-subtle">{{ meta(task) }}</p>
|
||||
</div>
|
||||
<Button variant="ghost" size="sm" as-child><RouterLink :to="`/tasks/${task.id}`">Open</RouterLink></Button>
|
||||
<TaskRowActions :task="task" @done="loadDashboard" />
|
||||
</li>
|
||||
</ul>
|
||||
</section>
|
||||
<Card v-if="waiting.length">
|
||||
<CardHeader>
|
||||
<CardTitle>Needs you</CardTitle>
|
||||
<CardAction>
|
||||
<Button variant="ghost" size="sm" as-child><RouterLink to="/tasks?status=needs_you">All tasks</RouterLink></Button>
|
||||
</CardAction>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<ul class="divide-y divide-border">
|
||||
<li v-for="task in waiting" :key="task.id" class="flex flex-wrap items-center gap-3 py-2">
|
||||
<Badge variant="warn">{{ statusLabel(task.status ?? "") }}</Badge>
|
||||
<div class="min-w-0 flex-1">
|
||||
<RouterLink :to="`/tasks/${task.id}`" class="block truncate font-medium hover:underline">{{
|
||||
task.title || `Task ${task.id}`
|
||||
}}</RouterLink>
|
||||
<p class="truncate font-mono text-xs text-fg-subtle">{{ meta(task) }}</p>
|
||||
</div>
|
||||
<TaskRowActions :task="task" @done="loadDashboard" />
|
||||
</li>
|
||||
</ul>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { Check } from "@lucide/vue";
|
||||
import { computed, ref, watch } from "vue";
|
||||
|
||||
@@ -11,7 +12,9 @@ import {
|
||||
} from "@/components/ui/card";
|
||||
import { Progress } from "@/components/ui/progress";
|
||||
import { setupPanelState, type SetupPanelState } from "./setup-preference";
|
||||
import { setup } from "./state";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { setup } = storeToRefs(useTasksStore());
|
||||
|
||||
/**
|
||||
* The setup checklist, rendered only while there is setup work left.
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
import { StatStrip } from "@/components/ui/stat-strip";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { delivered } from "@/lib/delivered";
|
||||
import { compact } from "@/lib/format";
|
||||
import { attentionStatusIds } from "@/lib/task-meta";
|
||||
import { summary } from "./state";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { summary } = storeToRefs(useTasksStore());
|
||||
|
||||
/** The throughput row: what is running, what needs a human, what shipped. */
|
||||
|
||||
@@ -41,5 +44,13 @@ const cells = computed(() => [
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<StatStrip :cells="cells" />
|
||||
<dl
|
||||
class="grid auto-cols-fr grid-flow-col divide-x divide-border rounded-lg border border-border bg-card max-md:grid-flow-row max-md:divide-x-0 max-md:divide-y"
|
||||
>
|
||||
<div v-for="cell in cells" :key="cell.label" class="min-w-0 px-4 py-3">
|
||||
<dt class="truncate text-xs text-fg-subtle">{{ cell.label }}</dt>
|
||||
<dd :class="cn('mt-1 truncate text-2xl font-semibold tabular-nums', cell.tone === 'warn' && 'text-warn')">{{ cell.value }}</dd>
|
||||
<dd class="mt-1 truncate text-xs text-fg-subtle">{{ cell.sub }}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</template>
|
||||
@@ -1,11 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { storeToRefs } from "pinia";
|
||||
import { computed } from "vue";
|
||||
|
||||
import SegmentBar from "@/base/SegmentBar.vue";
|
||||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { compact } from "@/lib/format";
|
||||
import { summary } from "./state";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
const { summary } = storeToRefs(useTasksStore());
|
||||
|
||||
/** What the current rate projects to over the next 30 days. */
|
||||
|
||||
@@ -23,24 +25,16 @@ const projected = computed(() => Math.round(perDay.value * 30));
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Card>
|
||||
<Card v-if="days.length">
|
||||
<CardHeader>
|
||||
<CardTitle>Token outlook</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<Empty v-if="!days.length">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Nothing spent yet</EmptyTitle>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
<template v-else>
|
||||
<div class="mb-1 text-3xl font-semibold tracking-[-0.03em]">
|
||||
{{ compact(projected) }}
|
||||
</div>
|
||||
<div class="mb-4 text-xs text-fg-subtle">
|
||||
Based on {{ compact(Math.round(perDay)) }} per day over
|
||||
{{ days.length }} days
|
||||
</div>
|
||||
<div class="mb-4 text-xs text-fg-subtle">Based on {{ compact(Math.round(perDay)) }} per day over
|
||||
{{ days.length }} days</div>
|
||||
<SegmentBar
|
||||
:segments="[
|
||||
{
|
||||
@@ -55,7 +49,6 @@ const projected = computed(() => Math.round(perDay.value * 30));
|
||||
},
|
||||
]"
|
||||
/>
|
||||
</template>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</template>
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ActivityEvent } from "./state";
|
||||
import type { ActivityEvent } from "../stores/tasks.ts";
|
||||
import { activityDetail } from "./activity-detail.ts";
|
||||
|
||||
/**
|
||||
|
||||
+6
-104
@@ -1,109 +1,11 @@
|
||||
import { onMounted, ref } from "vue";
|
||||
import { onMounted } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import type { ActivityDetailInput } from "./activity-detail";
|
||||
import type { Setup } from "./setup-preference";
|
||||
|
||||
/**
|
||||
* The dashboard's shared state.
|
||||
*
|
||||
* The health row, the throughput tiles, the token outlook and the activity
|
||||
* table all read it, and the hero's actions read the task counts, so it lives
|
||||
* in a module rather than being threaded down through a chain of props.
|
||||
*/
|
||||
|
||||
export interface Summary {
|
||||
statuses?: Record<string, number>;
|
||||
tokens_by_day?: Array<{ tokens?: number }>;
|
||||
}
|
||||
|
||||
export interface WorkflowStat {
|
||||
workflow?: string;
|
||||
runs?: number;
|
||||
merged?: number;
|
||||
completed?: number;
|
||||
pr_open?: number;
|
||||
parked?: number;
|
||||
}
|
||||
|
||||
/** An event off the live stream: the payload the detail column reads, plus
|
||||
* enough to point the row at the task it belongs to. */
|
||||
export interface ActivityEvent extends ActivityDetailInput {
|
||||
kind?: string;
|
||||
type?: string;
|
||||
task_id?: number | string;
|
||||
repo?: string;
|
||||
issue?: number | string;
|
||||
at?: string | number;
|
||||
}
|
||||
|
||||
/** A task, as far as the dashboard's links read it. */
|
||||
export interface DashboardTask {
|
||||
id: number | string;
|
||||
status?: string;
|
||||
owner?: string;
|
||||
repo?: string;
|
||||
issue_number?: number;
|
||||
}
|
||||
|
||||
export const summary = ref<Summary | null>(null);
|
||||
export const setup = ref<Setup | null>(null);
|
||||
export const workflows = ref<{ workflows?: WorkflowStat[] } | null>(null);
|
||||
// null means loading, [] means loaded.
|
||||
export const tasks = ref<DashboardTask[] | null>(null);
|
||||
export const error = ref<string | null>(null);
|
||||
|
||||
export const taskIDsBySource = ref(new Map<string, number>());
|
||||
|
||||
export async function loadDashboard(): Promise<void> {
|
||||
error.value = null;
|
||||
try {
|
||||
const [nextSummary, nextSetup, nextWorkflows, nextTasks] =
|
||||
await Promise.all([
|
||||
api.summary<Summary>(),
|
||||
api.setup<Setup>().catch(() => null),
|
||||
api.workflows<{ workflows?: WorkflowStat[] }>().catch(() => null),
|
||||
// Not defaulted to []: an empty list reads as "nothing needs you",
|
||||
// which a failed fetch must never claim.
|
||||
api.tasks<DashboardTask[]>(),
|
||||
]);
|
||||
const map = new Map<string, number>();
|
||||
for (const task of nextTasks) {
|
||||
if (task.owner && task.repo && task.issue_number) {
|
||||
map.set(
|
||||
`${task.owner}/${task.repo}#${task.issue_number}`,
|
||||
Number(task.id),
|
||||
);
|
||||
}
|
||||
}
|
||||
taskIDsBySource.value = map;
|
||||
summary.value = nextSummary;
|
||||
setup.value = nextSetup;
|
||||
workflows.value = nextWorkflows;
|
||||
tasks.value = nextTasks;
|
||||
} catch (err) {
|
||||
error.value = String((err as Error).message || err);
|
||||
}
|
||||
}
|
||||
|
||||
export function taskIDForEvent(
|
||||
event: ActivityEvent,
|
||||
bySource: Map<string, number>,
|
||||
): number {
|
||||
if (Number(event.task_id) > 0) return Number(event.task_id);
|
||||
if (!event.repo || !event.issue) return 0;
|
||||
return Number(bySource.get(`${event.repo}#${event.issue}`)) || 0;
|
||||
}
|
||||
|
||||
/** The task an activity row opens, or 0. An event carries the id, or a
|
||||
* repo/issue pair the task list resolves. */
|
||||
export function taskIDFor(event: ActivityEvent): number {
|
||||
return taskIDForEvent(event, taskIDsBySource.value);
|
||||
}
|
||||
import { useLiveResource } from "@/stores/session";
|
||||
import { useTasksStore } from "@/stores/tasks";
|
||||
|
||||
/** Owns the initial fetch and the event stream for the page's lifetime. */
|
||||
export function useDashboard(): void {
|
||||
useLiveResource("tasks", () => void loadDashboard(), 500);
|
||||
onMounted(loadDashboard);
|
||||
const store = useTasksStore();
|
||||
useLiveResource("tasks", () => void store.load(), 500);
|
||||
onMounted(store.load);
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
import { StatusPill } from "@/components/ui/status-pill";
|
||||
import { Badge } from "@/components/ui/badge";
|
||||
import { enabled as captureEnabled, loading as captureLoading } from "@/captures/state";
|
||||
import { computed, onMounted, ref, watch, type Component } from "vue";
|
||||
import { ArrowRight } from "@lucide/vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
|
||||
import {
|
||||
Select,
|
||||
SelectContent,
|
||||
@@ -15,16 +15,16 @@ import {
|
||||
SelectTrigger,
|
||||
SelectValue,
|
||||
} from "@/components/ui/select";
|
||||
import { homeOrg, loadOrg, type OrgWorkspace } from "@/org/org";
|
||||
import type { OrgWorkspace } from "@/org/org";
|
||||
import { useEventsStore } from "@/stores/events";
|
||||
import { useOrgStore } from "@/stores/org";
|
||||
import BindingsPage from "@/bindings/BindingsPage.vue";
|
||||
import CapturesPage from "@/captures/CapturesPage.vue";
|
||||
import { sections } from "@/lib/capabilities";
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveResource } from "@/stores/live-updates";
|
||||
import { useLiveResource, useSessionStore } from "@/stores/session";
|
||||
import MappingsPage from "@/mappings/MappingsPage.vue";
|
||||
import { activeTab, availableTabs, stepsFor } from "./tab-selection";
|
||||
import { loadEventCounts, type EventsCounts } from "./counts";
|
||||
import { eventsWorkspace } from "./workspace";
|
||||
|
||||
/**
|
||||
* The Events surfaces: what arrived, how its fields are read, and which workflow
|
||||
@@ -54,8 +54,11 @@ const PANELS: Record<string, Component> = {
|
||||
|
||||
const route = useRoute();
|
||||
const router = useRouter();
|
||||
const orgStore = useOrgStore();
|
||||
const events = useEventsStore();
|
||||
|
||||
const tabs = computed(() => availableTabs(sections.value));
|
||||
const session = useSessionStore();
|
||||
const tabs = computed(() => availableTabs(session.sections));
|
||||
const active = computed(() =>
|
||||
activeTab(String(route.query.tab ?? ""), tabs.value),
|
||||
);
|
||||
@@ -77,7 +80,7 @@ watch(active, (tab) => show(tab), { immediate: true });
|
||||
// read one source rather than three.
|
||||
const counts = ref<EventsCounts>({});
|
||||
async function loadCounts() {
|
||||
const workspace = eventsWorkspace.value;
|
||||
const workspace = events.workspace;
|
||||
counts.value = await loadEventCounts({
|
||||
captures: api.captures,
|
||||
mappings: () => api.mappings(workspace),
|
||||
@@ -94,7 +97,7 @@ const workspaces = ref<OrgWorkspace[]>([]);
|
||||
watch(
|
||||
() => String(route.query.workspace ?? ""),
|
||||
(workspace) => {
|
||||
eventsWorkspace.value = workspace;
|
||||
events.workspace = workspace;
|
||||
void loadCounts();
|
||||
},
|
||||
{ immediate: true },
|
||||
@@ -105,9 +108,9 @@ function pickWorkspace(value: unknown): void {
|
||||
}
|
||||
onMounted(async () => {
|
||||
try {
|
||||
await loadOrg();
|
||||
await orgStore.loadOrg();
|
||||
workspaces.value = (
|
||||
await api.orgWorkspaces<{ workspaces: OrgWorkspace[] }>(homeOrg.value)
|
||||
await api.orgWorkspaces<{ workspaces: OrgWorkspace[] }>(orgStore.homeOrg)
|
||||
).workspaces;
|
||||
} catch {
|
||||
// Without the list there is nothing to pick; every workspace shows.
|
||||
@@ -127,7 +130,7 @@ const panel = computed(() => PANELS[active.value]);
|
||||
<PageHeader title="Events">
|
||||
<Select
|
||||
v-if="workspaces.length > 1"
|
||||
:model-value="eventsWorkspace || ALL"
|
||||
:model-value="events.workspace || ALL"
|
||||
@update:model-value="pickWorkspace"
|
||||
>
|
||||
<SelectTrigger size="sm" aria-label="Show records from workspace">
|
||||
@@ -143,32 +146,23 @@ const panel = computed(() => PANELS[active.value]);
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<template v-if="!captureLoading">
|
||||
<StatusPill v-if="captureEnabled" dot="live">Listening</StatusPill>
|
||||
<StatusPill v-else>Capture off</StatusPill>
|
||||
<Badge v-if="!captureEnabled" variant="warn">Capture off</Badge>
|
||||
</template>
|
||||
</PageHeader>
|
||||
<ol class="mb-6 grid grid-cols-1 overflow-hidden rounded-lg border border-border bg-card sm:grid-cols-3" aria-label="How events become work">
|
||||
<li v-for="(step, i) in steps" :key="step.id" class="relative border-border not-last:border-b sm:not-last:border-r sm:not-last:border-b-0">
|
||||
<button
|
||||
type="button"
|
||||
class="flex w-full items-center gap-3 px-5 py-4 text-left transition-colors hover:bg-secondary"
|
||||
:class="active === step.id && 'bg-secondary'"
|
||||
:aria-current="active === step.id ? 'step' : undefined"
|
||||
@click="show(step.id)"
|
||||
<Tabs :model-value="active" class="mb-4" @update:model-value="show">
|
||||
<TabsList variant="line" class="w-full justify-start" aria-label="How events become work">
|
||||
<TabsTrigger
|
||||
v-for="step in steps"
|
||||
:key="step.id"
|
||||
:value="step.id"
|
||||
:title="`${counts[step.id] ?? 0} ${step.hint}`"
|
||||
class="flex-none px-3"
|
||||
>{{ step.label }}<span class="font-mono text-xs text-fg-subtle">{{ counts[step.id] ?? "" }}</span></TabsTrigger
|
||||
>
|
||||
<span class="grid size-7 shrink-0 place-items-center rounded-full border border-border-strong font-mono text-xs text-fg-muted">{{ i + 1 }}</span>
|
||||
<span class="min-w-0 flex-1">
|
||||
<span class="block text-sm font-medium">{{ step.label }}</span>
|
||||
<span class="block text-xs text-fg-subtle">
|
||||
<span class="font-mono">{{ counts[step.id] ?? "–" }}</span> {{ step.hint }}
|
||||
</span>
|
||||
</span>
|
||||
<ArrowRight v-if="i < steps.length - 1" class="size-4 text-fg-subtle max-sm:hidden" aria-hidden="true" />
|
||||
</button>
|
||||
</li>
|
||||
</ol>
|
||||
</TabsList>
|
||||
</Tabs>
|
||||
|
||||
<component :is="panel" v-if="panel" :key="`${active}:${eventsWorkspace}`" />
|
||||
<component :is="panel" v-if="panel" :key="`${active}:${events.workspace}`" />
|
||||
<Empty v-else>
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Event automation is not enabled</EmptyTitle>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { ref } from "vue";
|
||||
|
||||
/**
|
||||
* The workspace the Events pages list records from and create sources in.
|
||||
* Empty lists every workspace and creates in the org's default one. Event
|
||||
* types and bindings take their source's workspace, mappings their event
|
||||
* type's, so the source is the one record this picks for.
|
||||
*/
|
||||
export const eventsWorkspace = ref("");
|
||||
@@ -1,4 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { NativeSelect, NativeSelectOption } from "@/components/ui/native-select";
|
||||
/**
|
||||
* Harness: the OAuth credential bindings a Kit profile resolves, and the
|
||||
* setup terminal that captures a binding's tokens
|
||||
@@ -118,41 +119,33 @@ function scopes(binding: HarnessBinding): string {
|
||||
<Empty v-else-if="unconfigured">
|
||||
<EmptyHeader>
|
||||
<EmptyTitle>Harness bindings are not configured</EmptyTitle>
|
||||
<EmptyDescription>
|
||||
This process cannot read credential bindings or captured OAuth tokens.
|
||||
</EmptyDescription>
|
||||
<EmptyDescription>This process cannot read credential bindings or captured OAuth tokens.</EmptyDescription>
|
||||
</EmptyHeader>
|
||||
</Empty>
|
||||
|
||||
<template v-else-if="state">
|
||||
<Alert v-if="!state.terminal" class="mb-4">
|
||||
<AlertTitle>Setup terminal unavailable</AlertTitle>
|
||||
<AlertDescription>
|
||||
This process cannot open a Kit container. Bindings are still listed
|
||||
below.
|
||||
</AlertDescription>
|
||||
<AlertDescription>This process cannot open a Kit container. Bindings are still listed
|
||||
below.</AlertDescription>
|
||||
</Alert>
|
||||
|
||||
<Card v-else class="mb-4">
|
||||
<CardContent class="flex flex-wrap items-end gap-3">
|
||||
<label class="flex flex-col gap-1 text-sm">
|
||||
<span class="text-muted-foreground">Kit profile</span>
|
||||
<select
|
||||
v-model="profile"
|
||||
class="h-9 min-w-48 rounded-md border border-input bg-background px-2 text-sm"
|
||||
<NativeSelect
|
||||
size="sm"
|
||||
v-model="profile" class="min-w-48"
|
||||
:disabled="!state.profiles.length"
|
||||
>
|
||||
<option v-if="!state.profiles.length" value="">
|
||||
No Kit profiles configured
|
||||
</option>
|
||||
<option v-for="name in state.profiles" :key="name" :value="name">
|
||||
<NativeSelectOption v-if="!state.profiles.length" value="">No Kit profiles configured</NativeSelectOption>
|
||||
<NativeSelectOption v-for="name in state.profiles" :key="name" :value="name">
|
||||
{{ name }}
|
||||
</option>
|
||||
</select>
|
||||
</NativeSelectOption>
|
||||
</NativeSelect>
|
||||
</label>
|
||||
<Button :disabled="!profile" @click="openTerminal">
|
||||
Open setup terminal
|
||||
</Button>
|
||||
<Button :disabled="!profile" @click="openTerminal">Open setup terminal</Button>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -176,9 +169,7 @@ function scopes(binding: HarnessBinding): string {
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-if="!state.bindings.length">
|
||||
<TableCell colspan="5" class="text-muted-foreground">
|
||||
No credential bindings are configured.
|
||||
</TableCell>
|
||||
<TableCell colspan="5" class="text-muted-foreground">No credential bindings are configured.</TableCell>
|
||||
</TableRow>
|
||||
<TableRow v-for="binding in state.bindings" :key="binding.service">
|
||||
<TableCell class="font-medium">{{ binding.service }}</TableCell>
|
||||
|
||||
@@ -194,6 +194,13 @@ export const api = {
|
||||
alerts: <T = unknown>() => request<T>("/api/alerts"),
|
||||
dismissAlert: (id: number) =>
|
||||
request<void>(`/api/alerts/${id}/dismiss`, { method: "POST", parse: false }),
|
||||
identities: <T = unknown>() => request<T>("/api/identities"),
|
||||
identityCreate: <T = unknown>(identity: { display_name: string; kind: string }) =>
|
||||
request<T>("/api/identities", { method: "POST", body: identity }),
|
||||
// identityCommand runs one lifecycle command (rename, suspend, reactivate,
|
||||
// retire) against the version the caller last read.
|
||||
identityCommand: <T = unknown>(id: string, command: string, body: { expected_version: number; display_name: string }) =>
|
||||
request<T>(`/api/identities/${encodeURIComponent(id)}/${encodeURIComponent(command)}`, { method: "POST", body }),
|
||||
summary: <T = unknown>() => request<T>("/api/summary"),
|
||||
tasks: <T = unknown>() => request<T>("/api/tasks"),
|
||||
// taskPage reads one page of the board; next is the cursor for the page
|
||||
|
||||
@@ -5,10 +5,6 @@
|
||||
// "disabled" marker, a 501 -- which the browser cannot tell from a quiet
|
||||
// deployment. GET /api/capabilities says which sections are backed here, and
|
||||
// the nav drops the rest.
|
||||
import { ref } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { routes } from "@/router";
|
||||
|
||||
/** The `sections` map GET /api/capabilities returns. */
|
||||
export type CapabilitySections = Record<string, boolean>;
|
||||
@@ -24,21 +20,6 @@ export interface SectionedRoute {
|
||||
meta?: { section?: string };
|
||||
}
|
||||
|
||||
/** hidden lists the route paths this composition cannot serve. */
|
||||
export const hidden = ref<string[]>([]);
|
||||
|
||||
/**
|
||||
* sections is the server's raw map, where `hidden` is that map already applied
|
||||
* to this route table. A surface that owns several capabilities rather than one
|
||||
* -- the Events page, whose tabs are separately backable -- reads this to decide
|
||||
* which parts of itself it can serve.
|
||||
*
|
||||
* Null means nothing has been reported (an older server, a failed read), and
|
||||
* every surface stays visible: a page that says "unavailable" is recoverable,
|
||||
* one that silently vanished is not.
|
||||
*/
|
||||
export const sections = ref<CapabilitySections | null>(null);
|
||||
|
||||
// hiddenRoutes returns the paths whose section the server reported it cannot
|
||||
// serve. An unreported section stays visible: a page that says "unavailable"
|
||||
// is recoverable, a navigation entry that silently vanished is not, so an
|
||||
@@ -56,20 +37,3 @@ export function hiddenRoutes(
|
||||
)
|
||||
.map((r) => r.path);
|
||||
}
|
||||
|
||||
/**
|
||||
* loadCapabilities asks once, after the shell is up: the nav paints immediately
|
||||
* and loses what this process cannot back a moment later, rather than holding
|
||||
* the page behind a request. A failed read hides nothing.
|
||||
*/
|
||||
export async function loadCapabilities(): Promise<void> {
|
||||
try {
|
||||
const body = await api.capabilities<{
|
||||
sections?: CapabilitySections;
|
||||
} | null>();
|
||||
sections.value = body?.sections ?? null;
|
||||
hidden.value = hiddenRoutes(body?.sections, routes as SectionedRoute[]);
|
||||
} catch {
|
||||
// Offline or an older server: every section stays visible.
|
||||
}
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
import type { StreamState } from "./stream-state";
|
||||
|
||||
export type ConnectionState = StreamState | "connecting";
|
||||
|
||||
/** What the UI calls the live stream's state, and the tone it is shown in. */
|
||||
export function connectionStatus(state: ConnectionState): {
|
||||
label: string;
|
||||
tone: "ok" | "warn" | "danger";
|
||||
} {
|
||||
if (state === "live") return { label: "Connected", tone: "ok" };
|
||||
if (state === "unavailable") return { label: "Disconnected", tone: "danger" };
|
||||
return { label: "Connecting", tone: "warn" };
|
||||
}
|
||||
@@ -4,7 +4,6 @@ export interface NavEntry {
|
||||
description: string;
|
||||
section?: string;
|
||||
dividerBefore?: string;
|
||||
soon?: boolean;
|
||||
}
|
||||
|
||||
export interface NavLink {
|
||||
@@ -26,7 +25,6 @@ export interface NavRoute {
|
||||
label?: string;
|
||||
description?: string;
|
||||
section?: string;
|
||||
soon?: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
@@ -58,7 +56,6 @@ export function buildNav(
|
||||
label: route.meta?.label ?? path,
|
||||
description: route.meta?.description ?? "",
|
||||
section: route.meta?.section,
|
||||
soon: route.meta?.soon,
|
||||
};
|
||||
};
|
||||
const visible = (path: string) => !hidden.includes(path);
|
||||
|
||||
+6
-1
@@ -1,4 +1,5 @@
|
||||
import { routes } from "@/router";
|
||||
import { hiddenRoutes, type CapabilitySections } from "./capabilities";
|
||||
import {
|
||||
buildNav,
|
||||
type NavNode,
|
||||
@@ -13,7 +14,6 @@ interface NavRouteNode extends NavRoute {
|
||||
label?: string;
|
||||
description?: string;
|
||||
section?: string;
|
||||
soon?: boolean;
|
||||
navPath?: string;
|
||||
};
|
||||
children?: NavRouteNode[];
|
||||
@@ -89,6 +89,11 @@ const settings: NavSpec = {
|
||||
// Jump to, but not from the bar.
|
||||
const unlisted = ["/logs"];
|
||||
|
||||
/** hiddenPaths lists the routes this composition cannot back. */
|
||||
export function hiddenPaths(sections: CapabilitySections | null): string[] {
|
||||
return hiddenRoutes(sections, table);
|
||||
}
|
||||
|
||||
export function navTree(hidden: string[] = []): NavNode[] {
|
||||
return buildNav(table, specs, hidden).tree;
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
import { computed, shallowRef } from "vue";
|
||||
|
||||
import { api } from "./api";
|
||||
import type { StatusKind } from "./status";
|
||||
|
||||
import {
|
||||
type ActionMeta,
|
||||
@@ -83,8 +84,8 @@ export function statusLabel(id: string): string {
|
||||
}
|
||||
|
||||
/** statusKind is the pill severity token (idle, info, ok, warn, danger). */
|
||||
export function statusKind(id: string): string {
|
||||
return statusById.value.get(id)?.kind || "idle";
|
||||
export function statusKind(id: string): StatusKind {
|
||||
return (statusById.value.get(id)?.kind || "idle") as StatusKind;
|
||||
}
|
||||
|
||||
/** statusList returns every known lifecycle status in display order. */
|
||||
|
||||
@@ -14,6 +14,6 @@ import { meta, streamKind, streamState } from "./state";
|
||||
<span class="min-w-0 break-words font-mono text-xs text-fg-subtle">{{
|
||||
meta
|
||||
}}</span>
|
||||
<Badge :variant="streamKind">{{ streamState }}</Badge>
|
||||
<Badge v-if="streamKind !== 'ok'" :variant="streamKind">{{ streamState }}</Badge>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,12 +0,0 @@
|
||||
<script setup lang="ts">
|
||||
import LogActions from "./LogActions.vue";
|
||||
|
||||
/** The page's title and what belongs beside it. */
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="mb-5 flex flex-wrap items-start justify-between gap-5">
|
||||
<h1 class="text-3xl font-semibold tracking-[-0.03em]">Logs</h1>
|
||||
<LogActions />
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,5 +1,6 @@
|
||||
<script setup lang="ts">
|
||||
import LogsHeader from "./LogsHeader.vue";
|
||||
import PageHeader from "@/base/PageHeader.vue";
|
||||
import LogActions from "./LogActions.vue";
|
||||
import LogStream from "./LogStream.vue";
|
||||
import { useLogs } from "./state";
|
||||
|
||||
@@ -7,6 +8,8 @@ useLogs();
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<LogsHeader />
|
||||
<PageHeader title="Logs">
|
||||
<LogActions />
|
||||
</PageHeader>
|
||||
<LogStream />
|
||||
</template>
|
||||
@@ -1,7 +1,7 @@
|
||||
import { computed, onMounted, onUnmounted, reactive, ref, watch } from "vue";
|
||||
|
||||
import { api } from "@/lib/api";
|
||||
import { useLiveUpdatesStore } from "@/stores/live-updates";
|
||||
import { useSessionStore } from "@/stores/session";
|
||||
import type { LogEntry } from "@/lib/log";
|
||||
import type { StatusKind } from "@/lib/status";
|
||||
import type { StreamState } from "@/lib/stream-state";
|
||||
@@ -152,7 +152,7 @@ let unsubscribe: (() => void) | undefined;
|
||||
/** Owns the initial read, the re-reads a filter change causes, and the live
|
||||
* stream, for the page's lifetime. */
|
||||
export function useLogs(): void {
|
||||
const live = useLiveUpdatesStore();
|
||||
const live = useSessionStore();
|
||||
onMounted(() => {
|
||||
// A mount opens a new stream against a fresh read, so the tail starts
|
||||
// unpaused, connecting, and without the lines the previous visit's stream
|
||||
|
||||
Loaded 100 of 209 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user