import { useQuery } from '@tanstack/react-query' import api from '@/lib/api' import { MetricCard } from '@/components/MetricCard' import { LoadingSpinner } from '@/components/LoadingSpinner' import { cn } from '@/lib/utils' export function OverviewTab() { const { data, isLoading } = useQuery({ queryKey: ['admin-tenants'], queryFn: () => api.get('/admin/tenants'), }) if (isLoading) return const tenants = (data as any)?.data || [] const activeCount = tenants.filter((t: any) => t.status === 'active').length const inactiveCount = tenants.filter((t: any) => t.status === 'inactive').length return (
0 ? 'warn' : undefined} description="状态为 inactive 的租户" />

租户状态一览

{tenants.map((t: any) => (
{t.tenant_name} {t.tenant_id}
DB: {t.db_host}:{t.db_port} FRP: {t.frp_port} {t.status === 'active' ? '运行中' : '已停用'}
))} {tenants.length === 0 && (

暂无租户,请到「租户管理」创建

)}
) }