Files
traefik-llmgateway/webui/src/components/BudgetRatioBars.vue
lukaszraczylo 2608e01c50 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
2026-09-24 06:04:46 +01:00

27 lines
1.0 KiB
Vue

<script setup lang="ts">
import UsageBar from '@/components/UsageBar.vue'
import { BUDGET_RATIO_LABEL, budgetValueText } from '@/lib/usage-bars'
import type { BudgetRatio } from '@/lib/usage-bars'
/**
* BudgetRatioBars (reuse-audit.md F7) is the ONE budget-ratio bar row —
* one labelled UsageBar per configured limit — UserDetail.vue's Headroom
* card and ConsumerDirectory.vue's group accordion both hand-rolled: a
* label (BUDGET_RATIO_LABEL) beside each lib/usage-bars.ts budgetRatios()
* entry, its UsageBar sized to that ratio, and its "used / limit" text
* (the shared budgetValueText).
*/
defineProps<{
ratios: BudgetRatio[]
}>()
</script>
<template>
<div class="flex flex-wrap items-center gap-x-4 gap-y-1.5">
<span v-for="ratio in ratios" :key="ratio.id" class="inline-flex items-center gap-1.5 text-xs text-muted-foreground">
{{ BUDGET_RATIO_LABEL[ratio.id] }}
<UsageBar :ratio="ratio.ratio" :label="BUDGET_RATIO_LABEL[ratio.id]" :value-text="budgetValueText(ratio)" />
</span>
</div>
</template>