SNMP discovery updates continued
This commit is contained in:
@@ -3,7 +3,7 @@ import { CheckSquare, Network, RefreshCw, Router, Search, Square } from "lucide-
|
||||
|
||||
import { api } from "../api/client";
|
||||
import { Button } from "../components/Button";
|
||||
import type { SnmpCredentialProfile, SnmpDiscoveryItem, SnmpDiscoveryResult } from "../types/api";
|
||||
import type { SnmpCredentialProfile, SnmpDiscoveredInterface, SnmpDiscoveryItem, SnmpDiscoveryResult } from "../types/api";
|
||||
|
||||
interface DiscoveryPageProps {
|
||||
token: string;
|
||||
@@ -169,8 +169,8 @@ export function DiscoveryPage({ token }: DiscoveryPageProps) {
|
||||
result.interfaces.map((item) => (
|
||||
<div key={item.index} className="grid gap-2 p-4 md:grid-cols-[1fr_120px_120px_120px] md:items-center">
|
||||
<div>
|
||||
<div className="font-medium">{item.name}</div>
|
||||
<div className="text-sm text-slate-400">{item.description || "No description"}</div>
|
||||
<div className="font-medium">{item.label}</div>
|
||||
<div className="text-sm text-slate-400">{interfaceContext(item)}</div>
|
||||
</div>
|
||||
<Status value={item.admin_status || "unknown"} />
|
||||
<Status value={item.oper_status || "unknown"} />
|
||||
@@ -268,6 +268,11 @@ function friendlyItemType(value: string) {
|
||||
return value.replaceAll("_", " ");
|
||||
}
|
||||
|
||||
function interfaceContext(item: SnmpDiscoveredInterface) {
|
||||
const details = [item.name, item.description].filter((value, index, values) => value && values.indexOf(value) === index);
|
||||
return details.length ? details.join(" - ") : "No description";
|
||||
}
|
||||
|
||||
function formatCapabilities(capabilities: Record<string, boolean>) {
|
||||
const labels: Record<string, string> = {
|
||||
interfaces: "interfaces",
|
||||
|
||||
Reference in New Issue
Block a user