feat(webui): port the dashboard (Phases 3-5)
Every page from the deleted Preact dashboard, rebuilt in Vue 3 + shadcn-vue.
The navigation restructure landed earlier on this branch; this is the surfaces
behind it, and the two are now one app.
Dashboard, Tasks (list and detail), Configuration split six ways, Logs,
Inspector, Mappings, Bindings, Workflows, Skills, Curators, Channels, chat.
Components, not files: docs/prds/dashboard-port-brief.md requires one
component, one job, one file, with shared state in a module beside it. So a
page file composes and holds nothing, and a shape repeated across panes becomes
its own component (LogRow, PageHeader, PanelLoading, WorkflowBar).
Behaviour that had to survive, because each was a fix:
- Live activity's detail is clamped to one line with the payload on the title.
Unclamped, one row made the dashboard 7,481px tall.
- Each health card takes its own height. Equalising left a mostly-empty box
taking a quarter of the first screen once setup was done.
- Tasks: `tab`/`attempt` live in the query string and are written with
router.replace, so a tab click adds no history entry and does not remount.
The list's deep-link reveal honours prefers-reduced-motion.
- LOG_LEVELS is a wire contract (the server matches that CSV server-side), used
unchanged by both log panes.
- The chat panel's Phase 5 list: a FAB that is the only toggle, a morph whose
scale, radius and position interpolate together, no scrim, no close button,
Escape returning focus to the launcher, Stop only while streaming.
- Unconfigured is not broken. A 501 on /api/version or the log stream renders
what is true ("Not configured on this deployment") rather than blank, and a
read-only Configuration says so instead of offering controls that cannot work.
Three things the port decided rather than carried:
- Button gains an `attention` variant and Badge the five status tones, in the
project's own cva. The pill's dot did not come across: the Badge's shape is
the affordance, and the same tone now covers a trend indicator.
- The icon module is not ported. Its name-to-glyph lookup is the pattern
shadcn-vue's rules call out as wrong, so icons come from @lucide/vue at the
call site. The five bespoke glyphs have no consumer yet and become components
if a page draws them.
- The theme control left the topbar for /system/appearance, per the approved
navigation design. ThemeToggle.vue and Placeholder.vue are deleted rather
than orphaned: every route now resolves to a real page.
Also fixes the bundle freshness check failing on the first build after every
change. ui/dist is committed, so nothing ignores it and Tailwind's content
detection scanned it, making each build an input to the next.
This commit is contained in:
1 parent
5fe25045d1
commit
b9daa01b4b
276 files changed
+12888
-563
No files matched your search
@@ -0,0 +1,87 @@
|
||||
<script setup lang="ts">
|
||||
import { computed, ref, watch } from "vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { ScrollArea } from "@/components/ui/scroll-area";
|
||||
import ChatBubble from "./ChatBubble.vue";
|
||||
import ChatEmptyState from "./ChatEmptyState.vue";
|
||||
import { messages, sendMessage, streamingTurn, type ChatMessage } from "./state";
|
||||
|
||||
/**
|
||||
* The conversation: the messages so far, the turn still arriving, and what the
|
||||
* panel says before either exists. It scrolls itself to the newest line, so a
|
||||
* streamed answer stays in view as it grows.
|
||||
*/
|
||||
const emit = defineEmits<{ prompt: [text: string] }>();
|
||||
|
||||
const scroller = ref<{ $el: HTMLElement } | null>(null);
|
||||
|
||||
function parts(message: ChatMessage) {
|
||||
const from = message.from ?? message.From ?? "";
|
||||
// Anything this browser's composer did not send is Archie's answer.
|
||||
return {
|
||||
text: message.text ?? message.Text ?? "",
|
||||
tools: message.tool_calls || message.ToolCalls || [],
|
||||
assistant: from !== "web",
|
||||
};
|
||||
}
|
||||
|
||||
const bubbles = computed(() => messages.value.map(parts));
|
||||
|
||||
// ScrollArea renders its own scrollable element, so the way to follow the tail
|
||||
// is to reach into the component for it. Asking the wrapper instead would set
|
||||
// scrollTop on a box that does not scroll.
|
||||
function viewport(): HTMLElement | null {
|
||||
return scroller.value?.$el?.querySelector<HTMLElement>('[data-slot="scroll-area-viewport"]') ?? null;
|
||||
}
|
||||
|
||||
// Auto scroll to the bottom on a new message or a streamed token. flush: 'post'
|
||||
// measures after the new content is in the DOM; measuring before that reads the
|
||||
// height the transcript is about to replace.
|
||||
watch(
|
||||
[messages, streamingTurn],
|
||||
() => {
|
||||
const el = viewport();
|
||||
if (el) el.scrollTop = el.scrollHeight;
|
||||
},
|
||||
{ flush: "post" },
|
||||
);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<ScrollArea ref="scroller" class="min-h-0 flex-1">
|
||||
<div class="grid content-start gap-4 p-4">
|
||||
<ChatEmptyState v-if="!bubbles.length && !streamingTurn" @prompt="emit('prompt', $event)" />
|
||||
|
||||
<template v-else>
|
||||
<ChatBubble
|
||||
v-for="(bubble, i) in bubbles"
|
||||
:key="i"
|
||||
:text="bubble.text"
|
||||
:tools="bubble.tools"
|
||||
:assistant="bubble.assistant"
|
||||
/>
|
||||
|
||||
<!-- The live turn is a bubble like any other, so what arrives is
|
||||
rendered by the same rules as what was already there. -->
|
||||
<ChatBubble
|
||||
v-if="streamingTurn"
|
||||
:text="streamingTurn.text || '…'"
|
||||
:tools="streamingTurn.tools"
|
||||
assistant
|
||||
streaming
|
||||
>
|
||||
<Button
|
||||
v-if="streamingTurn.isError && streamingTurn.turn"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
class="mt-2"
|
||||
@click="sendMessage({ turn: streamingTurn.turn })"
|
||||
>
|
||||
Retry
|
||||
</Button>
|
||||
</ChatBubble>
|
||||
</template>
|
||||
</div>
|
||||
</ScrollArea>
|
||||
</template>
|
||||
Reference in new issue
Block a user