Эх сурвалжийг харах

fix(ui): show status labels instead of raw values

Pie chart labels now use localized status names (with counts). Settings
user role/status and domain DNS API columns render human-readable labels
instead of raw enum codes or credential IDs.

AI-Co-Authored-By: Grok
chendeben 1 сар өмнө
parent
commit
c7ca310454

Файлын зөрүү хэтэрхий том тул дарагдсан байна
+ 0 - 0
public/assets/index-DJK7kS6V.js


+ 1 - 1
public/index.html

@@ -4,7 +4,7 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>MailHub</title>
-    <script type="module" crossorigin src="/assets/index-DUmPaqbo.js"></script>
+    <script type="module" crossorigin src="/assets/index-DJK7kS6V.js"></script>
     <link rel="modulepreload" crossorigin href="/assets/styles-QhtMJdIX.js">
     <link rel="stylesheet" crossorigin href="/assets/styles-DnGt72Bi.css">
     <link rel="stylesheet" crossorigin href="/assets/index-Tu04tXLf.css">

+ 6 - 1
src/pages/Dashboard.tsx

@@ -139,8 +139,13 @@ export default function Dashboard({ analytics, domains, events, config, smtpCred
                     range: [brandColors.chartSuccess, brandColors.chartDanger, brandColors.chartWarning]
                   }
                 }}
-                label={{ text: 'value', position: 'outside' }}
+                label={{
+                  text: (datum: { label?: string; value?: number }) =>
+                    `${datum.label || ''}${datum.value != null ? ` ${datum.value}` : ''}`,
+                  position: 'outside'
+                }}
                 legend={{ color: { position: 'bottom' } }}
+                tooltip={{ title: 'label' }}
               />
             ) : (
               <EmptyState description={t('dashboard.noTrend')} />

+ 11 - 5
src/pages/Domains/index.tsx

@@ -68,11 +68,17 @@ export default function DomainsPage({
       title: t('domains.dnsApi'),
       dataIndex: 'dnsCredentialId',
       width: 150,
-      render: (value: number | null) => (
-        <StatusPill tone={value ? 'info' : 'neutral'}>
-          {value ? credentialName.get(value) || value : t('common.manual')}
-        </StatusPill>
-      )
+      render: (value: number | null) => {
+        if (!value) {
+          return <StatusPill tone="neutral">{t('common.manual')}</StatusPill>;
+        }
+        const name = credentialName.get(value);
+        return (
+          <StatusPill tone={name ? 'info' : 'warning'}>
+            {name || t('common.notConfigured')}
+          </StatusPill>
+        );
+      }
     },
     recordColumn('DKIM', 'dkim'),
     recordColumn('SPF', 'spf'),

+ 25 - 5
src/pages/Settings.tsx

@@ -3,11 +3,12 @@ import type { ColumnsType } from 'antd/es/table';
 
 import { PageHeader } from '../components/common/PageHeader';
 import { SectionCard } from '../components/common/SectionCard';
-import { StatusPill } from '../components/common/StatusPill';
+import { StatusPill, type StatusTone } from '../components/common/StatusPill';
 import { StatusTag } from '../components/common/StatusTag';
 import { getDnsCurrentValues } from '../frontend/domain-model.js';
 import { useI18n } from '../frontend/i18n/react';
 import type { DnsRecord, RuntimeConfig, User } from '../frontend/types';
+import { adminUserStatusMeta } from './Admin/admin-model.js';
 
 interface SettingsProps {
   me: User | null;
@@ -36,14 +37,19 @@ export default function Settings({ me, settings, users, loading, onSave }: Setti
     {
       title: 'Role',
       dataIndex: 'role',
-      render: (value) => <StatusPill tone="neutral">{value}</StatusPill>
+      render: (value: string) => (
+        <StatusPill tone={value === 'admin' ? 'info' : 'neutral'}>
+          {roleLabel(value)}
+        </StatusPill>
+      )
     },
     {
       title: 'Status',
       dataIndex: 'status',
-      render: (value) => (
-        <StatusPill tone={value === 'active' ? 'success' : 'neutral'}>{value}</StatusPill>
-      )
+      render: (value: string) => {
+        const meta = adminUserStatusMeta(value);
+        return <StatusPill tone={userStatusTone(meta.color)}>{meta.label}</StatusPill>;
+      }
     }
   ];
   const checkColumns: ColumnsType<DnsRecord> = [
@@ -131,3 +137,17 @@ export default function Settings({ me, settings, users, loading, onSave }: Setti
     </Space>
   );
 }
+
+function roleLabel(role: string) {
+  if (role === 'admin') return '管理员';
+  if (role === 'user') return '用户';
+  return role || '-';
+}
+
+function userStatusTone(color: string): StatusTone {
+  if (color === 'green' || color === 'success') return 'success';
+  if (color === 'gold' || color === 'orange' || color === 'warning') return 'warning';
+  if (color === 'red' || color === 'error') return 'error';
+  if (color === 'blue' || color === 'processing') return 'info';
+  return 'neutral';
+}

Энэ ялгаанд хэт олон файл өөрчлөгдсөн тул зарим файлыг харуулаагүй болно