feat: 参考原型图 ui优化提交 个人端-用户中心 相关的页面
This commit is contained in:
@@ -25,22 +25,17 @@ import {
|
||||
Button,
|
||||
Modal,
|
||||
Tooltip,
|
||||
} from '@douyinfe/semi-ui';
|
||||
import {
|
||||
Activity,
|
||||
RefreshCw,
|
||||
Server,
|
||||
ChevronRight,
|
||||
Zap,
|
||||
Clock,
|
||||
TrendingUp,
|
||||
} from 'lucide-react';
|
||||
Statistic,
|
||||
theme,
|
||||
} from 'antd';
|
||||
import { RefreshCw, Server, ChevronRight, Zap, Clock } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { API, showError } from '../../helpers';
|
||||
import { isAdmin } from '../../helpers/utils';
|
||||
|
||||
// 条形码状态组件 - 美化版
|
||||
const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
const { token } = theme.useToken();
|
||||
// 补全或截取数据以适应展示 (展示最近60个点)
|
||||
// 注意:useMemo 必须在任何 early return 之前调用,保证 hook 调用顺序稳定。
|
||||
const displayCount = 60;
|
||||
@@ -63,7 +58,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
{Array.from({ length: 60 }).map((_, i) => (
|
||||
<div
|
||||
key={i}
|
||||
className='w-[6px] h-4 bg-gray-200 dark:bg-gray-700 rounded-sm'
|
||||
className='service-history-loading w-[6px] h-4 rounded-sm'
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
@@ -78,7 +73,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
return (
|
||||
<div
|
||||
key={i}
|
||||
className='w-[6px] h-2 bg-gray-100 dark:bg-gray-800 rounded-sm'
|
||||
className='service-history-pending w-[6px] h-2 rounded-sm'
|
||||
/>
|
||||
);
|
||||
}
|
||||
@@ -87,14 +82,11 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
const isWarning =
|
||||
point.uptime_percent >= 50 && point.uptime_percent < 90;
|
||||
|
||||
let bgColor = '#ef4444'; // red-500
|
||||
let glowColor = 'rgba(239, 68, 68, 0.3)';
|
||||
let bgColor = token.colorError;
|
||||
if (isHealthy) {
|
||||
bgColor = '#10b981'; // emerald-500
|
||||
glowColor = 'rgba(16, 185, 129, 0.3)';
|
||||
bgColor = token.colorPrimary;
|
||||
} else if (isWarning) {
|
||||
bgColor = '#f59e0b'; // amber-500
|
||||
glowColor = 'rgba(245, 158, 11, 0.3)';
|
||||
bgColor = token.colorWarning;
|
||||
}
|
||||
|
||||
const height = isHealthy ? '20px' : '16px';
|
||||
@@ -102,7 +94,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
return (
|
||||
<Tooltip
|
||||
key={i}
|
||||
content={
|
||||
title={
|
||||
<div className='text-xs p-1'>
|
||||
<div style={{ color: bgColor }} className='font-semibold'>
|
||||
{isHealthy ? t('正常') : t('异常')} (
|
||||
@@ -117,11 +109,10 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
}
|
||||
>
|
||||
<div
|
||||
className='w-[6px] rounded-sm transition-all duration-200 hover:scale-y-125 hover:opacity-80 cursor-pointer'
|
||||
className={`w-[6px] rounded-sm hover:opacity-80 cursor-pointer ${isHealthy ? 'service-history-healthy' : ''}`}
|
||||
style={{
|
||||
backgroundColor: bgColor,
|
||||
height: height,
|
||||
boxShadow: `0 0 6px ${glowColor}`,
|
||||
}}
|
||||
/>
|
||||
</Tooltip>
|
||||
@@ -138,6 +129,7 @@ const StatusBars = ({ dataPoints = [], loading = false, t }) => {
|
||||
|
||||
// 模型测试单元格组件
|
||||
const TestModelCell = ({ modelName, groupName, t }) => {
|
||||
const { token } = theme.useToken();
|
||||
const [testing, setTesting] = useState(false);
|
||||
const [result, setResult] = useState(null);
|
||||
|
||||
@@ -182,30 +174,31 @@ const TestModelCell = ({ modelName, groupName, t }) => {
|
||||
|
||||
return (
|
||||
<div className='flex items-center gap-3'>
|
||||
<Button
|
||||
size='small'
|
||||
type='tertiary'
|
||||
theme='light'
|
||||
loading={testing}
|
||||
onClick={handleTest}
|
||||
className='!bg-gradient-to-r !from-emerald-50 !to-teal-50 !border !border-emerald-200 hover:!border-emerald-300 !rounded-lg'
|
||||
style={{ color: '#047857' }}
|
||||
>
|
||||
<Zap size={12} className='mr-1' style={{ color: '#047857' }} />
|
||||
<Button size='small' loading={testing} onClick={handleTest}>
|
||||
<Zap size={12} className='mr-1' />
|
||||
{testing ? t('测试中') : t('测试')}
|
||||
</Button>
|
||||
{result && (
|
||||
<span
|
||||
className={`text-xs font-medium ${result.success ? 'text-emerald-600 dark:text-emerald-400' : 'text-red-500 dark:text-red-400'}`}
|
||||
className='text-xs font-medium'
|
||||
style={{
|
||||
color: result.success ? token.colorPrimary : token.colorError,
|
||||
}}
|
||||
>
|
||||
{result.success ? (
|
||||
<span className='flex items-center gap-1 px-2 py-0.5 bg-emerald-50 dark:bg-emerald-900/30 rounded-full'>
|
||||
<span
|
||||
className='flex items-center gap-1 px-2 py-0.5 rounded-full'
|
||||
style={{ background: token.colorPrimaryBg }}
|
||||
>
|
||||
<span>✓</span>
|
||||
<span>{result.time}ms</span>
|
||||
</span>
|
||||
) : (
|
||||
<Tooltip content={result.error}>
|
||||
<span className='flex items-center gap-1 px-2 py-0.5 bg-red-50 dark:bg-red-900/30 rounded-full cursor-help'>
|
||||
<Tooltip title={result.error}>
|
||||
<span
|
||||
className='flex items-center gap-1 px-2 py-0.5 rounded-full cursor-help'
|
||||
style={{ background: token.colorErrorBg }}
|
||||
>
|
||||
<span>✗</span>
|
||||
{result.time > 0 && <span>{result.time}ms</span>}
|
||||
</span>
|
||||
@@ -219,6 +212,7 @@ const TestModelCell = ({ modelName, groupName, t }) => {
|
||||
|
||||
const GroupMonitor = () => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const [groups, setGroups] = useState([]);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const [refreshing, setRefreshing] = useState(false);
|
||||
@@ -313,18 +307,21 @@ const GroupMonitor = () => {
|
||||
setSelectedGroup(null);
|
||||
};
|
||||
|
||||
const getUptimeColor = (uptime) => {
|
||||
const val = Number(uptime) || 0;
|
||||
if (val >= 95) return '#10b981';
|
||||
if (val >= 80) return '#f59e0b';
|
||||
return '#ef4444';
|
||||
};
|
||||
const getUptimeColor = useCallback(
|
||||
(uptime) => {
|
||||
const val = Number(uptime) || 0;
|
||||
if (val >= 95) return token.colorPrimary;
|
||||
if (val >= 80) return token.colorWarning;
|
||||
return token.colorError;
|
||||
},
|
||||
[token.colorPrimary, token.colorWarning, token.colorError],
|
||||
);
|
||||
|
||||
const getUptimeGradient = (uptime) => {
|
||||
const getUptimeClass = (uptime) => {
|
||||
const val = Number(uptime) || 0;
|
||||
if (val >= 95) return 'from-emerald-500 to-teal-500';
|
||||
if (val >= 80) return 'from-amber-500 to-orange-500';
|
||||
return 'from-red-500 to-rose-500';
|
||||
if (val >= 95) return 'service-status-normal';
|
||||
if (val >= 80) return 'service-status-warning';
|
||||
return 'service-status-error';
|
||||
};
|
||||
|
||||
const modelColumns = useMemo(
|
||||
@@ -335,7 +332,10 @@ const GroupMonitor = () => {
|
||||
key: 'model',
|
||||
render: (text) => (
|
||||
<div className='font-medium text-gray-700 dark:text-gray-200 flex items-center gap-2'>
|
||||
<div className='w-2 h-2 rounded-full bg-gradient-to-r from-emerald-400 to-teal-400' />
|
||||
<div
|
||||
className='w-2 h-2 rounded-full'
|
||||
style={{ background: token.colorPrimary }}
|
||||
/>
|
||||
{text}
|
||||
</div>
|
||||
),
|
||||
@@ -348,8 +348,11 @@ const GroupMonitor = () => {
|
||||
<div className='flex items-center gap-2'>
|
||||
<div className='w-16 h-1.5 bg-gray-100 dark:bg-gray-700 rounded-full overflow-hidden'>
|
||||
<div
|
||||
className={`h-full rounded-full bg-gradient-to-r ${getUptimeGradient(value)}`}
|
||||
style={{ width: `${Math.min(100, value || 0)}%` }}
|
||||
className='h-full rounded-full'
|
||||
style={{
|
||||
width: `${Math.min(100, value || 0)}%`,
|
||||
backgroundColor: getUptimeColor(value),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<span
|
||||
@@ -367,7 +370,7 @@ const GroupMonitor = () => {
|
||||
key: 'count',
|
||||
render: (_, record) => (
|
||||
<span className='text-gray-600 dark:text-gray-300 font-medium'>
|
||||
<span className='text-emerald-600 dark:text-emerald-400'>
|
||||
<span style={{ color: token.colorPrimary }}>
|
||||
{record.available_count}
|
||||
</span>
|
||||
<span className='text-gray-300 dark:text-gray-600 mx-1'>/</span>
|
||||
@@ -407,7 +410,7 @@ const GroupMonitor = () => {
|
||||
),
|
||||
},
|
||||
],
|
||||
[t, selectedGroup],
|
||||
[t, selectedGroup, getUptimeColor, token.colorPrimary],
|
||||
);
|
||||
|
||||
const modalDataSource = useMemo(() => {
|
||||
@@ -431,7 +434,6 @@ const GroupMonitor = () => {
|
||||
return (
|
||||
<div className='flex flex-col items-center justify-center py-20'>
|
||||
<div className='relative'>
|
||||
<div className='absolute inset-0 bg-emerald-400/30 rounded-full blur-xl animate-pulse' />
|
||||
<Spin size='large' />
|
||||
</div>
|
||||
<p className='mt-4 text-gray-500 dark:text-gray-400'>
|
||||
@@ -463,12 +465,12 @@ const GroupMonitor = () => {
|
||||
return (
|
||||
<div
|
||||
key={group.name}
|
||||
className={`group relative bg-white/70 dark:bg-gray-800/70 backdrop-blur-sm rounded-xl border border-gray-100 dark:border-gray-700/50 transition-all duration-300 overflow-hidden ${adminUser ? 'hover:border-emerald-200 dark:hover:border-emerald-700/50 hover:shadow-lg hover:shadow-emerald-500/5 cursor-pointer' : ''}`}
|
||||
className={`service-group-row group relative rounded-xl border overflow-hidden ${adminUser ? 'service-group-interactive cursor-pointer' : ''}`}
|
||||
onClick={adminUser ? () => handleGroupClick(group) : undefined}
|
||||
>
|
||||
{/* 左侧状态指示条 */}
|
||||
<div
|
||||
className={`absolute left-0 top-0 bottom-0 w-1 bg-gradient-to-b ${getUptimeGradient(uptimePercent)}`}
|
||||
className={`service-group-marker absolute left-0 top-0 bottom-0 w-1 ${getUptimeClass(uptimePercent)}`}
|
||||
/>
|
||||
|
||||
{/* 桌面端布局 */}
|
||||
@@ -477,13 +479,13 @@ const GroupMonitor = () => {
|
||||
<div className='w-[180px] shrink-0 pr-4'>
|
||||
<div className='flex items-center gap-3'>
|
||||
<div
|
||||
className={`w-10 h-10 rounded-xl bg-gradient-to-br ${getUptimeGradient(uptimePercent)} flex items-center justify-center shadow-lg`}
|
||||
className={`service-status-icon w-10 h-10 rounded-xl ${getUptimeClass(uptimePercent)} flex items-center justify-center`}
|
||||
>
|
||||
<Server className='w-5 h-5 text-white' />
|
||||
<Server className='w-5 h-5' />
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<div
|
||||
className='text-base font-bold text-gray-800 dark:text-gray-100 truncate group-hover:text-emerald-600 dark:group-hover:text-emerald-400 transition-colors'
|
||||
className='text-base font-bold text-gray-800 dark:text-gray-100 truncate'
|
||||
title={group.name}
|
||||
>
|
||||
{group.name}
|
||||
@@ -499,13 +501,10 @@ const GroupMonitor = () => {
|
||||
<div className='w-[120px] shrink-0 flex justify-center'>
|
||||
<div className='relative'>
|
||||
<div
|
||||
className={`px-4 py-2 rounded-xl text-white text-sm font-bold shadow-lg bg-gradient-to-r ${getUptimeGradient(uptimePercent)}`}
|
||||
className={`service-uptime-badge px-4 py-2 rounded-xl text-sm font-bold ${getUptimeClass(uptimePercent)}`}
|
||||
>
|
||||
{uptimePercent.toFixed(2)}%
|
||||
</div>
|
||||
{uptimePercent >= 95 && (
|
||||
<div className='absolute -top-1 -right-1 w-3 h-3 bg-yellow-400 rounded-full animate-pulse shadow-lg' />
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -541,8 +540,8 @@ const GroupMonitor = () => {
|
||||
{/* 查看按钮 - 仅管理员可见 */}
|
||||
{adminUser && (
|
||||
<div className='w-[100px] shrink-0 flex justify-end'>
|
||||
<button
|
||||
className='flex items-center gap-1.5 px-4 py-2 text-sm font-medium text-emerald-600 dark:text-emerald-400 bg-emerald-50 dark:bg-emerald-900/30 hover:bg-emerald-100 dark:hover:bg-emerald-900/50 rounded-lg transition-all group-hover:translate-x-1'
|
||||
<Button
|
||||
className='service-group-details'
|
||||
onClick={(e) => {
|
||||
e.stopPropagation();
|
||||
handleGroupClick(group);
|
||||
@@ -553,7 +552,7 @@ const GroupMonitor = () => {
|
||||
size={16}
|
||||
className='transition-transform group-hover:translate-x-0.5'
|
||||
/>
|
||||
</button>
|
||||
</Button>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
@@ -563,9 +562,9 @@ const GroupMonitor = () => {
|
||||
<div className='flex items-center justify-between'>
|
||||
<div className='flex items-center gap-3 min-w-0 flex-1'>
|
||||
<div
|
||||
className={`w-9 h-9 shrink-0 rounded-lg bg-gradient-to-br ${getUptimeGradient(uptimePercent)} flex items-center justify-center shadow-md`}
|
||||
className={`service-status-icon w-9 h-9 shrink-0 rounded-lg ${getUptimeClass(uptimePercent)} flex items-center justify-center`}
|
||||
>
|
||||
<Server className='w-4 h-4 text-white' />
|
||||
<Server className='w-4 h-4' />
|
||||
</div>
|
||||
<div className='min-w-0'>
|
||||
<div
|
||||
@@ -582,7 +581,7 @@ const GroupMonitor = () => {
|
||||
<div className='flex items-center gap-3 shrink-0'>
|
||||
<div className='relative'>
|
||||
<div
|
||||
className={`px-3 py-1.5 rounded-lg text-white text-xs font-bold shadow-md bg-gradient-to-r ${getUptimeGradient(uptimePercent)}`}
|
||||
className={`service-uptime-badge px-3 py-1.5 rounded-lg text-xs font-bold ${getUptimeClass(uptimePercent)}`}
|
||||
>
|
||||
{uptimePercent.toFixed(2)}%
|
||||
</div>
|
||||
@@ -627,7 +626,7 @@ const GroupMonitor = () => {
|
||||
{/* 刷新信息 */}
|
||||
{lastUpdateTime && (
|
||||
<div className='mt-8 flex flex-col items-center justify-center gap-3'>
|
||||
<div className='flex items-center gap-4 px-6 py-3 bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm rounded-full border border-gray-100 dark:border-gray-700/50'>
|
||||
<div className='service-refresh-info flex items-center gap-4 px-6 py-3 bg-white/50 dark:bg-gray-800/50 backdrop-blur-sm rounded-full border border-gray-100 dark:border-gray-700/50'>
|
||||
<div className='flex items-center gap-2 text-gray-500 dark:text-gray-400 text-sm'>
|
||||
<Clock size={14} />
|
||||
<span>
|
||||
@@ -635,7 +634,7 @@ const GroupMonitor = () => {
|
||||
</span>
|
||||
</div>
|
||||
<div className='w-px h-4 bg-gray-200 dark:bg-gray-700' />
|
||||
<div className='flex items-center gap-2 text-emerald-600 dark:text-emerald-400 text-sm font-medium'>
|
||||
<div className='service-refresh-countdown flex items-center gap-2 text-sm font-medium'>
|
||||
<div className='relative'>
|
||||
<svg
|
||||
className='w-5 h-5 transform -rotate-90'
|
||||
@@ -684,9 +683,8 @@ const GroupMonitor = () => {
|
||||
}
|
||||
onClick={() => fetchGroupData(true)}
|
||||
loading={refreshing}
|
||||
type='tertiary'
|
||||
theme='borderless'
|
||||
className='!text-gray-500 hover:!text-emerald-600 dark:!text-gray-400 dark:hover:!text-emerald-400'
|
||||
type='text'
|
||||
className='service-refresh-button'
|
||||
>
|
||||
{t('立即刷新')}
|
||||
</Button>
|
||||
@@ -695,89 +693,41 @@ const GroupMonitor = () => {
|
||||
|
||||
{/* 详情弹窗 */}
|
||||
<Modal
|
||||
visible={modalVisible}
|
||||
open={modalVisible}
|
||||
onCancel={handleCloseModal}
|
||||
afterClose={handleAfterClose}
|
||||
footer={null}
|
||||
width={950}
|
||||
title={null}
|
||||
bodyStyle={{ padding: '0' }}
|
||||
title={selectedGroup?.name}
|
||||
centered
|
||||
className='group-monitor-modal'
|
||||
>
|
||||
{selectedGroup && (
|
||||
<div className='bg-gradient-to-br from-white to-gray-50/50 dark:from-gray-800 dark:to-gray-900/50 rounded-xl overflow-hidden'>
|
||||
{/* Header */}
|
||||
<div className='relative px-8 py-8 border-b border-gray-100 dark:border-gray-700 overflow-hidden'>
|
||||
{/* 装饰背景 */}
|
||||
<div className='absolute inset-0 bg-gradient-to-r from-emerald-500/5 via-teal-500/5 to-cyan-500/5' />
|
||||
<div className='absolute top-0 right-0 w-64 h-64 bg-gradient-to-br from-emerald-400/10 to-transparent rounded-full blur-3xl' />
|
||||
|
||||
<div className='relative flex items-center justify-between'>
|
||||
<div className='flex items-center gap-5'>
|
||||
<div className='relative group'>
|
||||
<div className='absolute inset-0 bg-gradient-to-br from-emerald-500 to-teal-600 rounded-2xl blur-lg opacity-50' />
|
||||
<div
|
||||
className={`relative w-16 h-16 rounded-2xl bg-gradient-to-br ${getUptimeGradient(selectedGroup.uptime_percent)} flex items-center justify-center shadow-xl`}
|
||||
>
|
||||
<Server className='w-8 h-8 text-white' />
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h2 className='text-2xl font-bold text-gray-900 dark:text-white'>
|
||||
{selectedGroup.name}
|
||||
</h2>
|
||||
<div className='text-gray-500 dark:text-gray-400 text-sm mt-1 flex items-center gap-2'>
|
||||
<Activity size={14} />
|
||||
{t('分组监控详情')}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className='flex gap-4'>
|
||||
<div className='px-6 py-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm rounded-2xl border border-gray-100 dark:border-gray-700 shadow-lg min-w-[120px]'>
|
||||
<div className='flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 mb-2'>
|
||||
<TrendingUp size={12} />
|
||||
{t('可用率')}
|
||||
</div>
|
||||
<div
|
||||
className={`text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-r ${getUptimeGradient(selectedGroup.uptime_percent)}`}
|
||||
>
|
||||
{(selectedGroup.uptime_percent || 0).toFixed(2)}%
|
||||
</div>
|
||||
</div>
|
||||
<div className='px-6 py-4 bg-white/80 dark:bg-gray-800/80 backdrop-blur-sm rounded-2xl border border-gray-100 dark:border-gray-700 shadow-lg min-w-[120px]'>
|
||||
<div className='flex items-center gap-1.5 text-xs text-gray-500 dark:text-gray-400 mb-2'>
|
||||
<Server size={12} />
|
||||
{t('模型数量')}
|
||||
</div>
|
||||
<div className='text-2xl font-bold text-gray-800 dark:text-white'>
|
||||
{selectedGroup.models?.length || 0}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<>
|
||||
<div className='service-monitor-details'>
|
||||
<Statistic
|
||||
title={t('可用率')}
|
||||
value={selectedGroup.uptime_percent || 0}
|
||||
precision={2}
|
||||
suffix='%'
|
||||
/>
|
||||
<Statistic
|
||||
title={t('模型数量')}
|
||||
value={selectedGroup.models?.length || 0}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{/* Table Content */}
|
||||
<div className='p-6 sm:p-8'>
|
||||
<div className='bg-white dark:bg-gray-800 rounded-xl border border-gray-100 dark:border-gray-700 shadow-sm overflow-hidden'>
|
||||
<Table
|
||||
columns={modelColumns}
|
||||
dataSource={modalDataSource}
|
||||
pagination={modalPagination}
|
||||
size='middle'
|
||||
rowKey='model'
|
||||
emptyText={
|
||||
<Empty
|
||||
description={t('暂无模型数据')}
|
||||
imageStyle={{ height: 48 }}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<Table
|
||||
columns={modelColumns}
|
||||
dataSource={modalDataSource}
|
||||
pagination={modalPagination}
|
||||
size='middle'
|
||||
rowKey='model'
|
||||
scroll={{ x: 680 }}
|
||||
locale={{
|
||||
emptyText: <Empty description={t('暂无模型数据')} />,
|
||||
}}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Modal>
|
||||
</div>
|
||||
|
||||
@@ -30,7 +30,7 @@ import {
|
||||
Button,
|
||||
DatePicker,
|
||||
Space,
|
||||
} from '@douyinfe/semi-ui';
|
||||
} from '@/components/ui';
|
||||
import {
|
||||
Activity,
|
||||
Clock,
|
||||
@@ -173,9 +173,9 @@ const GroupMonitorAdmin = () => {
|
||||
|
||||
// 获取健康度颜色
|
||||
const getHealthColor = (score) => {
|
||||
if (score >= 90) return 'var(--semi-color-success)';
|
||||
if (score >= 70) return 'var(--semi-color-warning)';
|
||||
return 'var(--semi-color-danger)';
|
||||
if (score >= 90) return 'var(--ui-color-success)';
|
||||
if (score >= 70) return 'var(--ui-color-warning)';
|
||||
return 'var(--ui-color-danger)';
|
||||
};
|
||||
|
||||
// 获取状态配置
|
||||
@@ -322,10 +322,10 @@ const GroupMonitorAdmin = () => {
|
||||
style={{
|
||||
color:
|
||||
color === 'green'
|
||||
? 'var(--semi-color-success)'
|
||||
? 'var(--ui-color-success)'
|
||||
: color === 'orange'
|
||||
? 'var(--semi-color-warning)'
|
||||
: 'var(--semi-color-danger)',
|
||||
? 'var(--ui-color-warning)'
|
||||
: 'var(--ui-color-danger)',
|
||||
}}
|
||||
>
|
||||
<Zap className='w-3 h-3 inline mr-1' />
|
||||
@@ -424,7 +424,7 @@ const GroupMonitorAdmin = () => {
|
||||
|
||||
.group-admin-card {
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
border: 1px solid var(--semi-color-border);
|
||||
border: 1px solid var(--ui-color-border);
|
||||
border-radius: 12px;
|
||||
overflow: hidden;
|
||||
}
|
||||
@@ -441,7 +441,7 @@ const GroupMonitorAdmin = () => {
|
||||
|
||||
.health-ring-bg {
|
||||
fill: none;
|
||||
stroke: var(--semi-color-fill-1);
|
||||
stroke: var(--ui-color-fill-1);
|
||||
stroke-width: 8;
|
||||
}
|
||||
|
||||
@@ -471,7 +471,7 @@ const GroupMonitorAdmin = () => {
|
||||
|
||||
.stat-box {
|
||||
padding: 12px;
|
||||
background: var(--semi-color-fill-0);
|
||||
background: var(--ui-color-fill-0);
|
||||
border-radius: 8px;
|
||||
text-align: center;
|
||||
}
|
||||
@@ -479,17 +479,17 @@ const GroupMonitorAdmin = () => {
|
||||
.stat-box-value {
|
||||
font-size: 20px;
|
||||
font-weight: 600;
|
||||
color: var(--semi-color-text-0);
|
||||
color: var(--ui-color-text-0);
|
||||
}
|
||||
|
||||
.stat-box-label {
|
||||
font-size: 12px;
|
||||
color: var(--semi-color-text-2);
|
||||
color: var(--ui-color-text-2);
|
||||
margin-top: 4px;
|
||||
}
|
||||
|
||||
.trend-section {
|
||||
background: var(--semi-color-fill-0);
|
||||
background: var(--ui-color-fill-0);
|
||||
border-radius: 8px;
|
||||
padding: 16px;
|
||||
margin-top: 16px;
|
||||
|
||||
@@ -18,7 +18,7 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { Progress } from '@douyinfe/semi-ui';
|
||||
import { Progress } from '@/components/ui';
|
||||
import { Clock } from 'lucide-react';
|
||||
import { getServerURL } from '../../helpers/config';
|
||||
|
||||
@@ -62,7 +62,7 @@ export const RefreshCountdown = ({ interval, onComplete }) => {
|
||||
<Progress
|
||||
percent={percentage}
|
||||
showInfo={false}
|
||||
stroke='var(--semi-color-primary)'
|
||||
stroke='var(--ui-color-primary)'
|
||||
size='small'
|
||||
style={{ width: '60px' }}
|
||||
/>
|
||||
|
||||
@@ -18,14 +18,17 @@ For commercial licensing, please contact support@quantumnous.com
|
||||
*/
|
||||
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import { BarChart3, Sparkles } from 'lucide-react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Badge, Card, theme } from 'antd';
|
||||
import GroupMonitor from './GroupMonitor';
|
||||
import UserCenterPageHeader from '../../components/common/UserCenterPageHeader';
|
||||
import { API } from '../../helpers';
|
||||
import { MarkdownRenderer } from '../../components/common/markdown/MarkdownRenderer';
|
||||
import './service-dashboard.css';
|
||||
|
||||
const ServiceDashboard = () => {
|
||||
const { t } = useTranslation();
|
||||
const { token } = theme.useToken();
|
||||
const [description, setDescription] = useState(
|
||||
t('实时监控各分组服务可用性与性能指标'),
|
||||
);
|
||||
@@ -45,59 +48,57 @@ const ServiceDashboard = () => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className='min-h-screen pt-[88px] px-2 md:px-6 pb-8 relative overflow-x-hidden'>
|
||||
{/* 页面背景由父级 UserCenter shell 的 PageBackground 统一提供(走 bg-glow- 主题变量)。
|
||||
* 本页仅保留语义性的绿色状态元素(健康指示点 / 状态卡),不再硬编码整页绿色晕染。 */}
|
||||
|
||||
<div
|
||||
className='user-center-service-page min-h-screen pt-[88px] px-2 md:px-6 pb-8 relative overflow-x-hidden'
|
||||
style={{
|
||||
'--service-surface': token.colorBgContainer,
|
||||
'--service-text': token.colorText,
|
||||
'--service-muted': token.colorTextSecondary,
|
||||
'--service-border': token.colorBorderSecondary,
|
||||
'--service-fill': token.colorFillSecondary,
|
||||
'--service-success': token.colorSuccess,
|
||||
'--service-warning': token.colorWarning,
|
||||
'--service-warning-bg': token.colorWarningBg,
|
||||
'--service-error': token.colorError,
|
||||
'--service-error-bg': token.colorErrorBg,
|
||||
'--service-primary': token.colorPrimary,
|
||||
'--service-primary-hover': token.colorPrimaryHover,
|
||||
'--service-primary-bg': token.colorPrimaryBg,
|
||||
'--service-primary-border': token.colorPrimaryBorder,
|
||||
'--service-radius': `${token.borderRadius}px`,
|
||||
}}
|
||||
>
|
||||
<div className='max-w-[1600px] mx-auto relative'>
|
||||
{/* 页面标题区域 */}
|
||||
<div className='mb-8'>
|
||||
<div className='flex items-start gap-4'>
|
||||
{/* 图标容器 - 带动画效果 */}
|
||||
<div className='relative group'>
|
||||
<div className='absolute inset-0 bg-gradient-to-br from-emerald-500 to-teal-600 rounded-2xl blur-lg opacity-50 group-hover:opacity-70 transition-opacity' />
|
||||
<div className='relative w-14 h-14 rounded-2xl bg-gradient-to-br from-emerald-500 to-teal-600 flex items-center justify-center shadow-lg shadow-emerald-500/25'>
|
||||
<BarChart3 className='w-7 h-7 text-white' />
|
||||
<Sparkles className='absolute -top-1 -right-1 w-4 h-4 text-yellow-300 animate-pulse' />
|
||||
</div>
|
||||
<UserCenterPageHeader
|
||||
title={t('服务大盘')}
|
||||
subtitle={t('实时查看各分组服务可用性与模型状态')}
|
||||
extra={
|
||||
<div className='service-live-status'>
|
||||
<Badge color={token.colorPrimary} text={t('实时监控中')} />
|
||||
</div>
|
||||
|
||||
<div className='flex-1'>
|
||||
<h1 className='text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-emerald-600 via-teal-600 to-cyan-600 dark:from-emerald-400 dark:via-teal-400 dark:to-cyan-400'>
|
||||
{t('服务大盘')}
|
||||
</h1>
|
||||
</div>
|
||||
|
||||
{/* 状态指示器 */}
|
||||
<div className='hidden lg:flex items-center gap-3 px-4 py-2 bg-white/60 dark:bg-gray-800/60 backdrop-blur-sm rounded-full border border-emerald-100 dark:border-gray-700'>
|
||||
<div className='flex items-center gap-2'>
|
||||
<span className='relative flex h-2.5 w-2.5'>
|
||||
<span className='animate-ping absolute inline-flex h-full w-full rounded-full bg-emerald-400 opacity-75'></span>
|
||||
<span className='relative inline-flex rounded-full h-2.5 w-2.5 bg-emerald-500'></span>
|
||||
</span>
|
||||
<span className='text-sm text-gray-600 dark:text-gray-300 font-medium'>
|
||||
{t('实时监控中')}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
|
||||
{/* 服务描述区域 */}
|
||||
{description &&
|
||||
description !== t('实时监控各分组服务可用性与性能指标') && (
|
||||
<div className='relative mb-6'>
|
||||
<div className='relative app-card p-6 service-dashboard-description'>
|
||||
<Card
|
||||
className='service-dashboard-description'
|
||||
styles={{ body: { padding: 24 } }}
|
||||
>
|
||||
<MarkdownRenderer content={description} fontSize={14} />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* 分组监控内容 - 玻璃态卡片(统一 .app-card,去掉原双层叠加) */}
|
||||
<div className='relative'>
|
||||
<div className='relative app-card p-6'>
|
||||
<Card
|
||||
className='service-dashboard-panel'
|
||||
styles={{ body: { padding: 24 } }}
|
||||
>
|
||||
<GroupMonitor />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
.user-center-service-page .service-live-status {
|
||||
flex-shrink: 0;
|
||||
padding: 8px 16px;
|
||||
border: 1px solid var(--service-primary-border);
|
||||
border-radius: 8px;
|
||||
background: var(--service-primary-bg);
|
||||
}
|
||||
.user-center-service-page .service-live-status .ant-badge-status-text {
|
||||
color: var(--service-text);
|
||||
}
|
||||
.user-center-service-page .service-status-normal {
|
||||
--service-status-color: var(--service-primary);
|
||||
--service-status-bg: var(--service-primary-bg);
|
||||
}
|
||||
.user-center-service-page .service-status-warning {
|
||||
--service-status-color: var(--service-warning);
|
||||
--service-status-bg: var(--service-warning-bg);
|
||||
}
|
||||
.user-center-service-page .service-status-error {
|
||||
--service-status-color: var(--service-error);
|
||||
--service-status-bg: var(--service-error-bg);
|
||||
}
|
||||
.user-center-service-page .service-group-row {
|
||||
background: var(--service-surface);
|
||||
border-color: var(--service-border);
|
||||
}
|
||||
.user-center-service-page .service-group-interactive:hover {
|
||||
border-color: var(--service-primary-border);
|
||||
}
|
||||
.user-center-service-page .service-group-marker {
|
||||
background: var(--service-status-color);
|
||||
}
|
||||
.user-center-service-page .service-status-icon,
|
||||
.user-center-service-page .service-uptime-badge {
|
||||
color: var(--service-status-color);
|
||||
background: var(--service-status-bg);
|
||||
border-radius: var(--service-radius);
|
||||
}
|
||||
.user-center-service-page .service-refresh-countdown {
|
||||
color: var(--service-primary);
|
||||
}
|
||||
.user-center-service-page .service-dashboard-panel,
|
||||
.user-center-service-page .service-dashboard-description {
|
||||
background: var(--service-surface);
|
||||
border-color: var(--service-border);
|
||||
border-radius: var(--service-radius);
|
||||
box-shadow: none;
|
||||
}
|
||||
.user-center-service-page .service-history-pending {
|
||||
background: var(--service-fill);
|
||||
}
|
||||
.user-center-service-page .service-history-loading {
|
||||
background: var(--service-fill);
|
||||
}
|
||||
.user-center-service-page .service-history-healthy {
|
||||
background: var(--service-primary);
|
||||
}
|
||||
.user-center-service-page .service-refresh-button {
|
||||
color: var(--service-muted);
|
||||
font-size: 14px;
|
||||
}
|
||||
.user-center-service-page .service-refresh-button:not(:disabled):hover {
|
||||
color: var(--service-primary-hover);
|
||||
}
|
||||
.user-center-service-page .service-refresh-info {
|
||||
max-width: 100%;
|
||||
}
|
||||
.user-center-service-page .service-group-details {
|
||||
flex-shrink: 0;
|
||||
}
|
||||
.service-monitor-details {
|
||||
display: flex;
|
||||
gap: 24px;
|
||||
flex-wrap: wrap;
|
||||
margin-bottom: 24px;
|
||||
}
|
||||
/* The reference has no dark page. These values come from the existing ConfigProvider. */
|
||||
.user-center-service-page [class~='text-gray-800'],
|
||||
.user-center-service-page [class~='text-gray-700'] {
|
||||
color: var(--service-text);
|
||||
}
|
||||
.user-center-service-page [class~='text-gray-600'],
|
||||
.user-center-service-page [class~='text-gray-500'],
|
||||
.user-center-service-page [class~='text-gray-400'],
|
||||
.user-center-service-page [class~='text-gray-300'],
|
||||
.user-center-service-page .service-refresh-button {
|
||||
color: var(--service-muted);
|
||||
}
|
||||
html.dark .user-center-service-page .service-group-row,
|
||||
html.dark .user-center-service-page .service-refresh-info {
|
||||
background: var(--service-surface);
|
||||
border-color: var(--service-border);
|
||||
backdrop-filter: none;
|
||||
}
|
||||
html.dark .user-center-service-page .service-history-pending,
|
||||
html.dark .user-center-service-page .service-history-loading {
|
||||
background: var(--service-fill);
|
||||
}
|
||||
html.dark
|
||||
.user-center-service-page
|
||||
.service-refresh-button:not(:disabled):hover {
|
||||
color: var(--service-primary-hover);
|
||||
}
|
||||
@media (max-width: 767px) {
|
||||
.user-center-service-page .service-live-status {
|
||||
padding: 4px 12px;
|
||||
}
|
||||
.user-center-service-page .service-refresh-info {
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
gap: 8px 16px;
|
||||
padding-inline: 16px;
|
||||
border-radius: 8px;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user