Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix(networks): render inspect view as YAML via shared inspectview#359

Merged
clangenb merged 1 commit into
mainfrom
fix/network-inspect-yaml-view
May 11, 2026
Merged

fix(networks): render inspect view as YAML via shared inspectview#359
clangenb merged 1 commit into
mainfrom
fix/network-inspect-yaml-view

Conversation

@eldara-cruncher
Copy link
Copy Markdown
Collaborator

Fixes #356.

Summary

  • The network inspect view (i key) used a custom inline JSON viewer that just dumped json.Indent output — it was the only resource view doing this.
  • Every other resource view in the project (services/nodes/secrets/configs/stacks/contexts) routes through the shared inspectview package, which parses JSON and renders a styled YAML-style document with ctrl+f search + n/N navigation, app-level / filter, and raw/yaml toggle.
  • This PR reroutes the network i action through inspectview too, so users get a properly formatted document instead of raw JSON, with the same controls already used elsewhere in the TUI.
  • Removes ~350 lines of duplicated inspect plumbing (state, viewport, search mode, render path) from views/networks.

Before:

{
  "Network": {
    "Name": "my-overlay-net",
    "Id": "abc123…",
    "Driver": "overlay",
    …

After (via shared inspectview):

Network: my-overlay-net  [YAML]

Network:
  Name: my-overlay-net
  Id: abc123…
  Scope: swarm
  Driver: overlay
  IPAM:
    Driver: default
    Config:
      [0]:
        Subnet: 10.0.0.0/24
Services:
  [0]: whoami

Test plan

  • go build ./... — clean
  • go test ./... — all unit tests pass
  • golangci-lint run ./... --build-tags=integration — 0 issues
  • Manual: open networks view, press i on a network → confirm YAML rendering, ctrl+f search, / filter, r raw toggle, esc back

🤖 Generated with Claude Code

The networks view shipped its own JSON viewer that just rendered
json.Indent output, while every other resource view delegates to
the shared `inspectview` (services/nodes/secrets/configs/stacks/
contexts). Reroute the network 'i' action through inspectview so
the user gets the same YAML-style document, ctrl+f search with
n/N navigation, app-level / filter, and raw toggle.

Drops ~350 lines of duplicated inspect plumbing.
Copy link
Copy Markdown
Collaborator

@clangenb clangenb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, works.

@clangenb clangenb merged commit 8d1a0f5 into main May 11, 2026
13 of 16 checks passed
@eldara-cruncher eldara-cruncher deleted the fix/network-inspect-yaml-view branch June 5, 2026 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

network inspect view

2 participants