Skip to content

Topology view

Bubori Attila edited this page Aug 11, 2026 · 2 revisions

Topology Data Model & Known Quirks

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.

Node ID prefixes

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.

Connections (network_edges)

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
Loading

Rendering: type → visual style

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.

Bugs found and fixed (chronological)

These were all found and fixed while testing a fresh install - kept here for reference in case any are ever accidentally reverted.

  1. Crash on the very first connection ever created: edges[edges.length-1].id + 1 assumed at least one existing edge. On an empty edges array, edges.length - 1 evaluates to -1, and array[-1] is undefined in JavaScript (no negative indexing) - .id on undefined threw. Fixed with

Clone this wiki locally