diff --git a/src/pages/Dashboard.tsx b/src/pages/Dashboard.tsx
index 66d5a4b..c479f5d 100644
--- a/src/pages/Dashboard.tsx
+++ b/src/pages/Dashboard.tsx
@@ -33,7 +33,7 @@ export default function Dashboard() {
const { data: serverData } = useQuery({
queryKey: ['servers', 'metrics'],
queryFn: getServerMetrics,
- refetchInterval: 15_000,
+ staleTime: 30_000,
})
const userTrendOption = useMemo(() => ({
diff --git a/src/pages/Servers.tsx b/src/pages/Servers.tsx
index 4d0638a..1d37f57 100644
--- a/src/pages/Servers.tsx
+++ b/src/pages/Servers.tsx
@@ -1,15 +1,19 @@
import { useState } from 'react'
import { useQuery, useQueryClient } from '@tanstack/react-query'
-import { Card, Row, Col, Progress, Table, Tag, Typography, Button, Space, Tooltip, message } from 'antd'
+import { Card, Row, Col, Progress, Table, Tag, Typography, Button, Space, Tooltip, App } from 'antd'
import { CloudServerOutlined, ReloadOutlined, CopyOutlined, GlobalOutlined } from '@ant-design/icons'
import { getServerMetrics, type ServerInfo, type ProcessInfo } from '@/services/server-api'
const { Text, Title } = Typography
function CopyTag({ text, icon, color }: { text: string; icon?: React.ReactNode; color?: string }) {
+ const { message } = App.useApp()
return (
{ await navigator.clipboard.writeText(text); message.success(`已复制: ${text}`) }}>
+ onClick={async () => {
+ try { await navigator.clipboard.writeText(text); message.success(`已复制: ${text}`) }
+ catch { message.error('复制失败') }
+ }}>
{icon}{text}
)
@@ -21,7 +25,7 @@ function ServerCard({ server }: { server: ServerInfo }) {
return (
{server.name}{server.role}} style={{ height: '100%' }}>
-
+
@@ -33,11 +37,10 @@ function ServerCard({ server }: { server: ServerInfo }) {
-
+
CPU · {server.cpu.cores}核