Repository navigation
feat(tui): interfaces first-class — selectable detail tabs + cable-path visualizer (0.9.0) - #64
Merged
Merged
Conversation
Add ObjectKind::Interface as a navigation/detail target (not part of the global search fan-out — interfaces need a device for context). A device's interfaces (i) and cables (c) tabs are now selectable lists: Enter opens the interface's detail (its attributes + cable-path trace), the same InterfaceView the CLI renders, with a navigable link back to the device. Cable rows open the local interface (where the full trace lives). IfaceRow/CableRow gain a non-serialized id (the JSON/CSV/MCP device contract is unchanged). Services (s) stay plain text — they have no detail view to open. Wires the new variant through as_str, subtitle_header, object_web_url, and both load_detail paths.
Draw an interface's cable trace as a vertical A↔Z diagram (each termination on its own line, joined by a cable segment carrying its descriptor — label · type · length · status, from fields the trace JSON already returns). A through-panel hop whose near end repeats the prior far end isn't doubled. In the TUI it's a dedicated, scrollable 'cable path' tab on the new interface detail; the body holds the attributes + VLAN/connection/IP sections. The CLI 'nbox interface' output renders the diagram under the Cable Path heading. The flat, machine-readable 'trace' lines remain the JSON form (diagram is not serialized), so the JSON contract is unchanged.
…its label
NetBox's interface-trace serializer sends the cable with display_url
(not display) and frequently an empty label, so cable_label() found no
name and the diagram showed only the status (e.g. '┿ connected').
Fall back to NetBox's canonical '#<id>' so the cable identity survives
('┿ #4120 · connected'). Verified against a live 4.6 instance.
render_detail only painted the selection cursor + rows for details that carry a header card (VRF, route-target); every other detail (device/prefix/vlan/site/rack) fell into the text-only path, so its navigable tabs — interfaces/cables/IPs/VLANs/children — showed as plain text with no cursor despite having row targets. Pin the tab bar (and any header card) in a fixed band whenever the detail has tabs or a header, and render the active section through one shared builder (detail_section_lines) so rows get the gutter/highlight everywhere. detail_content_lines follows suit (the tab bar no longer counts as scrollable content). Regression test added.
The Cables tab and interface 'Connected To' showed only the remote port
('swp2 -> swp2'), never the remote device. NetBox carries the far device
nested under each connected endpoint, so capture it (BriefObject.device)
and render endpoints as 'device port' — you can now see where a cable
goes ('swp2 → mgmt-core-02a-... swp2').
Redraw the cable-path diagram as a vertical A↔Z chain: the near end on
top (A), the far end on the bottom (Z), the device emphasized over its
port, and each cable segment between. A patch panel in the path (its two
faces share a device) collapses to one pass-through stop (front → rear);
an unterminated side renders explicitly. Tests updated.
…llow-up Document the 0.9.0 work under [Unreleased] (renamed to [0.9.0] at ship): interfaces first-class in the TUI, the cable-path visualizer, far-device cable views, and the header-less-detail row-render fix — calling out the cable-row format change (→ + far device) per review. Roadmap a future 'interface journal' item (needs by-id resolution + a journal kind entry), the one review suggestion that's a feature rather than a nit.
The far-device enrichment feeds the serialized connected_to too, not just the display — correct the earlier 'JSON unchanged' wording to scope it to shape (the id fields stay non-serialized) and call out the label content change to nbox interface/device JSON + MCP nbox_get.
The browse rail rendered the full per-kind count right-aligned, so on a big instance a wide number was clipped to its first digit(s) (e.g. '● Devices 3' for 30142). Humanize counts — exact below 1000, then k/M with one decimal under ten (30k, 2.6M) — so the count column always fits. Truncates rather than rounds (no 9.99k → 10.0k jump).
NAV_WIDTH was a fixed 16 cols, sized for a 2-digit count — even with
humanized counts, 'Prefixes' (8) + bullet + a 302k/2.1M count overflowed,
clipping long-label counts ('Devices 3', 'Prefixes' with none). Widen to
20 (inner 16: gutter + bullet + longest label + gap + a 4-col count).
Per PR #64 review: device names should stay visually stable, so cable endpoint labels (Cables tab, interface Connected-To, the A↔Z diagram, the interface detail title) now use the bare device name (BriefObject::name_label / term_one preferring `name`) instead of NetBox's display, which appends an asset tag like '(m057545)'. The asset tag still lives in the object's own detail fields. Cable status in the diagram is title-cased ('connected' → 'Connected'), idempotent for already-cased choice labels. Roadmap a filtered-only cable browse.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
0.9.0 — UX completeness. Makes device interfaces first-class in the TUI, which unlocks both queued UX items. Two commits.
Slice 1 — interfaces become first-class navigable objects (
f9947af)ObjectKind::Interface, a navigation/detail target only (not added to the global search fan-out — interfaces need a device for context).i) and cables (c) tabs are now selectable lists:Enteropens the interface's detail (its attributes + cable-path trace), with a navigable link back to the device. Cable rows open the local interface (where the full trace lives).IfaceRow/CableRowgain a non-serializedid→ thenbox deviceJSON/CSV/MCP contract is unchanged.s) stay plain text — they have no detail view to open; a highlight-but-inert cursor would be worse UX than clean text.as_str,subtitle_header,object_web_url, and bothload_detailpaths.Slice 2 — cable-path visualizer (
d568b17)┿cable segment carryinglabel · type · length · status— from fields the trace JSON already returns but the flat renderer ignored). Through-panel hops aren't doubled.nbox interfacerenders the diagram under the Cable Path heading.tracelines remain the machine-readable JSON form (the diagram is#[serde(skip)]), so the JSON contract is unchanged.Verification
cargo fmt --all --check✓cargo clippy --all-targets --all-features -- -D warnings✓ (pedantic gate)cargo clippy --all-targets --no-default-features -- -D warnings✓cargo testboth feature modes ✓ (789 + integration, 0 failed)interface.json,device_detail.json) unchanged by design.Smoke test
Open a device →
i/ctabs are now navigable (j/k + Enter) → an interface detail with a "cable path" tab. Alsonbox interface <device> <iface>for the CLI diagram.