fix(ui): убрать неиспользуемый код прежней таблицы мониторинга

This commit is contained in:
Denozordec committed 2026-10-07 15:57:53 +07:00
1 parent e4f951175c
commit 65c63e2860
4 files changed
+10 -45

No files matched your search

+1 -43
View File
@@ -44,7 +44,7 @@ import {
RefreshCwIcon, PlusIcon, SearchIcon, XIcon,
ChevronDownIcon, ChevronRightIcon,
TrashIcon, ArrowRightIcon,
CpuIcon, HardDriveIcon, ThermometerIcon, ClockIcon,
CpuIcon, HardDriveIcon,
AlertCircleIcon, ServerIcon, PauseIcon, PlayIcon,
ArrowUpIcon, ArrowDownIcon, ArrowUpDownIcon,
ServerCrashIcon, ChevronUpIcon, DownloadIcon,
@@ -142,7 +142,6 @@ function ProbePingRttDetailChart({
const minVal = Math.min(...chartPts)
const span = Math.max(1, maxVal - minVal) * 1.08
const y0 = minVal - (span - (maxVal - minVal)) / 2
const y1 = y0 + span
const xAt = (i: number) => pad.l + (chartPts.length <= 1 ? iw / 2 : (i / (chartPts.length - 1)) * iw)
const yAt = (v: number) => pad.t + (1 - (v - y0) / span) * ih
const lineD = chartPts
@@ -812,18 +811,6 @@ function fmtUptime(sec: number): string {
return `${m}м`
}
function resPctColor(pct: number, warn = 70, crit = 85): string {
if (pct >= crit) return "text-red-600 dark:text-red-400"
if (pct >= warn) return "text-amber-600 dark:text-amber-400"
return "text-emerald-600 dark:text-emerald-400"
}
function resBarColor(pct: number, warn = 70, crit = 85): string {
if (pct >= crit) return "bg-red-500"
if (pct >= warn) return "bg-amber-500"
return "bg-emerald-500"
}
const BOARD_MAP: Record<string, string> = {
"jump-host": "RB5009UG+S+IN",
"exit-node": "RB4011iGS+RM",
@@ -855,32 +842,6 @@ const INIT_RESOURCES: ServerResource[] = mockServers.map(s => {
}
})
// ── MiniBar ───────────────────────────────────────────────────────────────────
function MiniBar({ pct, warn = 70, crit = 85, className }: {
pct: number; warn?: number; crit?: number; className?: string
}) {
return (
<div className={cn("h-1.5 rounded-full bg-muted overflow-hidden", className)}>
<div
className={cn("h-full rounded-full transition-all duration-700", resBarColor(pct, warn, crit))}
style={{ width: `${Math.min(100, Math.max(0, pct))}%` }}
/>
</div>
)
}
// ── Sort indicator ─────────────────────────────────────────────────────────────
type ResSortKey = "name" | "cpu" | "ram" | "hdd" | "uptime" | "temp"
function SortIcon({ k, sortKey, sortAsc }: { k: ResSortKey; sortKey: ResSortKey; sortAsc: boolean }) {
if (sortKey !== k) return <ArrowUpDownIcon className="size-3 opacity-25 ml-0.5" />
return sortAsc
? <ArrowUpIcon className="size-3 ml-0.5 text-foreground" />
: <ArrowDownIcon className="size-3 ml-0.5 text-foreground" />
}
// ── ResourcesTab ──────────────────────────────────────────────────────────────
type ResTypeFilter = "all" | "jump-host" | "exit-node" | "home-router"
@@ -1138,7 +1099,6 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
useEffect(() => {
if (liveApi) return
// eslint-disable-next-line react-hooks/set-state-in-effect
setAllServers(mockServers)
setProbes(mockProbesWithSavedStars(INIT_PROBES))
setResources(INIT_RESOURCES)
@@ -1329,14 +1289,12 @@ function UptimePageContent({ selectedProbeId, allProbesHref }: { selectedProbeId
useEffect(() => {
if (!sheetOpen) return
if (!newSrcId || !selectableSources.some(s => s.id === newSrcId)) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setNewSrcId(selectableSources[0]?.id ?? "")
}
}, [sheetOpen, newSrcId, selectableSources])
useEffect(() => {
if (!sheetOpen || !newSrcId) {
// eslint-disable-next-line react-hooks/set-state-in-effect
setSrcInterfaces([])
setNewSrcInterface("")
return