Repository navigation
feat(admin): edit an allocation and a credential from the panel - #14
Merged
Merged
Conversation
CreateClient trims the name and refuses an empty one; UpdateClient did neither, so a rename to whitespace blanked the credential's only label. The unique index is on (account_id, name), so a second blanked name would then fail with a conflict nobody could explain.
Both rows could only be toggled or destroyed: changing which machine holds a name, or what bandwidth it gets, meant releasing the allocation and reserving it again. The API already took the PATCH; only the panel had no way to send one. The edit swaps the row's action group for its fields, the same way a destructive action swaps it for a confirmation, so the row stays visible and no modal covers the table it edits. The pinned subdomain and port stay immutable, and bandwidth still resolves at registration, so a connected machine keeps its current limit until it reconnects -- the status line says so rather than leaving an operator to wonder why nothing moved.
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.
What
An allocation row and a credential row can now be edited in place from the admin panel.
The edit swaps the row's action group for its fields, the same way a destructive action swaps it for a confirmation: the row stays visible and no modal covers the table.
Why
Both rows could only be toggled or destroyed. Changing which machine holds a name, or what bandwidth it gets, meant releasing the allocation and reserving it again.
PATCH /api/reservations/{id}andPATCH /api/clients/{id}already accepted exactly these fields — only the panel had no way to send one.Also
Store.UpdateClientdid not trim or validate the name, so a rename to whitespace blanked the credential's only label;CreateClienthas always refused that. It now returnsclient name is required, a messageserverErroralready translates.Limits kept
min()resolved at registration, so a connected machine keeps its current limit until it reconnects. The status line says so.Testing
go test ./...— 351 tests, all passing, including a new store test for the blank rename.make demo: PATCH on a reservation (client + bandwidth), a credential rename, and a blank name rejected with 400.