3import { useEffect, useState } from "react";
4import { apiClient } from "@/lib/client/apiClient";
5import { Icon } from '@/contexts/IconContext';
7interface TopologyEntry {
8 f141: string; // Computer Name
9 f110: number; // AppType#
10 f1110: string; // AppType
11 f1111: string; // Rank
12 f113: number; // PLevel
13 f144: number; // Location
14 f114: string; // Database Id
15 f131?: string; // IP Address
16 f151?: number; // IP Port
19export default function TopologyPage() {
20 const [topology, setTopology] = useState<TopologyEntry[]>([]);
21 const [loading, setLoading] = useState(true);
27 const loadTopology = async () => {
30 const result = await apiClient.getTopology();
32 if (result.success && result.data?.DATS) {
33 setTopology(result.data.DATS);
36 console.error("Error loading topology:", error);
44 <div className="p-6 min-h-screen">
45 <div className="animate-pulse space-y-4">
46 <div className="h-8 bg-surface-2 rounded w-1/4"></div>
47 <div className="h-64 bg-surface-2 rounded"></div>
54 <div className="p-6 min-h-screen">
56 <div className="mb-6">
57 <div className="flex items-center gap-4 mb-4">
59 href="/pages/settings/stores"
60 className="text-brand hover:text-brand2 flex items-center gap-2"
62 <Icon name="arrow_back" size={20} />
66 <h1 className="text-3xl font-bold text-text mb-2 flex items-center gap-3">
67 <Icon name="hub" size={32} />
70 <p className="text-muted">
71 Shows what has been detected running inside your network in recent history
75 {/* Topology Table */}
76 <div className="bg-surface rounded-lg shadow overflow-hidden">
77 <div className="overflow-x-auto">
78 <table className="w-full">
79 <thead className="bg-[var(--brand)] text-surface">
81 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
84 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
87 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
90 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
93 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
96 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
99 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
102 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
105 <th className="px-6 py-3 text-left text-xs font-medium text-muted uppercase tracking-wider">
110 <tbody className="bg-surface divide-y divide-gray-200">
111 {topology.length === 0 ? (
113 <td colSpan={9} className="px-6 py-8 text-center text-muted">
114 No topology data detected
118 topology.map((entry, index) => (
119 <tr key={index} className="hover:bg-surface-2">
120 <td className="px-6 py-4 whitespace-nowrap text-sm font-medium text-text">
123 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
126 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
129 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
132 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
135 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
138 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted font-mono text-xs">
141 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
144 <td className="px-6 py-4 whitespace-nowrap text-sm text-muted">
155 <div className="bg-surface-2 px-6 py-3 border-t">
156 <p className="text-sm text-muted">
157 Total systems detected: <span className="font-semibold">{topology.length}</span>