From efaed4c3a6f8d75a312a145f7803522eaf483301 Mon Sep 17 00:00:00 2001 From: Zyy Date: Sun, 25 Oct 2026 00:08:42 +0800 Subject: [PATCH] fix(web): refine health loading and quota labels Hide request health granularity until analytics are loaded and remove the placeholder daily granularity. Use compact uppercase quota badges and localized five-hour labels. Co-authored-by: Codex --- frontend/src/i18n/locales/en/accounts.json | 2 +- frontend/src/i18n/locales/en/usage.json | 3 ++- frontend/src/i18n/locales/zh-Hans/accounts.json | 2 +- frontend/src/i18n/locales/zh-Hans/usage.json | 3 ++- frontend/src/i18n/locales/zh-Hant/accounts.json | 2 +- frontend/src/i18n/locales/zh-Hant/usage.json | 3 ++- .../components/account-quota-summary-cell/Entry.vue | 4 ++-- frontend/src/views/usage/components/UsageHealthCard.vue | 6 +++++- .../src/views/usage/composables/useUsageRecordsTable.ts | 2 +- 9 files changed, 17 insertions(+), 10 deletions(-) diff --git a/frontend/src/i18n/locales/en/accounts.json b/frontend/src/i18n/locales/en/accounts.json index f9c687d6a..ed169a052 100644 --- a/frontend/src/i18n/locales/en/accounts.json +++ b/frontend/src/i18n/locales/en/accounts.json @@ -44,7 +44,7 @@ "usageRate": "Usage rate", "moreGroups": "{count} more quota groups, expand the account to view them", "windows": { - "fiveHour": "5 h limit", + "fiveHour": "5h limit", "daily": "Daily limit", "weekly": "Weekly limit", "monthly": "Monthly limit", diff --git a/frontend/src/i18n/locales/en/usage.json b/frontend/src/i18n/locales/en/usage.json index 705fea653..9c7df9a0a 100644 --- a/frontend/src/i18n/locales/en/usage.json +++ b/frontend/src/i18n/locales/en/usage.json @@ -18,7 +18,8 @@ "requestVolume": "Requests", "noServiceResult": "No service result", "title": "Health", - "description": "Request outcomes · {granularityText}", + "description": "Request outcomes", + "descriptionWithGranularity": "Request outcomes · {granularityText}", "completionRate": "Completion", "abnormalEnd": "Abnormal", "loading": "Loading requests", diff --git a/frontend/src/i18n/locales/zh-Hans/accounts.json b/frontend/src/i18n/locales/zh-Hans/accounts.json index d04718c70..b0fcc7940 100644 --- a/frontend/src/i18n/locales/zh-Hans/accounts.json +++ b/frontend/src/i18n/locales/zh-Hans/accounts.json @@ -44,7 +44,7 @@ "usageRate": "使用率", "moreGroups": "另有 {count} 个额度组,可展开账号查看", "windows": { - "fiveHour": "5 h 额度", + "fiveHour": "5小时额度", "daily": "日额度", "weekly": "周额度", "monthly": "月额度", diff --git a/frontend/src/i18n/locales/zh-Hans/usage.json b/frontend/src/i18n/locales/zh-Hans/usage.json index c78bdfa57..d0a626c28 100644 --- a/frontend/src/i18n/locales/zh-Hans/usage.json +++ b/frontend/src/i18n/locales/zh-Hans/usage.json @@ -18,7 +18,8 @@ "requestVolume": "请求量", "noServiceResult": "无服务结果", "title": "请求健康", - "description": "请求状态分布 · {granularityText}", + "description": "请求状态分布", + "descriptionWithGranularity": "请求状态分布 · {granularityText}", "completionRate": "完成率", "abnormalEnd": "非正常结束", "loading": "正在加载请求数据", diff --git a/frontend/src/i18n/locales/zh-Hant/accounts.json b/frontend/src/i18n/locales/zh-Hant/accounts.json index b257b046b..6258944a5 100644 --- a/frontend/src/i18n/locales/zh-Hant/accounts.json +++ b/frontend/src/i18n/locales/zh-Hant/accounts.json @@ -44,7 +44,7 @@ "usageRate": "使用率", "moreGroups": "另有 {count} 個額度組,可展開賬號查看", "windows": { - "fiveHour": "5 h 額度", + "fiveHour": "5小時額度", "daily": "日額度", "weekly": "周額度", "monthly": "月額度", diff --git a/frontend/src/i18n/locales/zh-Hant/usage.json b/frontend/src/i18n/locales/zh-Hant/usage.json index af77dc262..663072b89 100644 --- a/frontend/src/i18n/locales/zh-Hant/usage.json +++ b/frontend/src/i18n/locales/zh-Hant/usage.json @@ -18,7 +18,8 @@ "requestVolume": "請求量", "noServiceResult": "無服務結果", "title": "請求健康", - "description": "請求狀態分佈 · {granularityText}", + "description": "請求狀態分佈", + "descriptionWithGranularity": "請求狀態分佈 · {granularityText}", "completionRate": "完成率", "abnormalEnd": "非正常結束", "loading": "正在加載請求數據", diff --git a/frontend/src/views/accounts/components/account-quota-summary-cell/Entry.vue b/frontend/src/views/accounts/components/account-quota-summary-cell/Entry.vue index 75deca83b..95ec80fed 100644 --- a/frontend/src/views/accounts/components/account-quota-summary-cell/Entry.vue +++ b/frontend/src/views/accounts/components/account-quota-summary-cell/Entry.vue @@ -59,9 +59,9 @@ function quotaWindowCode(windowSeconds: number | null, role: AccountQuotaWindow[ const hourSeconds = 60 * 60 if (windowSeconds >= daySeconds && windowSeconds % daySeconds === 0) - return `${windowSeconds / daySeconds} d` + return `${windowSeconds / daySeconds}D` if (windowSeconds >= hourSeconds && windowSeconds % hourSeconds === 0) - return `${windowSeconds / hourSeconds} h` + return `${windowSeconds / hourSeconds}H` } switch (role) { diff --git a/frontend/src/views/usage/components/UsageHealthCard.vue b/frontend/src/views/usage/components/UsageHealthCard.vue index b77359638..b2cd63ccc 100644 --- a/frontend/src/views/usage/components/UsageHealthCard.vue +++ b/frontend/src/views/usage/components/UsageHealthCard.vue @@ -61,6 +61,10 @@ const granularityText = computed(() => { return labels[props.granularity] ?? props.granularity }) +const description = computed(() => props.loading || !granularityText.value + ? t('usage.health.description') + : t('usage.health.descriptionWithGranularity', { granularityText: granularityText.value })) + const chartOption = computed(() => { const theme = palette.value const chartPoints = points.value @@ -165,7 +169,7 @@ function formatTooltip(params: unknown) {