优化组件页面代码
This commit is contained in:
@@ -1,21 +1,21 @@
|
||||
'use client'
|
||||
import {useState, useEffect} from 'react'
|
||||
import Link from 'next/link'
|
||||
"use client"
|
||||
import Link from "next/link"
|
||||
import { useEffect, useState } from "react"
|
||||
|
||||
// 定义节点数据接口
|
||||
interface ProxyNode {
|
||||
id: string;
|
||||
ipAddress: string;
|
||||
id: string
|
||||
ipAddress: string
|
||||
location: {
|
||||
country: string;
|
||||
region: string;
|
||||
};
|
||||
type: string;
|
||||
status: 'online' | 'offline' | 'warning';
|
||||
responseTime: number;
|
||||
lastCheckTime: string;
|
||||
pool: string;
|
||||
isStatic: boolean;
|
||||
country: string
|
||||
region: string
|
||||
}
|
||||
type: string
|
||||
status: "online" | "offline" | "warning"
|
||||
responseTime: number
|
||||
lastCheckTime: string
|
||||
pool: string
|
||||
isStatic: boolean
|
||||
}
|
||||
|
||||
export type ProxyNodesPageProps = {}
|
||||
@@ -24,101 +24,101 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
const [loading, setLoading] = useState<boolean>(true)
|
||||
|
||||
const [nodes, setNodes] = useState<ProxyNode[]>([])
|
||||
const [searchTerm, setSearchTerm] = useState<string>('')
|
||||
const [filterStatus, setFilterStatus] = useState<string>('all')
|
||||
const [filterType, setFilterType] = useState<string>('all')
|
||||
const [filterPool, setFilterPool] = useState<string>('all')
|
||||
const [searchTerm, setSearchTerm] = useState<string>("")
|
||||
const [filterStatus, setFilterStatus] = useState<string>("all")
|
||||
const [filterType, setFilterType] = useState<string>("all")
|
||||
const [filterPool, setFilterPool] = useState<string>("all")
|
||||
|
||||
// 模拟数据加载
|
||||
useEffect(() => {
|
||||
setTimeout(() => {
|
||||
setNodes([
|
||||
{
|
||||
id: 'ip-1',
|
||||
ipAddress: '203.45.167.82',
|
||||
location: {country: '美国', region: '纽约'},
|
||||
type: '数据中心',
|
||||
status: 'online',
|
||||
id: "ip-1",
|
||||
ipAddress: "203.45.167.82",
|
||||
location: { country: "美国", region: "纽约" },
|
||||
type: "数据中心",
|
||||
status: "online",
|
||||
responseTime: 126,
|
||||
lastCheckTime: '2024-05-10 15:30:22',
|
||||
pool: '北美专用池',
|
||||
lastCheckTime: "2024-05-10 15:30:22",
|
||||
pool: "北美专用池",
|
||||
isStatic: true,
|
||||
},
|
||||
{
|
||||
id: 'ip-2',
|
||||
ipAddress: '185.72.193.54',
|
||||
location: {country: '德国', region: '法兰克福'},
|
||||
type: '住宅',
|
||||
status: 'online',
|
||||
id: "ip-2",
|
||||
ipAddress: "185.72.193.54",
|
||||
location: { country: "德国", region: "法兰克福" },
|
||||
type: "住宅",
|
||||
status: "online",
|
||||
responseTime: 158,
|
||||
lastCheckTime: '2024-05-10 15:28:45',
|
||||
pool: '欧洲高速池',
|
||||
lastCheckTime: "2024-05-10 15:28:45",
|
||||
pool: "欧洲高速池",
|
||||
isStatic: false,
|
||||
},
|
||||
{
|
||||
id: 'ip-3',
|
||||
ipAddress: '118.96.244.105',
|
||||
location: {country: '新加坡', region: '中心区'},
|
||||
type: '移动',
|
||||
status: 'warning',
|
||||
id: "ip-3",
|
||||
ipAddress: "118.96.244.105",
|
||||
location: { country: "新加坡", region: "中心区" },
|
||||
type: "移动",
|
||||
status: "warning",
|
||||
responseTime: 312,
|
||||
lastCheckTime: '2024-05-10 15:25:12',
|
||||
pool: '亚太地区池',
|
||||
lastCheckTime: "2024-05-10 15:25:12",
|
||||
pool: "亚太地区池",
|
||||
isStatic: false,
|
||||
},
|
||||
{
|
||||
id: 'ip-4',
|
||||
ipAddress: '45.178.29.6',
|
||||
location: {country: '加拿大', region: '多伦多'},
|
||||
type: '数据中心',
|
||||
status: 'online',
|
||||
id: "ip-4",
|
||||
ipAddress: "45.178.29.6",
|
||||
location: { country: "加拿大", region: "多伦多" },
|
||||
type: "数据中心",
|
||||
status: "online",
|
||||
responseTime: 143,
|
||||
lastCheckTime: '2024-05-10 15:23:08',
|
||||
pool: '北美专用池',
|
||||
lastCheckTime: "2024-05-10 15:23:08",
|
||||
pool: "北美专用池",
|
||||
isStatic: false,
|
||||
},
|
||||
{
|
||||
id: 'ip-5',
|
||||
ipAddress: '79.114.83.201',
|
||||
location: {country: '英国', region: '伦敦'},
|
||||
type: '住宅',
|
||||
status: 'offline',
|
||||
id: "ip-5",
|
||||
ipAddress: "79.114.83.201",
|
||||
location: { country: "英国", region: "伦敦" },
|
||||
type: "住宅",
|
||||
status: "offline",
|
||||
responseTime: 0,
|
||||
lastCheckTime: '2024-05-10 15:18:33',
|
||||
pool: '欧洲高速池',
|
||||
lastCheckTime: "2024-05-10 15:18:33",
|
||||
pool: "欧洲高速池",
|
||||
isStatic: false,
|
||||
},
|
||||
{
|
||||
id: 'ip-6',
|
||||
ipAddress: '164.83.219.47',
|
||||
location: {country: '日本', region: '东京'},
|
||||
type: '住宅',
|
||||
status: 'online',
|
||||
id: "ip-6",
|
||||
ipAddress: "164.83.219.47",
|
||||
location: { country: "日本", region: "东京" },
|
||||
type: "住宅",
|
||||
status: "online",
|
||||
responseTime: 87,
|
||||
lastCheckTime: '2024-05-10 15:15:21',
|
||||
pool: '亚太地区池',
|
||||
lastCheckTime: "2024-05-10 15:15:21",
|
||||
pool: "亚太地区池",
|
||||
isStatic: true,
|
||||
},
|
||||
{
|
||||
id: 'ip-7',
|
||||
ipAddress: '221.67.93.143',
|
||||
location: {country: '中国', region: '上海'},
|
||||
type: '移动',
|
||||
status: 'online',
|
||||
id: "ip-7",
|
||||
ipAddress: "221.67.93.143",
|
||||
location: { country: "中国", region: "上海" },
|
||||
type: "移动",
|
||||
status: "online",
|
||||
responseTime: 104,
|
||||
lastCheckTime: '2024-05-10 15:10:46',
|
||||
pool: '亚太地区池',
|
||||
lastCheckTime: "2024-05-10 15:10:46",
|
||||
pool: "亚太地区池",
|
||||
isStatic: false,
|
||||
},
|
||||
{
|
||||
id: 'ip-8',
|
||||
ipAddress: '37.209.148.72',
|
||||
location: {country: '法国', region: '巴黎'},
|
||||
type: '数据中心',
|
||||
status: 'warning',
|
||||
id: "ip-8",
|
||||
ipAddress: "37.209.148.72",
|
||||
location: { country: "法国", region: "巴黎" },
|
||||
type: "数据中心",
|
||||
status: "warning",
|
||||
responseTime: 276,
|
||||
lastCheckTime: '2024-05-10 15:05:19',
|
||||
pool: '欧洲高速池',
|
||||
lastCheckTime: "2024-05-10 15:05:19",
|
||||
pool: "欧洲高速池",
|
||||
isStatic: false,
|
||||
},
|
||||
])
|
||||
@@ -129,16 +129,16 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
// 过滤节点数据
|
||||
const filteredNodes = nodes.filter(node => {
|
||||
return (
|
||||
(searchTerm === '' ||
|
||||
(searchTerm === "" ||
|
||||
node.ipAddress.includes(searchTerm) ||
|
||||
node.location.country.includes(searchTerm) ||
|
||||
node.pool.includes(searchTerm)) &&
|
||||
(filterStatus === 'all' ||
|
||||
(filterStatus === 'online' && node.status === 'online') ||
|
||||
(filterStatus === 'offline' && node.status === 'offline') ||
|
||||
(filterStatus === 'warning' && node.status === 'warning')) &&
|
||||
(filterType === 'all' || node.type === filterType) &&
|
||||
(filterPool === 'all' || node.pool === filterPool)
|
||||
(filterStatus === "all" ||
|
||||
(filterStatus === "online" && node.status === "online") ||
|
||||
(filterStatus === "offline" && node.status === "offline") ||
|
||||
(filterStatus === "warning" && node.status === "warning")) &&
|
||||
(filterType === "all" || node.type === filterType) &&
|
||||
(filterPool === "all" || node.pool === filterPool)
|
||||
)
|
||||
})
|
||||
|
||||
@@ -151,25 +151,43 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="flex justify-between items-center">
|
||||
<h1 className="text-lg font-bold text-gray-900">节点列表</h1>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
className="bg-gray-50 border border-gray-200 text-gray-700 px-3 py-1.5 rounded-md text-sm font-medium flex items-center hover:bg-gray-100">
|
||||
<svg className="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<button className="bg-gray-50 border border-gray-200 text-gray-700 px-3 py-1.5 rounded-md text-sm font-medium flex items-center hover:bg-gray-100">
|
||||
<svg
|
||||
className="w-4 h-4 mr-1"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
|
||||
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"/>
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-8l-4-4m0 0L8 8m4-4v12"
|
||||
/>
|
||||
</svg>
|
||||
导出
|
||||
</button>
|
||||
<button
|
||||
className="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1.5 rounded-md text-sm font-medium flex items-center">
|
||||
<svg className="w-4 h-4 mr-1" fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
||||
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M12 6v6m0 0v6m0-6h6m-6 0H6"/>
|
||||
<button className="bg-blue-600 hover:bg-blue-700 text-white px-3 py-1.5 rounded-md text-sm font-medium flex items-center">
|
||||
<svg
|
||||
className="w-4 h-4 mr-1"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M12 6v6m0 0v6m0-6h6m-6 0H6"
|
||||
/>
|
||||
</svg>
|
||||
添加节点
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="mt-1 text-sm text-gray-500">查看和管理所有代理IP资源,支持多维度筛选</p>
|
||||
<p className="mt-1 text-sm text-gray-500">
|
||||
查看和管理所有代理IP资源,支持多维度筛选
|
||||
</p>
|
||||
</div>
|
||||
|
||||
{/* 统计信息区域 - 色块风格 */}
|
||||
@@ -178,15 +196,25 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="bg-white p-4">
|
||||
<div className="flex items-center">
|
||||
<div className="w-10 h-10 flex items-center justify-center bg-blue-50 rounded-md">
|
||||
<svg className="h-5 w-5 text-blue-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg
|
||||
className="h-5 w-5 text-blue-600"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
|
||||
d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9"/>
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M21 12a9 9 0 01-9 9m9-9a9 9 0 00-9-9m9 9H3m9 9a9 9 0 01-9-9m9 9c1.657 0 3-4.03 3-9s-1.343-9-3-9m0 18c-1.657 0-3-4.03-3-9s1.343-9 3-9"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<p className="text-xs font-medium text-gray-500">总IP数量</p>
|
||||
<div className="text-lg font-semibold text-gray-900">152,487</div>
|
||||
<div className="text-lg font-semibold text-gray-900">
|
||||
152,487
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -195,18 +223,30 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="bg-white p-4">
|
||||
<div className="flex items-center">
|
||||
<div className="w-10 h-10 flex items-center justify-center bg-green-50 rounded-md">
|
||||
<svg className="h-5 w-5 text-green-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg
|
||||
className="h-5 w-5 text-green-600"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
|
||||
d="M5 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"/>
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M5 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<div className="flex items-center">
|
||||
<p className="text-xs font-medium text-gray-500">在线IP</p>
|
||||
<span className="ml-2 text-xs font-medium text-green-600">91%</span>
|
||||
<span className="ml-2 text-xs font-medium text-green-600">
|
||||
91%
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-lg font-semibold text-gray-900">
|
||||
138,954
|
||||
</div>
|
||||
<div className="text-lg font-semibold text-gray-900">138,954</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -215,16 +255,26 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="bg-white p-4">
|
||||
<div className="flex items-center">
|
||||
<div className="w-10 h-10 flex items-center justify-center bg-indigo-50 rounded-md">
|
||||
<svg className="h-5 w-5 text-indigo-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg
|
||||
className="h-5 w-5 text-indigo-600"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
|
||||
d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"/>
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M19 11H5m14 0a2 2 0 012 2v6a2 2 0 01-2 2H5a2 2 0 01-2-2v-6a2 2 0 012-2m14 0V9a2 2 0 00-2-2M5 11V9a2 2 0 012-2m0 0V5a2 2 0 012-2h6a2 2 0 012 2v2M7 7h10"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<div className="flex items-center">
|
||||
<p className="text-xs font-medium text-gray-500">IP池分布</p>
|
||||
<span className="ml-2 text-xs font-medium text-gray-500">5个地区</span>
|
||||
<span className="ml-2 text-xs font-medium text-gray-500">
|
||||
5个地区
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-lg font-semibold text-gray-900">12</div>
|
||||
</div>
|
||||
@@ -235,16 +285,26 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="bg-white p-4">
|
||||
<div className="flex items-center">
|
||||
<div className="w-10 h-10 flex items-center justify-center bg-red-50 rounded-md">
|
||||
<svg className="h-5 w-5 text-red-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
||||
<svg
|
||||
className="h-5 w-5 text-red-600"
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
stroke="currentColor"
|
||||
>
|
||||
<path
|
||||
strokeLinecap="round" strokeLinejoin="round" strokeWidth={2}
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"/>
|
||||
strokeLinecap="round"
|
||||
strokeLinejoin="round"
|
||||
strokeWidth={2}
|
||||
d="M12 9v2m0 4h.01m-6.938 4h13.856c1.54 0 2.502-1.667 1.732-3L13.732 4c-.77-1.333-2.694-1.333-3.464 0L3.34 16c-.77 1.333.192 3 1.732 3z"
|
||||
/>
|
||||
</svg>
|
||||
</div>
|
||||
<div className="ml-3">
|
||||
<div className="flex items-center">
|
||||
<p className="text-xs font-medium text-gray-500">异常IP</p>
|
||||
<span className="ml-2 text-xs font-medium text-red-600">需检查</span>
|
||||
<span className="ml-2 text-xs font-medium text-red-600">
|
||||
需检查
|
||||
</span>
|
||||
</div>
|
||||
<div className="text-lg font-semibold text-gray-900">1,205</div>
|
||||
</div>
|
||||
@@ -285,7 +345,7 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<select
|
||||
className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm bg-white text-gray-700 flex-1"
|
||||
value={filterStatus}
|
||||
onChange={(e) => setFilterStatus(e.target.value)}
|
||||
onChange={e => setFilterStatus(e.target.value)}
|
||||
>
|
||||
<option value="all">全部状态</option>
|
||||
<option value="online">在线</option>
|
||||
@@ -296,7 +356,7 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<select
|
||||
className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm bg-white text-gray-700 flex-1"
|
||||
value={filterType}
|
||||
onChange={(e) => setFilterType(e.target.value)}
|
||||
onChange={e => setFilterType(e.target.value)}
|
||||
>
|
||||
<option value="all">全部类型</option>
|
||||
<option value="数据中心">数据中心</option>
|
||||
@@ -307,7 +367,7 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<select
|
||||
className="px-3 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-1 focus:ring-blue-500 focus:border-blue-500 text-sm bg-white text-gray-700 flex-1"
|
||||
value={filterPool}
|
||||
onChange={(e) => setFilterPool(e.target.value)}
|
||||
onChange={e => setFilterPool(e.target.value)}
|
||||
>
|
||||
<option value="all">全部池</option>
|
||||
<option value="北美专用池">北美专用池</option>
|
||||
@@ -327,7 +387,14 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
fill="none"
|
||||
viewBox="0 0 24 24"
|
||||
>
|
||||
<circle className="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" strokeWidth="4"></circle>
|
||||
<circle
|
||||
className="opacity-25"
|
||||
cx="12"
|
||||
cy="12"
|
||||
r="10"
|
||||
stroke="currentColor"
|
||||
strokeWidth="4"
|
||||
></circle>
|
||||
<path
|
||||
className="opacity-75"
|
||||
fill="currentColor"
|
||||
@@ -340,79 +407,133 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<table className="min-w-full">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
IP地址
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
位置
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
类型
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
状态
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
响应时间
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-left text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
所属池
|
||||
</th>
|
||||
<th scope="col" className="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50">
|
||||
<th
|
||||
scope="col"
|
||||
className="px-4 py-3 text-right text-xs font-medium text-gray-500 uppercase tracking-wider border-b border-gray-200 bg-gray-50"
|
||||
>
|
||||
操作
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody className="divide-y divide-gray-200">
|
||||
{filteredNodes.map((node, index) => (
|
||||
<tr key={node.id} className={index % 2 === 0 ? 'bg-white' : 'bg-gray-50'}>
|
||||
<tr
|
||||
key={node.id}
|
||||
className={index % 2 === 0 ? "bg-white" : "bg-gray-50"}
|
||||
>
|
||||
<td className="px-4 py-3 whitespace-nowrap text-sm">
|
||||
<div className="flex items-center">
|
||||
<span className={`w-2 h-2 rounded-full mr-2 ${
|
||||
node.status === 'online' ? 'bg-green-500' :
|
||||
node.status === 'offline' ? 'bg-red-500' : 'bg-yellow-500'
|
||||
}`}></span>
|
||||
<span className="font-medium text-gray-900">{node.ipAddress}</span>
|
||||
<span
|
||||
className={`w-2 h-2 rounded-full mr-2 ${
|
||||
node.status === "online"
|
||||
? "bg-green-500"
|
||||
: node.status === "offline"
|
||||
? "bg-red-500"
|
||||
: "bg-yellow-500"
|
||||
}`}
|
||||
></span>
|
||||
<span className="font-medium text-gray-900">
|
||||
{node.ipAddress}
|
||||
</span>
|
||||
{node.isStatic && (
|
||||
<span className="ml-2 inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium bg-blue-100 text-blue-800">
|
||||
静态
|
||||
</span>
|
||||
静态
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="px-4 py-3 whitespace-nowrap text-sm">
|
||||
<div className="text-gray-900">{node.location.country}</div>
|
||||
<div className="text-xs text-gray-500">{node.location.region}</div>
|
||||
<div className="text-gray-900">
|
||||
{node.location.country}
|
||||
</div>
|
||||
<div className="text-xs text-gray-500">
|
||||
{node.location.region}
|
||||
</div>
|
||||
</td>
|
||||
|
||||
<td className="px-4 py-3 whitespace-nowrap">
|
||||
<span className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
||||
node.type === '数据中心' ? 'bg-purple-100 text-purple-800' :
|
||||
node.type === '住宅' ? 'bg-blue-100 text-blue-800' : 'bg-indigo-100 text-indigo-800'
|
||||
}`}>
|
||||
{node.type}
|
||||
</span>
|
||||
<span
|
||||
className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
||||
node.type === "数据中心"
|
||||
? "bg-purple-100 text-purple-800"
|
||||
: node.type === "住宅"
|
||||
? "bg-blue-100 text-blue-800"
|
||||
: "bg-indigo-100 text-indigo-800"
|
||||
}`}
|
||||
>
|
||||
{node.type}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td className="px-4 py-3 whitespace-nowrap text-sm">
|
||||
<span className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
||||
node.status === 'online' ? 'bg-green-100 text-green-800' :
|
||||
node.status === 'offline' ? 'bg-red-100 text-red-800' : 'bg-yellow-100 text-yellow-800'
|
||||
}`}>
|
||||
{node.status === 'online' ? '在线' : node.status === 'offline' ? '离线' : '异常'}
|
||||
</span>
|
||||
<span
|
||||
className={`inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium ${
|
||||
node.status === "online"
|
||||
? "bg-green-100 text-green-800"
|
||||
: node.status === "offline"
|
||||
? "bg-red-100 text-red-800"
|
||||
: "bg-yellow-100 text-yellow-800"
|
||||
}`}
|
||||
>
|
||||
{node.status === "online"
|
||||
? "在线"
|
||||
: node.status === "offline"
|
||||
? "离线"
|
||||
: "异常"}
|
||||
</span>
|
||||
</td>
|
||||
|
||||
<td className="px-4 py-3 whitespace-nowrap text-sm text-gray-500">
|
||||
{node.responseTime > 0 ? (
|
||||
<div className="flex items-center">
|
||||
<span className={`font-medium ${
|
||||
node.responseTime < 150 ? 'text-green-600' :
|
||||
node.responseTime < 250 ? 'text-yellow-600' : 'text-red-600'
|
||||
}`}>
|
||||
{node.responseTime} ms
|
||||
</span>
|
||||
<span
|
||||
className={`font-medium ${
|
||||
node.responseTime < 150
|
||||
? "text-green-600"
|
||||
: node.responseTime < 250
|
||||
? "text-yellow-600"
|
||||
: "text-red-600"
|
||||
}`}
|
||||
>
|
||||
{node.responseTime} ms
|
||||
</span>
|
||||
</div>
|
||||
) : (
|
||||
<span className="text-gray-400">-</span>
|
||||
@@ -424,7 +545,10 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
</td>
|
||||
|
||||
<td className="px-4 py-3 whitespace-nowrap text-right text-sm font-medium space-x-2">
|
||||
<Link href={`/proxy/nodes/${node.id}`} className="text-blue-600 hover:text-blue-900">
|
||||
<Link
|
||||
href={`/proxy/nodes/${node.id}`}
|
||||
className="text-blue-600 hover:text-blue-900"
|
||||
>
|
||||
详情
|
||||
</Link>
|
||||
<button className="text-gray-600 hover:text-gray-900">
|
||||
@@ -442,47 +566,53 @@ export default function ProxyNodesPage(props: ProxyNodesPageProps) {
|
||||
<div className="bg-gray-50 px-5 py-3 border-t border-gray-200">
|
||||
<div className="flex items-center justify-between">
|
||||
<div className="text-sm text-gray-700">
|
||||
显示 <span className="font-medium">1</span> 至 <span className="font-medium">8</span> 条,共 <span
|
||||
className="font-medium">152,487</span> 条结果
|
||||
显示 <span className="font-medium">1</span> 至{" "}
|
||||
<span className="font-medium">8</span> 条,共{" "}
|
||||
<span className="font-medium">152,487</span> 条结果
|
||||
</div>
|
||||
<div>
|
||||
<nav className="relative z-0 inline-flex -space-x-px">
|
||||
<button
|
||||
className="relative inline-flex items-center px-2 py-1.5 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
|
||||
<svg className="h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||
<button className="relative inline-flex items-center px-2 py-1.5 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
|
||||
<svg
|
||||
className="h-4 w-4"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z"
|
||||
clipRule="evenodd"/>
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
<button
|
||||
className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium hover:bg-gray-50 text-blue-600 bg-blue-50 border-blue-300">
|
||||
<button className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium hover:bg-gray-50 text-blue-600 bg-blue-50 border-blue-300">
|
||||
1
|
||||
</button>
|
||||
<button
|
||||
className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
<button className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
2
|
||||
</button>
|
||||
<button
|
||||
className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
<button className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
3
|
||||
</button>
|
||||
<span
|
||||
className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700">
|
||||
...
|
||||
</span>
|
||||
<button
|
||||
className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
<span className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700">
|
||||
...
|
||||
</span>
|
||||
<button className="relative inline-flex items-center px-3 py-1.5 border border-gray-300 bg-white text-sm font-medium text-gray-700 hover:bg-gray-50">
|
||||
152
|
||||
</button>
|
||||
<button
|
||||
className="relative inline-flex items-center px-2 py-1.5 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
|
||||
<svg className="h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor">
|
||||
<button className="relative inline-flex items-center px-2 py-1.5 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
|
||||
<svg
|
||||
className="h-4 w-4"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 20 20"
|
||||
fill="currentColor"
|
||||
>
|
||||
<path
|
||||
fillRule="evenodd"
|
||||
d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z"
|
||||
clipRule="evenodd"/>
|
||||
clipRule="evenodd"
|
||||
/>
|
||||
</svg>
|
||||
</button>
|
||||
</nav>
|
||||
|
||||
Reference in New Issue
Block a user