TUI Improvements (url resolution, faster and refactored IP lookups)#36
Merged
TUI Improvements (url resolution, faster and refactored IP lookups)#36
Conversation
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.
Summary
bshortcut to open VPN gateways, tunnels, and BGP sessions in Cloud Console, with correct HA/Classic VPN URL differentiation. Refactoredvpn_view.gofrom a monolithic function into avpnViewStatestruct with extracted methods, reducing nesting and eliminating repeated code.ip_lookup_view.gofrom a 690-line monolithic function into anipLookupViewStatestruct with extracted methods. Deduplicated two identical spinner goroutines and two identical parallel search loops into single reusable methods.Changes
VPN view (
internal/tui/vpn_view.go)bkeyboard shortcut to open gateways, tunnels, and BGP sessions in Cloud Console&isHA=true, Classic VPN URLs do nothybrid/routers/bgpSession/{region}/{router}/{name}vpnViewStatestruct with status bar constants and helper methods (showTemporaryStatus,enterFilterMode,exitFilterMode,handleEscape,handleRuneKey, etc.)IP lookup optimization (
internal/gcp/ip_lookup_optimized.go,internal/gcp/ip_lookup_strategy.go)LookupIPAddressFast()uses cached subnet hints to narrow searches to specific regions/networksStrategyFastOnly,StrategySmartFallback(default),StrategyAlwaysCompletecmd/ip_lookup.go) and TUI use the optimized path with project pre-filteringIP lookup TUI refactoring (
internal/tui/ip_lookup_view.go)RunIPLookupViewreduced from 690 lines to 15 linesperformLookupreduced from ~300 lines to ~70 linesrunSearchSpinner()searchProjects()time.AfterFuncstatus restoration patterns merged intoshowTemporaryStatus()showDetailModal()from VPN viewCloud Console URL fixes (
internal/tui/actions.go,internal/tui/ip_lookup_view.go)regions/{region}/forwardingRules/{name}, global usesglobalForwardingRules/details/{name}compute/healthChecks/details/{name}(global) orcompute/healthChecks/details/regions/{region}/{name}(regional) instead of the generic list pagenetworking/routes/details/{name}(was falling through to dashboard)VPN tunnel search (
internal/gcp/search/vpn_tunnels.go)isHAdetail field based on whether tunnel uses HA VPN (GatewayLink) or Classic VPN (TargetGatewayLink)Cleanup
COVERAGE_SETUP.md,TUI.md)Test plan
bon a gateway, tunnel, and BGP session - verify correct Cloud Console pages open/), details (d), browser (b), help (?), escape handling all workbon a forwarding rule (regional and global), health check, and route - verify correct URLscompass ip lookup <private-ip>completes quickly with correct results