mirror of
https://github.com/lukaszraczylo/traefik-llmgateway.git
synced 2026-11-26 10:06:31 +00:00
refactor(webui): extract repeated dashboard elements into shared components
Markup and helpers that were copied between pages now live in one place: - ChartCard, StatDisabledAlert, StatItem, DetailField, BudgetRatioBars, LabeledSelect, TargetPicker and LoadStateView components - lib/scope.ts, lib/columns.ts and lib/chart-palette.ts - messageOf, isAuthRejection, and the USD to micro-USD conversion helpers - one monthly cost projection, one date formatter, and the useCopyFeedback composable Behaviour is unchanged. Before and after screenshots of every page match at 390 and 1440 px. Empty-state text now comes from the shared EmptyState component, and the user run-out date uses the short date format. admin_assets_gen.go is regenerated. Claude-Session: https://claude.ai/code/session_01V5jYJNxpDFdJkyyExpADrv
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<script setup lang="ts">
|
||||
/**
|
||||
* DetailField (reuse-audit.md F6) is the ONE `dt`/`dd` detail-field pair
|
||||
* every accordion/expanded-row detail grid in this panel used to hand-
|
||||
* roll: a small muted `dt` label (`labelTitle` for a hint on the LABEL
|
||||
* itself, e.g. the glob-pattern hint on a group's Providers/Models/MCP
|
||||
* servers/Agents fields) and a `dd` for the value (default slot) —
|
||||
* `numeric` adds `tabular-nums` to the `dd` for a figure that should align
|
||||
* in a monospaced-digit grid. `inheritAttrs: false` + `v-bind="$attrs"` on
|
||||
* the `dd` (not the root `div`) forwards any other attribute a caller
|
||||
* passes straight onto the VALUE element — a conditional `class` (e.g. a
|
||||
* destructive rejected-count) or `title` (e.g. a "projected to exceed"
|
||||
* tooltip) lands on the same element it did before this extraction, never
|
||||
* on the label.
|
||||
*/
|
||||
defineOptions({ inheritAttrs: false })
|
||||
|
||||
withDefaults(
|
||||
defineProps<{
|
||||
label: string
|
||||
labelTitle?: string
|
||||
numeric?: boolean
|
||||
}>(),
|
||||
{ labelTitle: undefined, numeric: false },
|
||||
)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
<dt class="text-xs text-muted-foreground" :title="labelTitle">{{ label }}</dt>
|
||||
<dd v-bind="$attrs" :class="numeric ? 'tabular-nums' : undefined">
|
||||
<slot />
|
||||
</dd>
|
||||
</div>
|
||||
</template>
|
||||
Reference in New Issue
Block a user