Add allocation port visibility option - #2511
Conversation
|
All contributors have signed the CLA ✍️ ✅ |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe PR adds allocation port visibility state, exposes it through APIs, resets it during allocation removal, and replaces raw address displays with ChangesAllocation port visibility
Sequence Diagram(s)sequenceDiagram
participant Admin
participant AllocationResource
participant NetworkAllocationController
participant Allocation
participant API
Admin->>AllocationResource: Set show_port
AllocationResource->>Allocation: Persist visibility preference
API->>NetworkAllocationController: Request allocation data
NetworkAllocationController->>Allocation: Read show_port and display_address
NetworkAllocationController-->>API: Return allocation attributes
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/Filament/App/Resources/Servers/Pages/ListServers.php`:
- Around line 86-91: Update Allocation::display_address so the show_port=false
branch returns the optional alias when present and otherwise falls back to the
allocation IP without its port. Add a regression test covering an allocation
without an alias, and verify the shared accessor behavior used by the server
list, ServerOverview, and Livewire server entries.
In `@app/Http/Controllers/Api/Client/Servers/NetworkAllocationController.php`:
- Around line 140-148: Update the detachment update in the allocation deletion
flow to set is_locked to false alongside notes, show_port, and server_id. Extend
DeleteAllocationTest.php to assert the allocation is unlocked after deletion,
including the endpoint path that handles locked allocations.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8b127912-c85e-4c67-a665-a9bf144959e1
📒 Files selected for processing (15)
app/Filament/Admin/Resources/Servers/RelationManagers/AllocationsRelationManager.phpapp/Filament/App/Resources/Servers/Pages/ListServers.phpapp/Filament/Server/Resources/Allocations/AllocationResource.phpapp/Filament/Server/Widgets/ServerOverview.phpapp/Http/Controllers/Api/Client/Servers/NetworkAllocationController.phpapp/Models/Allocation.phpapp/Transformers/Api/Application/AllocationTransformer.phpapp/Transformers/Api/Client/AllocationTransformer.phpdatabase/migrations/2026_08_10_144038_add_show_port_to_allocations_table.phplang/en/admin/server.phpresources/views/livewire/server-entry-placeholder.blade.phpresources/views/livewire/server-entry.blade.phptests/Integration/Api/Client/Server/Allocation/DeleteAllocationTest.phptests/Integration/Api/Client/Server/NetworkAllocationControllerTest.phptests/Unit/Models/AllocationTest.php
| TextColumn::make('allocation.display_address') | ||
| ->label('') | ||
| ->badge() | ||
| ->visibleFrom('md') | ||
| ->copyable() | ||
| ->state(fn (Server $server) => $server->allocation->address ?? 'None'), | ||
| ->state(fn (Server $server) => $server->allocation->display_address ?? 'None'), |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Preserve the IP when no alias is set.
When show_port is false, Allocation::display_address returns alias. The alias is optional, so an allocation without an alias produces null. This column then displays None instead of the allocation IP without its port. The same accessor affects ServerOverview and both Livewire server entries.
Update Allocation::display_address to use the alias or the IP for the port-hidden case, and add a regression test.
Proposed fix
- get: fn () => $this->show_port ? $this->address : $this->alias,
+ get: fn () => $this->show_port ? $this->address : ($this->alias ?? $this->ip),🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/Filament/App/Resources/Servers/Pages/ListServers.php` around lines 86 -
91, Update Allocation::display_address so the show_port=false branch returns the
optional alias when present and otherwise falls back to the allocation IP
without its port. Add a regression test covering an allocation without an alias,
and verify the shared accessor behavior used by the server list, ServerOverview,
and Livewire server entries.
|
I have read the CLA Document and I hereby sign the CLA |
54be473 to
3432d9d
Compare
|
I like this idea and have thought about it for a couple years. I have NOT reviewed your implementation as of right now but am just letting everyone know that I want to push this PR through to get merged after code review and manual testing. |
|
Note This comment was generated by AI (Claude Code), not written by Lance. It has not been hand-verified line by line by a human maintainer. Treat it as a starting point for discussion — if anything below is wrong or you disagree with it, say so and a human will weigh in. It is not a formal blocking review. Thanks for the PR — the feature itself is a good idea. Hiding the port is a common ask for SRV-record and proxied setups (Velocity/BungeeCord and friends), and the scoping is sensible: display-only, default-on, admin views keep the real port, and the migration is clean and reversible so upgrades are a no-op. Three change requests before this is mergeable. 1. Two allocation-release paths bypass the new
|
Adds a Show port option to server allocations. It is enabled by default.
When disabled, users will only see the allocation IP or alias without the port. The port is still used internally, so server functionality is not affected.
I have read the CLA Document and I hereby sign the CLA