Просмотр исходного кода

✨ **fix: Always display token quota tooltip for unlimited tokens**

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.
t0ng7u 7 месяцев назад
Родитель
Сommit
0a79dc9ecc
1 измененных файлов с 12 добавлено и 12 удалено
  1. 12 12
      web/src/components/table/tokens/TokensColumnDefs.js

+ 12 - 12
web/src/components/table/tokens/TokensColumnDefs.js

@@ -124,20 +124,20 @@ const renderStatus = (text, record, manageToken, t) => {
     </Tag>
   );
 
-  if (record.unlimited_quota) {
-    return content;
-  }
+  const tooltipContent = record.unlimited_quota ? (
+    <div className='text-xs'>
+      <div>{t('已用额度')}: {renderQuota(used)}</div>
+    </div>
+  ) : (
+    <div className='text-xs'>
+      <div>{t('已用额度')}: {renderQuota(used)}</div>
+      <div>{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)</div>
+      <div>{t('总额度')}: {renderQuota(total)}</div>
+    </div>
+  );
 
   return (
-    <Tooltip
-      content={
-        <div className='text-xs'>
-          <div>{t('已用额度')}: {renderQuota(used)}</div>
-          <div>{t('剩余额度')}: {renderQuota(remain)} ({percent.toFixed(0)}%)</div>
-          <div>{t('总额度')}: {renderQuota(total)}</div>
-        </div>
-      }
-    >
+    <Tooltip content={tooltipContent}>
       {content}
     </Tooltip>
   );