From 0a79dc9ecccbbe6350b918fdb62d1cd984c65767 Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Sat, 19 Jul 2025 13:44:56 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20**fix:=20Always=20display=20token?= =?UTF-8?q?=20quota=20tooltip=20for=20unlimited=20tokens**?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide a consistent UX by ensuring the status column tooltip is shown for all tokens, including those with unlimited quota. Details: • Removed early‐return that skipped tooltip rendering when `record.unlimited_quota` was true. • Refactored tooltip content: – Unlimited quota: shows only “used quota”. – Limited quota: continues to show used, remaining (with percentage) and total. • Leaves existing tag, switch and progress-bar behaviour unchanged. This prevents missing hover information for unlimited tokens and avoids meaningless “remaining / total” figures (e.g. Infinity), improving clarity for administrators. --- .../table/tokens/TokensColumnDefs.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/web/src/components/table/tokens/TokensColumnDefs.js b/web/src/components/table/tokens/TokensColumnDefs.js index 0c1f966e..ffa5ff79 100644 --- a/web/src/components/table/tokens/TokensColumnDefs.js +++ b/web/src/components/table/tokens/TokensColumnDefs.js @@ -124,20 +124,20 @@ const renderStatus = (text, record, manageToken, t) => { ); - if (record.unlimited_quota) { - return content; - } + const tooltipContent = record.unlimited_quota ? ( +
+
{t('已用额度')}: {renderQuota(used)}
+
+ ) : ( +
+
{t('已用额度')}: {renderQuota(used)}
+
{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)
+
{t('总额度')}: {renderQuota(total)}
+
+ ); return ( - -
{t('已用额度')}: {renderQuota(used)}
-
{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)
-
{t('总额度')}: {renderQuota(total)}
- - } - > + {content} );