import React, { useEffect, useState } from "react"; import axios from "axios"; const Baseline = () => { const [data, setData] = useState([]); useEffect(() => { axios .get("/uploaded/baseline.csv") .then((res) => { const csv = res.data; const lines = csv.trim().split("\n"); const headers = lines[0].split(","); const rows = lines.slice(1).map((line) => { const values = line.split(","); return headers.reduce((obj, h, i) => { obj[h.trim()] = values[i].trim(); return obj; }, {}); }); setData(rows); }) .catch((err) => console.error("Error loading baseline CSV:", err)); }, []); const countByType = (pattern) => data.filter((row) => row["Operating System"]?.toLowerCase().includes(pattern)).length; return (

Network Baseline

{/* Summary Cards */}
{[ { label: "Windows", color: "bg-blue-600", pattern: "windows" }, { label: "Linux", color: "bg-green-600", pattern: "ubuntu" }, { label: "Servers", color: "bg-red-600", pattern: "server" }, { label: "Workstations", color: "bg-yellow-500", pattern: "workstation" }, ].map(({ label, color, pattern }) => (
{countByType(pattern)}
{label}
))}
{/* Table */}
{data.map((row, i) => ( ))}
Host Name Operating System IP Address FQDN
{row["Host Name"]} {row["Operating System"]} {row["IP Address"]} {row["Fdqn"]}
); }; export default Baseline;