feat(webui): enhance server configuration and dynamic dashboard analytics

This commit is contained in:
Wha1eChai
2026-01-08 22:15:03 +08:00
parent 217053839f
commit a7aacdb0ae
2 changed files with 202 additions and 163 deletions

View File

@@ -1,57 +1,60 @@
<div x-data="dashboard" class="view-container"> <div x-data="dashboard" class="view-container">
<!-- Stats Grid --> <!-- Stats Grid -->
<div class="grid grid-cols-1 md:grid-cols-4 gap-6"> <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-4 gap-4 md:gap-6">
<div <div
class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-6 hover:border-space-border/60 transition-colors group"> class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-4 hover:border-space-border/60 transition-colors group relative">
<div class="stat-figure text-neon-cyan group-hover:scale-110 transition-transform"> <!-- Icon 移到右上角,缩小并变灰 -->
<div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-gray-600/60 transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-8 h-8 stroke-current"> class="w-5 h-5 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0z"> d="M17 20h5v-2a3 3 0 00-5.356-1.857M17 20H7m10 0v-2c0-.656-.126-1.283-.356-1.857M7 20H2v-2a3 3 0 015.356-1.857M7 20v-2c0-.656.126-1.283.356-1.857m0 0a5.002 5.002 0 019.288 0M15 7a3 3 0 11-6 0 3 3 0 016 0zm6 3a2 2 0 11-4 0 2 2 0 014 0z">
</path> </path>
</svg> </svg>
</div> </div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider" <!-- 数字放大为主角 -->
<div class="stat-value text-white font-mono text-4xl font-bold mb-1" x-text="stats.total"></div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider truncate"
x-text="$store.global.t('totalAccounts')"></div> x-text="$store.global.t('totalAccounts')"></div>
<div class="stat-value text-white font-mono text-3xl" x-text="stats.total"></div> <div class="stat-desc text-gray-600 text-[10px] truncate" x-text="$store.global.t('registeredNodes')">Registered
<div class="stat-desc text-gray-600 text-[10px] mt-1" x-text="$store.global.t('registeredNodes')">Registered Nodes</div> Nodes</div>
</div> </div>
<div <div
class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-6 hover:border-space-border/60 transition-colors group"> class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-4 hover:border-space-border/60 transition-colors group relative">
<div class="stat-figure text-neon-green group-hover:scale-110 transition-transform"> <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-neon-green/50 transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-8 h-8 stroke-current"> class="w-5 h-5 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path> d="M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg> </svg>
</div> </div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider" <div class="stat-value text-white font-mono text-4xl font-bold mb-1" x-text="stats.active"></div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider truncate"
x-text="$store.global.t('active')"></div> x-text="$store.global.t('active')"></div>
<div class="stat-value text-white font-mono text-3xl" x-text="stats.active"></div> <div class="stat-desc text-neon-green/60 text-[10px] truncate" x-text="$store.global.t('operational')"></div>
<div class="stat-desc text-neon-green/60 text-[10px] mt-1" x-text="$store.global.t('operational')"></div>
</div> </div>
<div <div
class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-6 hover:border-space-border/60 transition-colors group"> class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-4 hover:border-space-border/60 transition-colors group relative">
<div class="stat-figure text-red-500 group-hover:scale-110 transition-transform"> <div class="absolute top-3 right-3 text-gray-700/40 group-hover:text-red-500/50 transition-colors">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="inline-block w-8 h-8 stroke-current"> class="w-5 h-5 stroke-current">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path> d="M12 8v4m0 4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path>
</svg> </svg>
</div> </div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider" <div class="stat-value text-white font-mono text-4xl font-bold mb-1" x-text="stats.limited"></div>
<div class="stat-title text-gray-500 font-mono text-xs uppercase tracking-wider truncate"
x-text="$store.global.t('rateLimited')"></div> x-text="$store.global.t('rateLimited')"></div>
<div class="stat-value text-white font-mono text-3xl" x-text="stats.limited"></div> <div class="stat-desc text-red-500/60 text-[10px] truncate" x-text="$store.global.t('cooldown')"></div>
<div class="stat-desc text-red-500/60 text-[10px] mt-1" x-text="$store.global.t('cooldown')"></div>
</div> </div>
<!-- Global Quota Chart --> <!-- Global Quota Chart -->
<div <div
class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-4 col-span-1 md:col-start-4 md:row-start-1 h-full flex items-center justify-between gap-4 overflow-hidden relative group hover:border-space-border/60 transition-colors"> class="stat bg-space-900/40 border border-space-border/30 rounded-lg p-4 col-span-1 lg:col-start-4 lg:row-start-1 h-full flex items-center justify-between gap-3 overflow-hidden relative group hover:border-space-border/60 transition-colors">
<!-- Chart Container --> <!-- Chart Container -->
<div class="h-20 w-20 relative flex-shrink-0"> <div class="h-16 w-16 lg:h-20 lg:w-20 relative flex-shrink-0">
<canvas id="quotaChart"></canvas> <canvas id="quotaChart"></canvas>
<div class="absolute inset-0 flex items-center justify-center pointer-events-none"> <div class="absolute inset-0 flex items-center justify-center pointer-events-none">
<div class="text-[10px] font-bold text-white font-mono" x-text="stats.overallHealth + '%'">%</div> <div class="text-[10px] font-bold text-white font-mono" x-text="stats.overallHealth + '%'">%</div>
@@ -61,60 +64,68 @@
<!-- Legend / Info --> <!-- Legend / Info -->
<div class="flex flex-col justify-center gap-2 flex-grow min-w-0 z-10"> <div class="flex flex-col justify-center gap-2 flex-grow min-w-0 z-10">
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<span class="text-[10px] text-gray-500 uppercase tracking-wider font-mono" x-text="$store.global.t('globalQuota')">Global Quota</span> <span class="text-[10px] text-gray-500 uppercase tracking-wider font-mono truncate"
x-text="$store.global.t('globalQuota')">Global Quota</span>
</div> </div>
<!-- Custom Legend --> <!-- Custom Legend -->
<div class="space-y-1"> <div class="space-y-1">
<div class="flex items-center justify-between text-[10px] text-gray-400"> <div class="flex items-center justify-between text-[10px] text-gray-400">
<div class="flex items-center gap-1.5"> <div class="flex items-center gap-1.5 truncate">
<div class="w-1.5 h-1.5 rounded-full bg-neon-purple shadow-[0_0_4px_rgba(168,85,247,0.4)]"></div> <div class="w-1.5 h-1.5 rounded-full bg-neon-purple shadow-[0_0_4px_rgba(168,85,247,0.4)] flex-shrink-0">
<span>Claude</span> </div>
<span class="truncate">Claude</span>
</div> </div>
</div> </div>
<div class="flex items-center justify-between text-[10px] text-gray-400"> <div class="flex items-center justify-between text-[10px] text-gray-400">
<div class="flex items-center gap-1.5"> <div class="flex items-center gap-1.5 truncate">
<div class="w-1.5 h-1.5 rounded-full bg-neon-green shadow-[0_0_4px_rgba(34,197,94,0.4)]"></div> <div class="w-1.5 h-1.5 rounded-full bg-neon-green shadow-[0_0_4px_rgba(34,197,94,0.4)] flex-shrink-0">
<span>Gemini</span> </div>
<span class="truncate">Gemini</span>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<!-- Decorative Glow --> <!-- Decorative Glow -->
<div class="absolute -right-6 -top-6 w-24 h-24 bg-neon-purple/5 rounded-full blur-2xl pointer-events-none"></div> <div class="absolute -right-6 -top-6 w-24 h-24 bg-neon-purple/5 rounded-full blur-2xl pointer-events-none">
</div>
</div> </div>
</div> </div>
<!-- Usage Trend Chart --> <!-- Usage Trend Chart -->
<div class="glass-panel p-4 rounded-lg"> <div class="glass-panel p-4 rounded-lg">
<!-- Header with Stats and Filter --> <!-- Header with Stats and Filter -->
<div class="flex items-center justify-between mb-3"> <div class="flex flex-col sm:flex-row items-start sm:items-center justify-between gap-4 mb-4">
<div class="flex items-center gap-4"> <div class="flex flex-wrap items-center gap-4">
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor" class="w-4 h-4 text-neon-purple"> <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke="currentColor"
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path> class="w-4 h-4 text-neon-purple">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 7h8m0 0v8m0-8l-8 8-4-4-6 6"></path>
</svg> </svg>
<h3 class="text-xs font-mono text-gray-400 uppercase tracking-widest" x-text="$store.global.t('requestVolume')">Request Volume</h3> <h3 class="text-xs font-mono text-gray-400 uppercase tracking-widest whitespace-nowrap"
x-text="$store.global.t('requestVolume')">Request Volume</h3>
</div> </div>
<!-- Usage Stats Pills --> <!-- Usage Stats Pills -->
<div class="flex gap-2 text-[10px] font-mono"> <div class="flex flex-wrap gap-2 text-[10px] font-mono">
<div class="px-2 py-1 rounded bg-space-800 border border-space-border/50"> <div class="px-2 py-1 rounded bg-space-800 border border-space-border/50 whitespace-nowrap">
<span class="text-gray-500">Total:</span> <span class="text-gray-500">Total:</span>
<span class="text-white ml-1" x-text="usageStats.total"></span> <span class="text-white ml-1" x-text="usageStats.total"></span>
</div> </div>
<div class="px-2 py-1 rounded bg-space-800 border border-space-border/50"> <div class="px-2 py-1 rounded bg-space-800 border border-space-border/50 whitespace-nowrap">
<span class="text-gray-500">Today:</span> <span class="text-gray-500">Today:</span>
<span class="text-neon-cyan ml-1" x-text="usageStats.today"></span> <span class="text-neon-cyan ml-1" x-text="usageStats.today"></span>
</div> </div>
<div class="px-2 py-1 rounded bg-space-800 border border-space-border/50"> <div class="px-2 py-1 rounded bg-space-800 border border-space-border/50 whitespace-nowrap">
<span class="text-gray-500">1H:</span> <span class="text-gray-500">1H:</span>
<span class="text-neon-green ml-1" x-text="usageStats.thisHour"></span> <span class="text-neon-green ml-1" x-text="usageStats.thisHour"></span>
</div> </div>
</div> </div>
</div> </div>
<div class="flex items-center gap-3 w-full sm:w-auto justify-end">
<!-- Display Mode Toggle --> <!-- Display Mode Toggle -->
<div class="join"> <div class="join">
<button @click="setDisplayMode('family')" <button @click="setDisplayMode('family')"
@@ -132,39 +143,47 @@
<!-- Filter Dropdown --> <!-- Filter Dropdown -->
<div class="relative"> <div class="relative">
<button @click="showModelFilter = !showModelFilter" <button @click="showModelFilter = !showModelFilter"
class="flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono text-gray-400 bg-space-800 border border-space-border/50 rounded hover:border-neon-purple/50 transition-colors"> class="flex items-center gap-2 px-3 py-1.5 text-[10px] font-mono text-gray-400 bg-space-800 border border-space-border/50 rounded hover:border-neon-purple/50 transition-colors whitespace-nowrap">
<svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="w-3 h-3" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M3 4a1 1 0 011-1h16a1 1 0 011 1v2.586a1 1 0 01-.293.707l-6.414 6.414a1 1 0 00-.293.707V17l-4 4v-6.586a1 1 0 00-.293-.707L3.293 7.293A1 1 0 013 6.586V4z" />
</svg> </svg>
<span>Filter (<span x-text="getSelectedCount()"></span>)</span> <span>Filter (<span x-text="getSelectedCount()"></span>)</span>
<svg class="w-3 h-3 transition-transform" :class="{'rotate-180': showModelFilter}" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="w-3 h-3 transition-transform" :class="{'rotate-180': showModelFilter}" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" /> <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
</svg> </svg>
</button> </button>
<!-- Dropdown Menu --> <!-- Dropdown Menu -->
<div x-show="showModelFilter" @click.outside="showModelFilter = false" <div x-show="showModelFilter" @click.outside="showModelFilter = false"
x-transition:enter="transition ease-out duration-100" x-transition:enter="transition ease-out duration-100" x-transition:enter-start="opacity-0 scale-95"
x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition ease-in duration-75"
x-transition:enter-end="opacity-100 scale-100" x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95"
x-transition:leave="transition ease-in duration-75"
x-transition:leave-start="opacity-100 scale-100"
x-transition:leave-end="opacity-0 scale-95"
class="absolute right-0 mt-1 w-72 bg-space-900 border border-space-border rounded-lg shadow-xl z-50 overflow-hidden" class="absolute right-0 mt-1 w-72 bg-space-900 border border-space-border rounded-lg shadow-xl z-50 overflow-hidden"
style="display: none;"> style="display: none;">
<!-- Header --> <!-- Header -->
<div class="flex items-center justify-between px-3 py-2 border-b border-space-border/50 bg-space-800/50"> <div
<span class="text-[10px] font-mono text-gray-500 uppercase" x-text="displayMode === 'family' ? $store.global.t('selectFamilies') : $store.global.t('selectModels')"></span> class="flex items-center justify-between px-3 py-2 border-b border-space-border/50 bg-space-800/50">
<span class="text-[10px] font-mono text-gray-500 uppercase"
x-text="displayMode === 'family' ? $store.global.t('selectFamilies') : $store.global.t('selectModels')"></span>
<div class="flex gap-1"> <div class="flex gap-1">
<button @click="autoSelectTopN(5)" class="text-[10px] text-neon-purple hover:underline" title="Select Top 5 most used models (24h)"> <button @click="autoSelectTopN(5)" class="text-[10px] text-neon-purple hover:underline"
<svg xmlns="http://www.w3.org/2000/svg" class="w-3 h-3 inline-block" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 10V3L4 14h7v7l9-11h-7z" /></svg> title="Select Top 5 most used models (24h)">
<svg xmlns="http://www.w3.org/2000/svg" class="w-3 h-3 inline-block" fill="none"
viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M13 10V3L4 14h7v7l9-11h-7z" />
</svg>
Smart Smart
</button> </button>
<span class="text-gray-600">|</span> <span class="text-gray-600">|</span>
<button @click="selectAll()" class="text-[10px] text-neon-cyan hover:underline" x-text="$store.global.t('all')">All</button> <button @click="selectAll()" class="text-[10px] text-neon-cyan hover:underline"
x-text="$store.global.t('all')">All</button>
<span class="text-gray-600">|</span> <span class="text-gray-600">|</span>
<button @click="deselectAll()" class="text-[10px] text-gray-500 hover:underline" x-text="$store.global.t('none')">None</button> <button @click="deselectAll()" class="text-[10px] text-gray-500 hover:underline"
x-text="$store.global.t('none')">None</button>
</div> </div>
</div> </div>
@@ -173,35 +192,42 @@
<template x-for="family in families" :key="family"> <template x-for="family in families" :key="family">
<div class="space-y-1"> <div class="space-y-1">
<!-- Family Header --> <!-- Family Header -->
<label class="flex items-center gap-2 px-2 py-1.5 rounded hover:bg-white/5 cursor-pointer group" <label
class="flex items-center gap-2 px-2 py-1.5 rounded hover:bg-white/5 cursor-pointer group"
x-show="displayMode === 'family'"> x-show="displayMode === 'family'">
<input type="checkbox" <input type="checkbox" :checked="isFamilySelected(family)"
:checked="isFamilySelected(family)" @change="toggleFamily(family)" class="checkbox checkbox-xs checkbox-primary">
@change="toggleFamily(family)" <div class="w-2 h-2 rounded-full flex-shrink-0"
class="checkbox checkbox-xs checkbox-primary"> :style="'background-color:' + getFamilyColor(family)"></div>
<div class="w-2 h-2 rounded-full flex-shrink-0" :style="'background-color:' + getFamilyColor(family)"></div> <span class="text-xs text-gray-300 font-medium capitalize group-hover:text-white"
<span class="text-xs text-gray-300 font-medium capitalize group-hover:text-white" x-text="family"></span> x-text="family"></span>
<span class="text-[10px] text-gray-600 ml-auto" x-text="'(' + (modelTree[family] || []).length + ')'"></span> <span class="text-[10px] text-gray-600 ml-auto"
x-text="'(' + (modelTree[family] || []).length + ')'"></span>
</label> </label>
<!-- Family Section Header (Model Mode) --> <!-- Family Section Header (Model Mode) -->
<div class="flex items-center gap-2 px-2 py-1 text-[10px] text-gray-500 uppercase font-bold" <div class="flex items-center gap-2 px-2 py-1 text-[10px] text-gray-500 uppercase font-bold"
x-show="displayMode === 'model'"> x-show="displayMode === 'model'">
<div class="w-1.5 h-1.5 rounded-full" :style="'background-color:' + getFamilyColor(family)"></div> <div class="w-1.5 h-1.5 rounded-full"
:style="'background-color:' + getFamilyColor(family)"></div>
<span x-text="family"></span> <span x-text="family"></span>
</div> </div>
<!-- Models in Family --> <!-- Models in Family -->
<template x-if="displayMode === 'model'"> <template x-if="displayMode === 'model'">
<div class="ml-4 space-y-0.5"> <div class="ml-4 space-y-0.5">
<template x-for="(model, modelIndex) in (modelTree[family] || [])" :key="family + ':' + model"> <template x-for="(model, modelIndex) in (modelTree[family] || [])"
<label class="flex items-center gap-2 px-2 py-1 rounded hover:bg-white/5 cursor-pointer group"> :key="family + ':' + model">
<input type="checkbox" <label
:checked="isModelSelected(family, model)" class="flex items-center gap-2 px-2 py-1 rounded hover:bg-white/5 cursor-pointer group">
<input type="checkbox" :checked="isModelSelected(family, model)"
@change="toggleModel(family, model)" @change="toggleModel(family, model)"
class="checkbox checkbox-xs checkbox-primary"> class="checkbox checkbox-xs checkbox-primary">
<div class="w-2 h-2 rounded-full flex-shrink-0" :style="'background-color:' + getModelColor(family, modelIndex)"></div> <div class="w-2 h-2 rounded-full flex-shrink-0"
<span class="text-xs text-gray-400 truncate group-hover:text-white" x-text="model"></span> :style="'background-color:' + getModelColor(family, modelIndex)">
</div>
<span class="text-xs text-gray-400 truncate group-hover:text-white"
x-text="model"></span>
</label> </label>
</template> </template>
</div> </div>
@@ -210,16 +236,19 @@
</template> </template>
<!-- Empty State --> <!-- Empty State -->
<div x-show="families.length === 0" class="text-center py-4 text-gray-600 text-xs" x-text="$store.global.t('noDataTracked')"> <div x-show="families.length === 0" class="text-center py-4 text-gray-600 text-xs"
x-text="$store.global.t('noDataTracked')">
No data tracked yet No data tracked yet
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
</div>
<!-- Dynamic Legend --> <!-- Dynamic Legend -->
<div class="flex flex-wrap gap-3 mb-3" x-show="displayMode === 'family' ? selectedFamilies.length > 0 : Object.values(selectedModels).flat().length > 0"> <div class="flex flex-wrap gap-3 mb-3"
x-show="displayMode === 'family' ? selectedFamilies.length > 0 : Object.values(selectedModels).flat().length > 0">
<!-- Family Mode Legend --> <!-- Family Mode Legend -->
<template x-if="displayMode === 'family'"> <template x-if="displayMode === 'family'">
<template x-for="family in selectedFamilies" :key="family"> <template x-for="family in selectedFamilies" :key="family">
@@ -234,7 +263,8 @@
<template x-for="family in families" :key="'legend-' + family"> <template x-for="family in families" :key="'legend-' + family">
<template x-for="(model, modelIndex) in (selectedModels[family] || [])" :key="family + ':' + model"> <template x-for="(model, modelIndex) in (selectedModels[family] || [])" :key="family + ':' + model">
<div class="flex items-center gap-1.5 text-[10px] font-mono"> <div class="flex items-center gap-1.5 text-[10px] font-mono">
<div class="w-2 h-2 rounded-full" :style="'background-color:' + getModelColor(family, modelIndex)"></div> <div class="w-2 h-2 rounded-full"
:style="'background-color:' + getModelColor(family, modelIndex)"></div>
<span class="text-gray-400" x-text="model"></span> <span class="text-gray-400" x-text="model"></span>
</div> </div>
</template> </template>
@@ -246,7 +276,9 @@
<div class="h-48 w-full relative"> <div class="h-48 w-full relative">
<canvas id="usageTrendChart"></canvas> <canvas id="usageTrendChart"></canvas>
<!-- Loading/Empty State --> <!-- Loading/Empty State -->
<div x-show="!stats.hasTrendData" class="absolute inset-0 flex items-center justify-center bg-space-900/50 backdrop-blur-sm z-10" style="display: none;"> <div x-show="!stats.hasTrendData"
class="absolute inset-0 flex items-center justify-center bg-space-900/50 backdrop-blur-sm z-10"
style="display: none;">
<div class="text-xs font-mono text-gray-500 flex items-center gap-2"> <div class="text-xs font-mono text-gray-500 flex items-center gap-2">
<span class="loading loading-spinner loading-xs"></span> <span class="loading loading-spinner loading-xs"></span>
<span x-text="$store.global.t('syncing')">SYNCING...</span> <span x-text="$store.global.t('syncing')">SYNCING...</span>
@@ -255,16 +287,18 @@
<!-- No Selection --> <!-- No Selection -->
<div x-show="stats.hasTrendData && (displayMode === 'family' ? selectedFamilies.length === 0 : Object.values(selectedModels).flat().length === 0)" <div x-show="stats.hasTrendData && (displayMode === 'family' ? selectedFamilies.length === 0 : Object.values(selectedModels).flat().length === 0)"
class="absolute inset-0 flex items-center justify-center bg-space-900/30 z-10"> class="absolute inset-0 flex items-center justify-center bg-space-900/30 z-10">
<div class="text-xs font-mono text-gray-500" x-text="displayMode === 'family' ? $store.global.t('selectFamilies') : $store.global.t('selectModels')"></div> <div class="text-xs font-mono text-gray-500"
x-text="displayMode === 'family' ? $store.global.t('selectFamilies') : $store.global.t('selectModels')">
</div>
</div> </div>
</div> </div>
</div> </div>
<!-- Controls --> <!-- Controls -->
<div class="flex items-center justify-between gap-4 glass-panel p-2 rounded-lg h-16"> <div class="flex flex-col lg:flex-row items-center justify-between gap-4 glass-panel p-4 rounded-lg h-auto">
<div class="flex items-center gap-4 h-full"> <div class="flex flex-col md:flex-row items-center gap-4 w-full lg:w-auto">
<!-- Custom Select --> <!-- Custom Select -->
<div class="relative w-64 h-10"> <div class="relative w-full md:w-64 h-10">
<select <select
class="appearance-none w-full h-full bg-space-800 border border-space-border text-gray-300 rounded-lg pl-4 pr-10 focus:outline-none focus:border-neon-purple focus:ring-1 focus:ring-neon-purple transition-all truncate text-sm" class="appearance-none w-full h-full bg-space-800 border border-space-border text-gray-300 rounded-lg pl-4 pr-10 focus:outline-none focus:border-neon-purple focus:ring-1 focus:ring-neon-purple transition-all truncate text-sm"
x-model="$store.data.filters.account" @change="$store.data.computeQuotaRows()"> x-model="$store.data.filters.account" @change="$store.data.computeQuotaRows()">
@@ -281,24 +315,24 @@
</div> </div>
<!-- Filter Buttons --> <!-- Filter Buttons -->
<div class="join h-10"> <div class="join h-10 w-full md:w-auto overflow-x-auto">
<button <button
class="join-item btn btn-sm h-full px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide" class="join-item btn btn-sm h-full flex-1 md:flex-none px-4 md:px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide whitespace-nowrap"
:class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'all'}" :class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'all'}"
@click="$store.data.filters.family = 'all'; $store.data.computeQuotaRows()">ALL</button> @click="$store.data.filters.family = 'all'; $store.data.computeQuotaRows()">ALL</button>
<button <button
class="join-item btn btn-sm h-full px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide" class="join-item btn btn-sm h-full flex-1 md:flex-none px-4 md:px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide whitespace-nowrap"
:class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'claude'}" :class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'claude'}"
@click="$store.data.filters.family = 'claude'; $store.data.computeQuotaRows()">CLAUDE</button> @click="$store.data.filters.family = 'claude'; $store.data.computeQuotaRows()">CLAUDE</button>
<button <button
class="join-item btn btn-sm h-full px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide" class="join-item btn btn-sm h-full flex-1 md:flex-none px-4 md:px-6 border-space-border bg-space-800 text-gray-400 hover:text-white hover:bg-space-700 hover:border-space-600 transition-all font-medium text-xs tracking-wide whitespace-nowrap"
:class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'gemini'}" :class="{'bg-neon-purple text-white border-neon-purple hover:bg-purple-600 hover:border-purple-500': $store.data.filters.family === 'gemini'}"
@click="$store.data.filters.family = 'gemini'; $store.data.computeQuotaRows()">GEMINI</button> @click="$store.data.filters.family = 'gemini'; $store.data.computeQuotaRows()">GEMINI</button>
</div> </div>
</div> </div>
<!-- Search --> <!-- Search -->
<div class="relative w-72 h-10"> <div class="relative w-full md:w-72 h-10">
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"> <div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
<svg class="h-4 w-4 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor"> <svg class="h-4 w-4 text-gray-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
@@ -312,15 +346,16 @@
</div> </div>
<!-- Main Table --> <!-- Main Table -->
<div class="glass-panel rounded-xl overflow-hidden min-h-[400px]"> <div class="glass-panel rounded-xl overflow-x-auto min-h-[400px]">
<table class="standard-table" :class="{'table-xs': $store.settings.compact, 'table-sm': !$store.settings.compact}"> <table class="standard-table"
:class="{'table-xs': $store.settings.compact, 'table-sm': !$store.settings.compact}">
<thead> <thead>
<tr> <tr>
<th class="w-8 py-3 pl-4" x-text="$store.global.t('stat')">Stat</th> <th class="w-14 py-3 pl-4 whitespace-nowrap" x-text="$store.global.t('stat')">Stat</th>
<th class="py-3" x-text="$store.global.t('modelIdentity')">Model Identity</th> <th class="py-3 whitespace-nowrap" x-text="$store.global.t('modelIdentity')">Model Identity</th>
<th class="w-48 py-3" x-text="$store.global.t('globalQuota')">Global Quota</th> <th class="min-w-[12rem] py-3 whitespace-nowrap" x-text="$store.global.t('globalQuota')">Global Quota</th>
<th class="w-32 py-3" x-text="$store.global.t('nextReset')">Next Reset</th> <th class="min-w-[8rem] py-3 whitespace-nowrap" x-text="$store.global.t('nextReset')">Next Reset</th>
<th class="py-3 pr-4 text-right" x-text="$store.global.t('distribution')">Account <th class="py-3 pr-4 text-right whitespace-nowrap" x-text="$store.global.t('distribution')">Account
Distribution</th> Distribution</th>
</tr> </tr>
</thead> </thead>
@@ -344,20 +379,22 @@
<span x-text="row.avgQuota + '%'" <span x-text="row.avgQuota + '%'"
:class="row.avgQuota > 0 ? 'text-white' : 'text-red-500'"></span> :class="row.avgQuota > 0 ? 'text-white' : 'text-red-500'"></span>
</div> </div>
<progress class="progress w-full h-1.5 bg-space-800" <progress class="progress w-full h-1 bg-space-800"
:class="row.avgQuota > 50 ? 'progress-gradient-success' : (row.avgQuota > 0 ? 'progress-gradient-warning' : 'progress-gradient-error')" :class="row.avgQuota > 50 ? 'progress-gradient-success' : (row.avgQuota > 0 ? 'progress-gradient-warning' : 'progress-gradient-error')"
:value="row.avgQuota" max="100"></progress> :value="row.avgQuota" max="100"></progress>
</div> </div>
</td> </td>
<td class="font-mono text-xs"> <td class="font-mono text-xs">
<span x-text="row.resetIn" :class="(row.resetIn && row.resetIn.indexOf('h') === -1 && row.resetIn !== '-') ? 'text-neon-purple font-bold' : 'text-gray-400'"></span> <span x-text="row.resetIn"
:class="(row.resetIn && row.resetIn.indexOf('h') === -1 && row.resetIn !== '-') ? 'text-neon-purple font-bold' : 'text-gray-400'"></span>
</td> </td>
<td> <td>
<div class="flex items-center justify-end gap-3 pr-4"> <div class="flex items-center justify-end gap-3 pr-4">
<div class="text-[10px] font-mono text-gray-500 hidden xl:block text-right leading-tight opacity-70"> <div
class="text-[10px] font-mono text-gray-500 hidden xl:block text-right leading-tight opacity-70">
<div x-text="row.quotaInfo.filter(q => q.pct > 0).length + ' Active'"></div> <div x-text="row.quotaInfo.filter(q => q.pct > 0).length + ' Active'"></div>
</div> </div>
<div class="flex flex-wrap gap-1 justify-end max-w-[150px]"> <div class="flex flex-wrap gap-1 justify-end max-w-[200px]">
<template x-for="q in row.quotaInfo" :key="q.fullEmail"> <template x-for="q in row.quotaInfo" :key="q.fullEmail">
<div class="tooltip tooltip-left" :data-tip="q.fullEmail + ' (' + q.pct + '%)'"> <div class="tooltip tooltip-left" :data-tip="q.fullEmail + ' (' + q.pct + '%)'">
<div class="w-1.5 h-3 rounded-[1px] transition-all hover:scale-125 cursor-help" <div class="w-1.5 h-3 rounded-[1px] transition-all hover:scale-125 cursor-help"
@@ -375,14 +412,16 @@
<td colspan="5" class="h-64 text-center"> <td colspan="5" class="h-64 text-center">
<div class="flex flex-col items-center justify-center gap-3"> <div class="flex flex-col items-center justify-center gap-3">
<span class="loading loading-bars loading-md text-neon-purple"></span> <span class="loading loading-bars loading-md text-neon-purple"></span>
<span class="text-xs font-mono text-gray-600 animate-pulse" x-text="$store.global.t('establishingUplink')">ESTABLISHING <span class="text-xs font-mono text-gray-600 animate-pulse"
x-text="$store.global.t('establishingUplink')">ESTABLISHING
UPLINK...</span> UPLINK...</span>
</div> </div>
</td> </td>
</tr> </tr>
<!-- Empty --> <!-- Empty -->
<tr x-show="!$store.data.loading && $store.data.quotaRows.length === 0"> <tr x-show="!$store.data.loading && $store.data.quotaRows.length === 0">
<td colspan="5" class="h-64 text-center text-gray-600 font-mono text-xs" x-text="$store.global.t('noSignal')"> <td colspan="5" class="h-64 text-center text-gray-600 font-mono text-xs"
x-text="$store.global.t('noSignal')">
NO SIGNAL DETECTED NO SIGNAL DETECTED
</td> </td>
</tr> </tr>

