diff --git a/backend/internal/infra/store/usage_store.go b/backend/internal/infra/store/usage_store.go index bc959b8..b14eb49 100644 --- a/backend/internal/infra/store/usage_store.go +++ b/backend/internal/infra/store/usage_store.go @@ -42,9 +42,9 @@ func (s *UsageStore) ListUser(ctx context.Context, userID int64, filter appusage WithAPIKey(). WithAccount(). WithGroup(). - Offset((filter.Page - 1) * filter.PageSize). + Offset((filter.Page-1)*filter.PageSize). Limit(filter.PageSize). - Order(ent.Desc(entusagelog.FieldCreatedAt)). + Order(ent.Desc(entusagelog.FieldCreatedAt), ent.Desc(entusagelog.FieldID)). All(ctx) if err != nil { return nil, 0, err @@ -75,9 +75,9 @@ func (s *UsageStore) ListAdmin(ctx context.Context, filter appusage.ListFilter) WithAPIKey(). WithAccount(). WithGroup(). - Offset((filter.Page - 1) * filter.PageSize). + Offset((filter.Page-1)*filter.PageSize). Limit(filter.PageSize). - Order(ent.Desc(entusagelog.FieldCreatedAt)). + Order(ent.Desc(entusagelog.FieldCreatedAt), ent.Desc(entusagelog.FieldID)). All(ctx) if err != nil { return nil, 0, err diff --git a/web/src/i18n/en.json b/web/src/i18n/en.json index c3a678f..e645c4e 100644 --- a/web/src/i18n/en.json +++ b/web/src/i18n/en.json @@ -201,13 +201,13 @@ "active_users_label": "Active users: {{count}}", "image_suffix": "PIC", "image_response_time": "Image: {{time}}", - "time_range": "Time Range:", + "time_range": "Time Range", "range_today": "Today", "range_7d": "7 Days", "range_30d": "30 Days", "range_90d": "90 Days", "range_custom": "Custom", - "granularity": "Granularity:", + "granularity": "Granularity", "granularity_hour": "Hourly", "granularity_day": "Daily", "model_distribution": "Model Distribution", diff --git a/web/src/i18n/zh.json b/web/src/i18n/zh.json index d96bc5c..adad398 100644 --- a/web/src/i18n/zh.json +++ b/web/src/i18n/zh.json @@ -201,13 +201,13 @@ "active_users_label": "活跃用户: {{count}}", "image_suffix": "PIC", "image_response_time": "图片: {{time}}", - "time_range": "时间范围:", + "time_range": "时间范围", "range_today": "今天", "range_7d": "近 7 天", "range_30d": "近 30 天", "range_90d": "近 90 天", "range_custom": "自定义", - "granularity": "粒度:", + "granularity": "粒度", "granularity_hour": "按小时", "granularity_day": "按天", "model_distribution": "模型分布", diff --git a/web/src/pages/DashboardPage.tsx b/web/src/pages/DashboardPage.tsx index a9c7139..9a34c8c 100644 --- a/web/src/pages/DashboardPage.tsx +++ b/web/src/pages/DashboardPage.tsx @@ -170,14 +170,14 @@ function MetricCard({
{title}
-
+
{value} - {valueSuffix ? {valueSuffix} : null} + {valueSuffix ? {valueSuffix} : null}
{meta}
- + {icon} @@ -198,7 +198,7 @@ function StatsSkeleton() {
- + ))} diff --git a/web/src/pages/admin/GroupsPage.tsx b/web/src/pages/admin/GroupsPage.tsx index 2cbdb7a..2758bbf 100644 --- a/web/src/pages/admin/GroupsPage.tsx +++ b/web/src/pages/admin/GroupsPage.tsx @@ -155,16 +155,16 @@ export default function GroupsPage() { totalPages={totalPages} /> )} - minWidth={1180} + minWidth={1120} > - {t('common.name')} - {t('groups.platform')} - {t('groups.subscription_type')} - + {t('common.name')} + {t('groups.platform')} + {t('groups.subscription_type')} + {t('groups.rate_multiplier')} - + {t('groups.group_type')} @@ -173,10 +173,10 @@ export default function GroupsPage() { {t('groups.usage')} - + {t('groups.capacity')} - + {t('groups.sort_weight')} @@ -198,21 +198,21 @@ export default function GroupsPage() { rows.map((row) => ( - + {isImageGroup(row) ? ( - + ) : ( - + )} - + {row.name} - - - {platformName(row.platform)} + + + {platformName(row.platform)} @@ -236,22 +236,17 @@ export default function GroupsPage() { 0 ? [{ - color: 'default' as const, + { + color: row.account_error > 0 ? 'danger' as const : 'default' as const, label: t('groups.account_error'), value: String(row.account_error), - }] : []), - { - color: 'default' as const, - label: t('groups.account_total'), - value: String(row.account_total), }, ]} /> @@ -278,11 +273,11 @@ export default function GroupsPage() { /> -
+
0 ? 'var(--ag-primary)' : undefined }}> {row.capacity_used} - / + / {row.capacity_total}
diff --git a/web/src/pages/admin/accounts/useAccountTableColumns.tsx b/web/src/pages/admin/accounts/useAccountTableColumns.tsx index 0667ff5..f60eee8 100644 --- a/web/src/pages/admin/accounts/useAccountTableColumns.tsx +++ b/web/src/pages/admin/accounts/useAccountTableColumns.tsx @@ -1,4 +1,4 @@ -import { useMemo, useRef, type MouseEvent } from 'react'; +import { useMemo, useRef, type CSSProperties, type MouseEvent } from 'react'; import { useTranslation } from 'react-i18next'; import { useQueryClient } from '@tanstack/react-query'; import { RefreshCw } from 'lucide-react'; @@ -7,7 +7,6 @@ import { accountsApi } from '../../../shared/api/accounts'; import { queryKeys } from '../../../shared/queryKeys'; import type { AccountResp } from '../../../shared/types'; import { PlatformIcon, useToast } from '../../../shared/ui'; -import { GROUP_CHIP_STYLE } from '../../../shared/components/groupChipStyle'; import { AccountCapacityChip, AccountRowActions, @@ -23,6 +22,12 @@ import { type QuotaRefreshResult = Awaited>; +const ACCOUNT_GROUP_CARD_STYLE: CSSProperties = { + background: 'var(--ag-bg-surface)', + border: '1px solid var(--ag-glass-border)', + color: 'var(--ag-text-secondary)', +}; + type UseAccountTableColumnsArgs = { applyQuotaRefreshResult: (id: number, result: QuotaRefreshResult) => void; groupMap: Map; @@ -145,7 +150,7 @@ export function useAccountTableColumns({ {name} @@ -153,7 +158,7 @@ export function useAccountTableColumns({ {hiddenCount > 0 ? ( +{hiddenCount} diff --git a/web/src/shared/components/MetricChips.tsx b/web/src/shared/components/MetricChips.tsx index 39675b7..90e50f9 100644 --- a/web/src/shared/components/MetricChips.tsx +++ b/web/src/shared/components/MetricChips.tsx @@ -1,6 +1,6 @@ import { Chip } from '@heroui/react'; -type MetricChipColor = 'default' | 'warning' | 'success' | 'accent'; +type MetricChipColor = 'default' | 'warning' | 'success' | 'accent' | 'danger'; export type MetricChipItem = { amount?: number; diff --git a/web/src/styles/pages.css b/web/src/styles/pages.css index 5564589..3e8756e 100644 --- a/web/src/styles/pages.css +++ b/web/src/styles/pages.css @@ -42,6 +42,20 @@ min-width: 10.25rem; } +.ag-groups-table .ag-metric-chips--markup.ag-metric-chips--account-stats .ag-metric-chip { + grid-template-columns: minmax(max-content, 1fr) max-content; +} + +.ag-groups-table .ag-metric-chips--markup.ag-metric-chips--account-stats .ag-metric-chip-label, +.ag-groups-table .ag-metric-chips--markup.ag-metric-chips--account-stats .ag-metric-chip-value { + overflow: visible; + text-overflow: clip; +} + +.ag-groups-table .ag-metric-chips--markup.ag-metric-chips--account-stats .ag-metric-chip-value { + min-width: 0; +} + :is(.ag-api-keys-table, .ag-groups-table) .ag-metric-chips--compact-y { gap: 0.25rem; }