fix: Windows-Seite identisches Format wie Firewalls (Spaltenwahl, Sort, MiniBar)
This commit is contained in:
parent
4e21fe3c4e
commit
1f8fda6a83
@ -1,149 +1,300 @@
|
|||||||
import { useEffect, useState, useMemo } from 'react'
|
import { useEffect, useState, useMemo, useRef } from 'react'
|
||||||
import api from '../api/client'
|
import api from '../api/client'
|
||||||
import StatusBadge from '../components/StatusBadge'
|
import StatusBadge from '../components/StatusBadge'
|
||||||
import WindowsPanel from '../components/WindowsPanel'
|
import WindowsPanel from '../components/WindowsPanel'
|
||||||
import { Search, Monitor } from 'lucide-react'
|
import { Search, ChevronUp, ChevronDown, Settings2, X } from 'lucide-react'
|
||||||
|
|
||||||
function fmtPct(v) {
|
const ALL_COLUMNS = [
|
||||||
if (v === null || v === undefined) return '—'
|
{ id: 'customer', label: 'Kunde', default: true },
|
||||||
return `${Number(v).toFixed(0)}%`
|
{ id: 'name', label: 'Name', default: true, locked: true },
|
||||||
|
{ id: 'hostname', label: 'Hostname', default: false },
|
||||||
|
{ id: 'os', label: 'OS', default: true },
|
||||||
|
{ id: 'version', label: 'Agent Version', default: true },
|
||||||
|
{ id: 'ip', label: 'IP', default: true },
|
||||||
|
{ id: 'uptime', label: 'Uptime', default: true },
|
||||||
|
{ id: 'cpu', label: 'CPU', default: true },
|
||||||
|
{ id: 'ram', label: 'RAM', default: true },
|
||||||
|
{ id: 'disk', label: 'Disk (C:)', default: true },
|
||||||
|
{ id: 'lastresponse', label: 'Letzter Kontakt', default: false },
|
||||||
|
]
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'rmm-windows-columns'
|
||||||
|
|
||||||
|
function loadColumns() {
|
||||||
|
try {
|
||||||
|
const saved = localStorage.getItem(STORAGE_KEY)
|
||||||
|
if (saved) return JSON.parse(saved)
|
||||||
|
} catch {}
|
||||||
|
return ALL_COLUMNS.filter(c => c.default).map(c => c.id)
|
||||||
}
|
}
|
||||||
|
|
||||||
function fmtUptime(s) {
|
function saveColumns(cols) {
|
||||||
if (!s) return '—'
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(cols))
|
||||||
const d = Math.floor(s / 86400)
|
|
||||||
const h = Math.floor((s % 86400) / 3600)
|
|
||||||
return d > 0 ? `${d}d ${h}h` : `${h}h`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function fmtBytes(b) {
|
function formatUptime(seconds) {
|
||||||
if (!b) return '—'
|
if (!seconds) return '—'
|
||||||
if (b >= 1073741824) return `${(b / 1073741824).toFixed(1)} GB`
|
const d = Math.floor(seconds / 86400)
|
||||||
return `${(b / 1048576).toFixed(0)} MB`
|
const h = Math.floor((seconds % 86400) / 3600)
|
||||||
|
const m = Math.floor((seconds % 3600) / 60)
|
||||||
|
if (d > 0) return `${d}d ${h}h`
|
||||||
|
return `${h}h ${m}m`
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Windows() {
|
export default function Windows() {
|
||||||
const [agents, setAgents] = useState([])
|
const [agents, setAgents] = useState([])
|
||||||
const [customers, setCustomers] = useState([])
|
const [customers, setCustomers] = useState([])
|
||||||
const [details, setDetails] = useState({})
|
const [agentDetails, setAgentDetails] = useState({})
|
||||||
const [search, setSearch] = useState('')
|
const [search, setSearch] = useState('')
|
||||||
const [selectedId, setSelectedId] = useState(null)
|
const [loading, setLoading] = useState(true)
|
||||||
const [loading, setLoading] = useState(true)
|
const [sortKey, setSortKey] = useState('customer')
|
||||||
|
const [sortDir, setSortDir] = useState('asc')
|
||||||
|
const [selectedId, setSelectedId] = useState(null)
|
||||||
|
const [visibleCols, setVisibleCols] = useState(loadColumns)
|
||||||
|
const [showColMenu, setShowColMenu] = useState(false)
|
||||||
|
const colMenuRef = useRef(null)
|
||||||
|
|
||||||
const reload = () => {
|
const reload = () => {
|
||||||
Promise.all([api.getAgents(), api.getCustomers()]).then(([a, c]) => {
|
Promise.all([api.getAgents(), api.getCustomers()])
|
||||||
const win = a.filter(ag => ag.platform === 'windows')
|
.then(([a, c]) => {
|
||||||
setAgents(win)
|
setAgents((a || []).filter(ag => ag.platform === 'windows'))
|
||||||
setCustomers(c)
|
setCustomers(c || [])
|
||||||
setLoading(false)
|
|
||||||
win.forEach(ag => {
|
|
||||||
api.getAgent(ag.id).then(d => setDetails(prev => ({ ...prev, [ag.id]: d })))
|
|
||||||
})
|
})
|
||||||
})
|
.finally(() => setLoading(false))
|
||||||
}
|
}
|
||||||
|
|
||||||
useEffect(() => { reload() }, [])
|
useEffect(() => {
|
||||||
|
reload()
|
||||||
|
const iv = setInterval(reload, 30000)
|
||||||
|
return () => clearInterval(iv)
|
||||||
|
}, [])
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
agents.forEach(a => {
|
||||||
|
if (!agentDetails[a.id]) {
|
||||||
|
api.getAgent(a.id).then(d =>
|
||||||
|
setAgentDetails(prev => ({ ...prev, [a.id]: d }))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}, [agents])
|
||||||
|
|
||||||
|
// Close column menu on click outside
|
||||||
|
useEffect(() => {
|
||||||
|
const handler = (e) => {
|
||||||
|
if (colMenuRef.current && !colMenuRef.current.contains(e.target)) setShowColMenu(false)
|
||||||
|
}
|
||||||
|
document.addEventListener('mousedown', handler)
|
||||||
|
return () => document.removeEventListener('mousedown', handler)
|
||||||
|
}, [])
|
||||||
|
|
||||||
const customerMap = useMemo(() =>
|
const customerMap = useMemo(() =>
|
||||||
Object.fromEntries(customers.map(c => [c.id, c])), [customers])
|
Object.fromEntries((customers || []).map(c => [c.id, c])), [customers])
|
||||||
|
|
||||||
const rows = useMemo(() => agents.map(a => {
|
const toggleSort = (key) => {
|
||||||
const d = details[a.id]
|
if (sortKey === key) setSortDir(d => d === 'asc' ? 'desc' : 'asc')
|
||||||
const sys = d?.system_data
|
else { setSortKey(key); setSortDir('asc') }
|
||||||
const win = sys?.windows
|
}
|
||||||
|
|
||||||
|
const toggleCol = (id) => {
|
||||||
|
const col = ALL_COLUMNS.find(c => c.id === id)
|
||||||
|
if (col?.locked) return
|
||||||
|
const next = visibleCols.includes(id)
|
||||||
|
? visibleCols.filter(c => c !== id)
|
||||||
|
: [...visibleCols, id]
|
||||||
|
setVisibleCols(next)
|
||||||
|
saveColumns(next)
|
||||||
|
}
|
||||||
|
|
||||||
|
const isColVisible = (id) => visibleCols.includes(id)
|
||||||
|
|
||||||
|
const enriched = useMemo(() => agents.map(a => {
|
||||||
|
const d = agentDetails[a.id]
|
||||||
|
const win = d?.system_data?.windows
|
||||||
const cust = a.customer_id ? customerMap[a.customer_id] : null
|
const cust = a.customer_id ? customerMap[a.customer_id] : null
|
||||||
const memUsed = win?.memory?.total_bytes > 0
|
|
||||||
? ((win.memory.total_bytes - win.memory.available_bytes) / win.memory.total_bytes * 100)
|
const memPct = win?.memory?.total_bytes > 0
|
||||||
|
? ((win.memory.total_bytes - (win.memory.available_bytes ?? 0)) / win.memory.total_bytes * 100)
|
||||||
: null
|
: null
|
||||||
|
|
||||||
|
// Ersten FIXED-Disk nehmen (meistens C:)
|
||||||
const disk = win?.disks?.[0]
|
const disk = win?.disks?.[0]
|
||||||
|
const diskPct = disk?.used_percent ?? null
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: a.id, name: a.name, status: a.status,
|
...a,
|
||||||
version: a.agent_version,
|
customer: cust,
|
||||||
customer: cust ? `${cust.number} — ${cust.name}` : '—',
|
customerName: cust?.name || '',
|
||||||
customer_id: a.customer_id,
|
customerNumber: cust?.number || '',
|
||||||
os: win?.os_version?.replace('Windows ', 'Win ') || '—',
|
os: win?.os_version || '—',
|
||||||
cpu: win?.cpu?.load_percent != null ? fmtPct(win.cpu.load_percent) : '—',
|
cpuPct: win?.cpu?.load_percent ?? null,
|
||||||
ram: memUsed != null ? fmtPct(memUsed) : '—',
|
memPct,
|
||||||
disk: disk?.used_percent != null ? fmtPct(disk.used_percent) : '—',
|
diskPct,
|
||||||
uptime: fmtUptime(win?.uptime_seconds),
|
uptime: win?.uptime_seconds || 0,
|
||||||
lastHB: a.last_heartbeat
|
|
||||||
? new Date(a.last_heartbeat).toLocaleString('de-DE', { day: '2-digit', month: '2-digit', hour: '2-digit', minute: '2-digit' })
|
|
||||||
: '—',
|
|
||||||
}
|
}
|
||||||
}), [agents, details, customerMap])
|
}), [agents, agentDetails, customerMap])
|
||||||
|
|
||||||
const filtered = useMemo(() => {
|
const filtered = useMemo(() => {
|
||||||
if (!search) return rows
|
let list = enriched
|
||||||
const q = search.toLowerCase()
|
if (search) {
|
||||||
return rows.filter(r =>
|
const q = search.toLowerCase()
|
||||||
r.name.toLowerCase().includes(q) ||
|
list = list.filter(a =>
|
||||||
r.customer.toLowerCase().includes(q) ||
|
a.name.toLowerCase().includes(q) ||
|
||||||
r.os.toLowerCase().includes(q)
|
(a.ip || '').toLowerCase().includes(q) ||
|
||||||
)
|
(a.hostname || '').toLowerCase().includes(q) ||
|
||||||
}, [rows, search])
|
a.customerName.toLowerCase().includes(q) ||
|
||||||
|
a.customerNumber.toLowerCase().includes(q)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
list = [...list].sort((a, b) => {
|
||||||
|
let va, vb
|
||||||
|
switch (sortKey) {
|
||||||
|
case 'customer': va = a.customerNumber; vb = b.customerNumber; break
|
||||||
|
case 'name': va = a.name; vb = b.name; break
|
||||||
|
case 'os': va = a.os; vb = b.os; break
|
||||||
|
case 'version': va = a.agent_version || ''; vb = b.agent_version || ''; break
|
||||||
|
case 'uptime': return sortDir === 'asc' ? a.uptime - b.uptime : b.uptime - a.uptime
|
||||||
|
case 'cpu': return sortDir === 'asc' ? (a.cpuPct ?? 999) - (b.cpuPct ?? 999) : (b.cpuPct ?? -1) - (a.cpuPct ?? -1)
|
||||||
|
case 'ram': return sortDir === 'asc' ? (a.memPct ?? 999) - (b.memPct ?? 999) : (b.memPct ?? -1) - (a.memPct ?? -1)
|
||||||
|
case 'disk': return sortDir === 'asc' ? (a.diskPct ?? 999) - (b.diskPct ?? 999) : (b.diskPct ?? -1) - (a.diskPct ?? -1)
|
||||||
|
case 'status': va = a.status; vb = b.status; break
|
||||||
|
default: va = a.name; vb = b.name
|
||||||
|
}
|
||||||
|
if (typeof va === 'string') {
|
||||||
|
const cmp = va.localeCompare(vb)
|
||||||
|
return sortDir === 'asc' ? cmp : -cmp
|
||||||
|
}
|
||||||
|
return 0
|
||||||
|
})
|
||||||
|
return list
|
||||||
|
}, [enriched, search, sortKey, sortDir])
|
||||||
|
|
||||||
if (loading) return <div className="p-6 text-gray-500">Laden...</div>
|
const SortHeader = ({ label, k, className = '' }) => (
|
||||||
|
<th
|
||||||
|
className={`px-3 py-2 font-medium cursor-pointer hover:text-gray-300 select-none ${className}`}
|
||||||
|
onClick={() => toggleSort(k)}
|
||||||
|
>
|
||||||
|
<span className="inline-flex items-center gap-1">
|
||||||
|
{label}
|
||||||
|
{sortKey === k && (sortDir === 'asc'
|
||||||
|
? <ChevronUp className="w-3 h-3" />
|
||||||
|
: <ChevronDown className="w-3 h-3" />
|
||||||
|
)}
|
||||||
|
</span>
|
||||||
|
</th>
|
||||||
|
)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex flex-col h-full">
|
<div className="space-y-4">
|
||||||
{/* Toolbar */}
|
<div className="flex items-center justify-between">
|
||||||
<div className="flex items-center gap-3 px-6 py-3 border-b border-gray-800">
|
<h1 className="text-xl font-bold text-white">Windows Agents ({agents.length})</h1>
|
||||||
<Monitor className="w-4 h-4 text-sky-400" />
|
</div>
|
||||||
<span className="text-sm font-medium text-white">Windows Agents</span>
|
|
||||||
<span className="text-xs text-gray-500">({agents.length})</span>
|
<div className="flex items-center gap-3">
|
||||||
<div className="flex-1" />
|
<div className="relative flex-1">
|
||||||
<div className="relative">
|
<Search className="absolute left-3 top-2.5 w-4 h-4 text-gray-500" />
|
||||||
<Search className="absolute left-2.5 top-2 w-3.5 h-3.5 text-gray-500" />
|
|
||||||
<input
|
<input
|
||||||
value={search} onChange={e => setSearch(e.target.value)}
|
type="text"
|
||||||
placeholder="Suchen..."
|
placeholder="Suchen (Name, IP, Kunde)..."
|
||||||
className="pl-8 pr-3 py-1.5 bg-gray-800 border border-gray-700 rounded text-sm text-white focus:outline-none focus:border-sky-500 w-56"
|
value={search}
|
||||||
|
onChange={e => setSearch(e.target.value)}
|
||||||
|
className="w-full bg-gray-900 border border-gray-800 rounded pl-10 pr-3 py-2 text-sm text-white placeholder-gray-600 focus:outline-none focus:border-sky-500"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{/* Spalten-Toggle */}
|
||||||
|
<div className="relative" ref={colMenuRef}>
|
||||||
|
<button
|
||||||
|
onClick={() => setShowColMenu(!showColMenu)}
|
||||||
|
className="p-2 bg-gray-900 border border-gray-800 rounded hover:border-gray-600 text-gray-400 hover:text-white transition-colors"
|
||||||
|
title="Spalten konfigurieren"
|
||||||
|
>
|
||||||
|
<Settings2 className="w-4 h-4" />
|
||||||
|
</button>
|
||||||
|
{showColMenu && (
|
||||||
|
<div className="absolute right-0 top-full mt-1 z-50 bg-gray-900 border border-gray-700 rounded-lg shadow-xl py-2 w-52">
|
||||||
|
<div className="px-3 py-1 text-xs text-gray-500 font-medium">Sichtbare Spalten</div>
|
||||||
|
{ALL_COLUMNS.map(col => (
|
||||||
|
<label
|
||||||
|
key={col.id}
|
||||||
|
className={`flex items-center gap-2 px-3 py-1.5 text-sm cursor-pointer hover:bg-gray-800 ${col.locked ? 'opacity-50 cursor-not-allowed' : ''}`}
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
type="checkbox"
|
||||||
|
checked={visibleCols.includes(col.id)}
|
||||||
|
onChange={() => toggleCol(col.id)}
|
||||||
|
disabled={col.locked}
|
||||||
|
className="rounded border-gray-600 bg-gray-800 text-sky-500 focus:ring-sky-500 focus:ring-offset-0"
|
||||||
|
/>
|
||||||
|
<span className="text-gray-300">{col.label}</span>
|
||||||
|
</label>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Tabelle */}
|
{loading ? (
|
||||||
<div className="flex-1 overflow-auto">
|
<div className="text-gray-500">Laden...</div>
|
||||||
{filtered.length === 0 ? (
|
) : (
|
||||||
<div className="p-8 text-center text-gray-500">
|
<div className="bg-gray-900 rounded-lg border border-gray-800 overflow-x-auto">
|
||||||
{agents.length === 0 ? 'Keine Windows Agents registriert' : 'Keine Ergebnisse'}
|
<table className="w-full text-xs whitespace-nowrap">
|
||||||
</div>
|
|
||||||
) : (
|
|
||||||
<table className="w-full text-sm">
|
|
||||||
<thead>
|
<thead>
|
||||||
<tr className="border-b border-gray-800 text-left">
|
<tr className="border-b border-gray-800 text-left text-gray-500 text-xs">
|
||||||
{['Status', 'Name', 'Kunde', 'OS', 'Version', 'CPU', 'RAM', 'Disk', 'Uptime', 'Letzter Kontakt'].map(h => (
|
<th className="px-2 py-1.5 font-medium w-8"></th>
|
||||||
<th key={h} className="px-4 py-2 text-xs text-gray-500 font-medium whitespace-nowrap">{h}</th>
|
{isColVisible('customer') && <SortHeader label="KUNDE" k="customer" />}
|
||||||
))}
|
{isColVisible('name') && <SortHeader label="NAME" k="name" />}
|
||||||
|
{isColVisible('hostname') && <th className="px-3 py-2 font-medium">HOSTNAME</th>}
|
||||||
|
{isColVisible('os') && <SortHeader label="OS" k="os" />}
|
||||||
|
{isColVisible('version') && <SortHeader label="AGENT" k="version" />}
|
||||||
|
{isColVisible('ip') && <th className="px-3 py-2 font-medium">IP</th>}
|
||||||
|
{isColVisible('uptime') && <SortHeader label="UPTIME" k="uptime" />}
|
||||||
|
{isColVisible('cpu') && <SortHeader label="CPU" k="cpu" />}
|
||||||
|
{isColVisible('ram') && <SortHeader label="RAM" k="ram" />}
|
||||||
|
{isColVisible('disk') && <SortHeader label="DISK" k="disk" />}
|
||||||
|
{isColVisible('lastresponse') && <th className="px-3 py-2 font-medium">LETZTER KONTAKT</th>}
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody className="divide-y divide-gray-800/50">
|
<tbody className="divide-y divide-gray-800">
|
||||||
{filtered.map(r => (
|
{filtered.map(a => (
|
||||||
<tr
|
<tr
|
||||||
key={r.id}
|
key={a.id}
|
||||||
onClick={() => setSelectedId(r.id)}
|
onClick={() => setSelectedId(a.id)}
|
||||||
className={`hover:bg-gray-800/50 cursor-pointer transition-colors ${selectedId === r.id ? 'bg-gray-800/70' : ''}`}
|
className={`hover:bg-gray-800/50 transition-colors cursor-pointer ${selectedId === a.id ? 'bg-gray-800/70' : ''}`}
|
||||||
>
|
>
|
||||||
<td className="px-4 py-2">
|
<td className="px-2 py-1.5"><StatusBadge status={a.status} size="dot" /></td>
|
||||||
<StatusBadge status={r.status} size="dot" />
|
{isColVisible('customer') && (
|
||||||
</td>
|
<td className="px-3 py-1.5 text-gray-400">
|
||||||
<td className="px-4 py-2 text-white font-medium whitespace-nowrap">{r.name}</td>
|
{a.customer
|
||||||
<td className="px-4 py-2 text-gray-400 whitespace-nowrap text-xs">{r.customer}</td>
|
? <span className="text-sky-400">{a.customerNumber}</span>
|
||||||
<td className="px-4 py-2 text-gray-300 whitespace-nowrap text-xs">{r.os}</td>
|
: <span className="text-gray-600">—</span>}
|
||||||
<td className="px-4 py-2 text-gray-500 text-xs font-mono">{r.version ? `v${r.version}` : '—'}</td>
|
</td>
|
||||||
<td className="px-4 py-2 text-gray-300 text-xs">{r.cpu}</td>
|
)}
|
||||||
<td className="px-4 py-2 text-gray-300 text-xs">{r.ram}</td>
|
{isColVisible('name') && <td className="px-3 py-1.5 text-white font-medium">{a.name}</td>}
|
||||||
<td className="px-4 py-2 text-gray-300 text-xs">{r.disk}</td>
|
{isColVisible('hostname') && <td className="px-3 py-1.5 text-gray-400">{a.hostname || '—'}</td>}
|
||||||
<td className="px-4 py-2 text-gray-500 text-xs">{r.uptime}</td>
|
{isColVisible('os') && <td className="px-3 py-1.5 text-gray-400">{a.os}</td>}
|
||||||
<td className="px-4 py-2 text-gray-600 text-xs whitespace-nowrap">{r.lastHB}</td>
|
{isColVisible('version') && <td className="px-3 py-1.5 text-gray-500">{a.agent_version ? `v${a.agent_version}` : '—'}</td>}
|
||||||
|
{isColVisible('ip') && <td className="px-3 py-1.5 text-gray-400">{a.ip || '—'}</td>}
|
||||||
|
{isColVisible('uptime') && <td className="px-3 py-1.5 text-gray-400">{formatUptime(a.uptime)}</td>}
|
||||||
|
{isColVisible('cpu') && <td className="px-3 py-1.5"><MiniBar value={a.cpuPct} /></td>}
|
||||||
|
{isColVisible('ram') && <td className="px-3 py-1.5"><MiniBar value={a.memPct} /></td>}
|
||||||
|
{isColVisible('disk') && <td className="px-3 py-1.5"><MiniBar value={a.diskPct} /></td>}
|
||||||
|
{isColVisible('lastresponse') && (
|
||||||
|
<td className="px-3 py-1.5 text-gray-500">
|
||||||
|
{a.last_heartbeat ? new Date(a.last_heartbeat).toLocaleString('de-DE') : '—'}
|
||||||
|
</td>
|
||||||
|
)}
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
)}
|
{filtered.length === 0 && (
|
||||||
</div>
|
<div className="text-center py-8 text-gray-500">
|
||||||
|
{search ? 'Keine Treffer' : 'Keine Windows Agents registriert'}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
{/* Panel */}
|
|
||||||
{selectedId && (
|
{selectedId && (
|
||||||
<WindowsPanel
|
<WindowsPanel
|
||||||
agentId={selectedId}
|
agentId={selectedId}
|
||||||
@ -155,3 +306,16 @@ export default function Windows() {
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function MiniBar({ value }) {
|
||||||
|
if (value === null || value === undefined) return <span className="text-gray-600 text-[10px]">—</span>
|
||||||
|
const color = value > 90 ? 'bg-red-500' : value > 70 ? 'bg-yellow-500' : value > 50 ? 'bg-blue-500' : 'bg-green-500'
|
||||||
|
return (
|
||||||
|
<div className="flex items-center gap-1">
|
||||||
|
<div className="w-10 h-1 bg-gray-800 rounded overflow-hidden">
|
||||||
|
<div className={`h-full rounded ${color}`} style={{ width: `${Math.min(value, 100)}%` }} />
|
||||||
|
</div>
|
||||||
|
<span className="text-[10px] text-gray-400">{value.toFixed(0)}%</span>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user