View File

@@ -178,12 +178,12 @@
<div> <div>
<div class="text-[11px] text-gray-400 mb-1 font-mono">ANTHROPIC_BASE_URL</div> <div class="text-[11px] text-gray-400 mb-1 font-mono">ANTHROPIC_BASE_URL</div>
<input type="text" x-model="config.env.ANTHROPIC_BASE_URL" placeholder="http://localhost:8080" <input type="text" x-model="config.env.ANTHROPIC_BASE_URL" placeholder="http://localhost:8080"
class="input input-sm input-bordered bg-space-800/50 w-full font-mono text-sm border-space-border focus:border-neon-purple focus:bg-space-800 text-gray-200"> class="input input-sm input-bordered !bg-space-800 w-full font-mono text-sm !border-space-border focus:!border-neon-purple !text-white placeholder:!text-gray-600">
</div> </div>
<div> <div>
<div class="text-[11px] text-gray-400 mb-1 font-mono">ANTHROPIC_AUTH_TOKEN</div> <div class="text-[11px] text-gray-400 mb-1 font-mono">ANTHROPIC_AUTH_TOKEN</div>
<input type="password" x-model="config.env.ANTHROPIC_AUTH_TOKEN" placeholder="any-string" <input type="password" x-model="config.env.ANTHROPIC_AUTH_TOKEN" placeholder="any-string"
class="input input-sm input-bordered bg-space-800/50 w-full font-mono text-sm border-space-border focus:border-neon-purple focus:bg-space-800 text-gray-200"> class="input input-sm input-bordered !bg-space-800 w-full font-mono text-sm !border-space-border focus:!border-neon-purple !text-white placeholder:!text-gray-600">
</div> </div>
</div> </div>
</div> </div>
@@ -200,7 +200,7 @@
<input type="text" x-model="config.env.ANTHROPIC_MODEL" <input type="text" x-model="config.env.ANTHROPIC_MODEL"
@focus="open = true" @focus="open = true"
@click.away="open = false" @click.away="open = false"
class="input input-sm w-full font-mono text-xs bg-space-800/50 border-space-border text-white focus:bg-space-800 focus:border-neon-cyan pr-8 placeholder-gray-600" class="input input-sm w-full font-mono text-xs !bg-space-800 !border-space-border !text-white focus:!bg-space-800 focus:!border-neon-cyan pr-8 placeholder:!text-gray-600"
:placeholder="$store.global.t('typeToSearch')"> :placeholder="$store.global.t('typeToSearch')">
<div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div> <div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div>
@@ -234,7 +234,7 @@
<input type="text" x-model="config.env.CLAUDE_CODE_SUBAGENT_MODEL" <input type="text" x-model="config.env.CLAUDE_CODE_SUBAGENT_MODEL"
@focus="open = true" @focus="open = true"
@click.away="open = false" @click.away="open = false"
class="input input-sm w-full font-mono text-xs bg-space-800/50 border-space-border text-white focus:bg-space-800 focus:border-neon-purple pr-8 placeholder-gray-600" class="input input-sm w-full font-mono text-xs !bg-space-800 !border-space-border !text-white focus:!bg-space-800 focus:!border-neon-purple pr-8 placeholder:!text-gray-600"
:placeholder="$store.global.t('typeToSearch')"> :placeholder="$store.global.t('typeToSearch')">
<div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div> <div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div>
@@ -273,7 +273,7 @@
<input type="text" x-model="config.env.ANTHROPIC_DEFAULT_OPUS_MODEL" <input type="text" x-model="config.env.ANTHROPIC_DEFAULT_OPUS_MODEL"
@focus="open = true" @focus="open = true"
@click.away="open = false" @click.away="open = false"
class="input input-sm w-full font-mono text-xs bg-space-800/50 border-space-border text-gray-300 focus:bg-space-800 focus:border-neon-cyan pr-8 placeholder-gray-600" class="input input-sm w-full font-mono text-xs !bg-space-800 !border-space-border !text-white focus:!bg-space-800 focus:!border-neon-cyan pr-8 placeholder:!text-gray-600"
:placeholder="$store.global.t('searchPlaceholder')"> :placeholder="$store.global.t('searchPlaceholder')">
<div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div> <div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div>
<ul x-show="open" <ul x-show="open"
@@ -301,7 +301,7 @@
<input type="text" x-model="config.env.ANTHROPIC_DEFAULT_SONNET_MODEL" <input type="text" x-model="config.env.ANTHROPIC_DEFAULT_SONNET_MODEL"
@focus="open = true" @focus="open = true"
@click.away="open = false" @click.away="open = false"
class="input input-sm w-full font-mono text-xs bg-space-800/50 border-space-border text-gray-300 focus:bg-space-800 focus:border-neon-cyan pr-8 placeholder-gray-600" class="input input-sm w-full font-mono text-xs !bg-space-800 !border-space-border !text-white focus:!bg-space-800 focus:!border-neon-cyan pr-8 placeholder:!text-gray-600"
:placeholder="$store.global.t('searchPlaceholder')"> :placeholder="$store.global.t('searchPlaceholder')">
<div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div> <div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div>
<ul x-show="open" <ul x-show="open"
@@ -329,7 +329,7 @@
<input type="text" x-model="config.env.ANTHROPIC_DEFAULT_HAIKU_MODEL" <input type="text" x-model="config.env.ANTHROPIC_DEFAULT_HAIKU_MODEL"
@focus="open = true" @focus="open = true"
@click.away="open = false" @click.away="open = false"
class="input input-sm w-full font-mono text-xs bg-space-800/50 border-space-border text-gray-300 focus:bg-space-800 focus:border-neon-cyan pr-8 placeholder-gray-600" class="input input-sm w-full font-mono text-xs !bg-space-800 !border-space-border !text-white focus:!bg-space-800 focus:!border-neon-cyan pr-8 placeholder:!text-gray-600"
:placeholder="$store.global.t('searchPlaceholder')"> :placeholder="$store.global.t('searchPlaceholder')">
<div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div> <div class="absolute right-2 top-1.5 cursor-pointer text-gray-500 hover:text-white transition-colors" @click="open = !open; if(open) $el.previousElementSibling.focus()" @mousedown.prevent></div>
<ul x-show="open" <ul x-show="open"