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.
66 lines
2.4 KiB
Vue
66 lines
2.4 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
|
|
import { fieldTypeFromValue, pathAppendIndex, pathAppendKey, type FieldPick } from "./mapping-fields";
|
|
|
|
/**
|
|
* One level of a captured payload, with every key and every leaf clickable, so
|
|
* a field is bound by clicking through the real payload rather than by typing a
|
|
* JSON path -- "click through its payload, bind JSON paths" per
|
|
* docs/prds/payload-field-mapping.md. Recurses into itself for child objects
|
|
* and arrays, so depth costs nothing to support.
|
|
*
|
|
* A key is clickable in its own right: binding `data` whole is a legitimate
|
|
* choice, and the type is inferred from whatever that node happens to hold.
|
|
*/
|
|
const props = withDefaults(defineProps<{ value: unknown; path?: string; name?: string }>(), { path: "", name: "" });
|
|
const emit = defineEmits<{ pick: [pick: FieldPick] }>();
|
|
|
|
const isBranch = computed(() => props.value !== null && typeof props.value === "object");
|
|
|
|
/** This level's children, each with the path that addresses it. */
|
|
const entries = computed<Array<{ key: string; value: unknown; path: string }>>(() => {
|
|
if (!isBranch.value) return [];
|
|
if (Array.isArray(props.value)) {
|
|
return props.value.map((child, index) => ({
|
|
key: String(index),
|
|
value: child,
|
|
path: pathAppendIndex(props.path, index),
|
|
}));
|
|
}
|
|
return Object.entries(props.value as Record<string, unknown>).map(([key, child]) => ({
|
|
key,
|
|
value: child,
|
|
path: pathAppendKey(props.path, key),
|
|
}));
|
|
});
|
|
|
|
function pick(path: string, key: string, value: unknown): void {
|
|
emit("pick", { path, type: fieldTypeFromValue(value), name: key });
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<ul v-if="isBranch" class="flex list-none flex-col gap-0.5 pl-4 font-mono text-xs">
|
|
<li v-for="entry in entries" :key="entry.path">
|
|
<button
|
|
type="button"
|
|
class="focus-visible:ring-ring rounded-sm px-1 text-left outline-none hover:bg-muted focus-visible:ring-2"
|
|
@click="pick(entry.path, entry.key, entry.value)"
|
|
>
|
|
{{ entry.key }}
|
|
</button>
|
|
<PayloadTree :value="entry.value" :path="entry.path" :name="entry.key" @pick="emit('pick', $event)" />
|
|
</li>
|
|
</ul>
|
|
|
|
<button
|
|
v-else
|
|
type="button"
|
|
class="focus-visible:ring-ring ml-1 rounded-sm px-1 text-fg-subtle outline-none hover:bg-muted focus-visible:ring-2"
|
|
@click="pick(path, name, value)"
|
|
>
|
|
{{ JSON.stringify(value) }}
|
|
</button>
|
|
</template>
|