-
Notifications
You must be signed in to change notification settings - Fork 0
Topology view
The Topology view (resources/views/topology/topology.blade.php) renders a force-directed graph (sigma.js + ForceAtlas2) of workstations, network devices, and network printers, plus the manually-drawn connections between them.
Every node/edge endpoint ID is a type prefix + numeric ID, e.g. ws42, nd7, pr3. This scheme is used consistently across the codebase (edge cleanup on delete, sigma.js filtering):
| Prefix | Entity |
|---|---|
ws |
Workstation |
nd |
Network Device |
pr |
Network Printer |
Client-side filtering (the checkboxes at the top of the page - Online/Offline/Unreachable/Network Printer) works by matching node.type against these same two-letter codes.
A connection between two nodes is a row with a source and a target (both prefixed IDs as above) and a type (utp, mono, multi, or historically empty - see below).
sequenceDiagram
participant U as Admin
participant JS as Topology page (sigma.js)
participant S as TopologyController
U->>JS: Right-click node A → select connection type
Note over JS: sourceNode = A.id, edgeAction = "addEdgeUTP"
U->>JS: Left-click node B
Note over JS: targetNode = B.id
JS->>S: action: addEdge (source, target, type)
S-->>S: NetworkEdges::create(...)
S-->>JS: OK
JS-->>JS: s.graph.addEdge(...) - render the line
On page load, each stored edge's type is mapped to a sigma.js rendering style via a switch statement:
type in DB |
Rendered as |
|---|---|
"mono" |
dotted line |
"multi" |
parallel line |
"black" |
dotted (legacy) |
anything else, incl. empty/null
|
plain solid line (this is also what UTP renders as) |
Because the default case already renders as a plain line, type = "utp" and type = "" look identical - this is intentional, not a bug, and lets older rows (saved before type was explicitly written for UTP - see below) keep displaying correctly.
These were all found and fixed while testing a fresh install - kept here for reference in case any are ever accidentally reverted.
-
Crash on the very first connection ever created:
edges[edges.length-1].id + 1assumed at least one existing edge. On an emptyedgesarray,edges.length - 1evaluates to-1, andarray[-1]isundefinedin JavaScript (no negative indexing) -.idonundefinedthrew. Fixed with