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:
@@ -9,7 +9,7 @@
|
||||
// boundaries for the same two underlying concepts (a used/limit ratio,
|
||||
// a success rate) the rest of this panel already colors consistently.
|
||||
import { providerRateStatus, providerSuccessRate } from '@/lib/provider-rate'
|
||||
import { MICROS_PER_USD, ratioTier } from '@/lib/usage-bars'
|
||||
import { ratioTier, usdToMicros } from '@/lib/usage-bars'
|
||||
import type { AdminGroupView, AdminProviderView } from '@/types/api'
|
||||
|
||||
/** KpiTier is KpiTile.vue's own three-color scale — 'ok' (normal), 'warn' (approaching a limit / minor degradation), 'critical' (over a limit / severe degradation). */
|
||||
@@ -27,7 +27,7 @@ export function sumGroupBudgetMicros(groups: AdminGroupView[]): number {
|
||||
let total = 0
|
||||
for (const group of groups) {
|
||||
const limitUsd = group.limits?.costPerMonthUSD
|
||||
if (limitUsd && limitUsd > 0) total += Math.round(limitUsd * MICROS_PER_USD)
|
||||
if (limitUsd && limitUsd > 0) total += usdToMicros(limitUsd)
|
||||
}
|
||||
return total
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user