feat: add host rename form for admins - #146
Closed
samuelxanda wants to merge 2 commits into
Closed
Conversation
Operators could not set a friendly host name in the dashboard. Add a card-menu form that PATCHes displayName and refreshes the hosts query. Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Pull request overview
Adds a frontend-only host “Rename” capability (admin-gated) that uses the backend displayName field to show a dashboard-friendly label while keeping the agent hostname visible as secondary metadata.
Changes:
- Add
displayNameto theHostAPI type plus shared helpers for display/validation (hostDisplayName,validateHostDisplayName). - Add
PATCH /hosts/:idclient support (apiPatch,renameHost) and a React Query mutation hook to update/invalidate the hosts cache. - Update Hosts UI surfaces (Host cards, host select, search, details page) to render/search by display name.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| apps/web/src/types/api.ts | Adds optional displayName to Host type. |
| apps/web/src/services/hosts.ts | Adds renameHost() PATCH service call. |
| apps/web/src/services/hosts.test.ts | Adds unit test covering renameHost() PATCH payload. |
| apps/web/src/services/api.ts | Extends request client to support PATCH and exposes apiPatch. |
| apps/web/src/lib/host-name.ts | Introduces display-name formatting + validation utilities. |
| apps/web/src/lib/host-name.test.ts | Adds tests for display-name formatting + validation. |
| apps/web/src/hooks/useRenameHost.ts | Adds React Query mutation for rename + cache update/toast. |
| apps/web/src/hooks/useHostInventory.ts | Uses display name in container inventory host label derivation. |
| apps/web/src/features/hosts/HostsPage.tsx | Updates host search to include display name. |
| apps/web/src/features/hosts/HostDetailsPage.tsx | Updates titles/breadcrumbs/metadata to show display name while keeping hostname visible. |
| apps/web/src/components/RenameHostDialog.tsx | Adds modal dialog for renaming (validation + API errors). |
| apps/web/src/components/layout/Topbar.tsx | Updates global host search results to prefer display name and show hostname secondary. |
| apps/web/src/components/HostSelect.tsx | Updates host selector to show display name. |
| apps/web/src/components/HostCard.tsx | Adds admin-only Rename action + dialog and renders display name as card title with hostname secondary. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+20
to
+22
| queryClient.setQueryData<Host[]>(hostsQueryKey, (current) => | ||
| current?.map((host) => (host.id === updated.id ? { ...host, ...updated } : host)), | ||
| ) |
Comment on lines
47
to
53
| const all = hosts.flatMap((host, index) => | ||
| (results[index]?.data?.containers ?? []).map((container) => ({ | ||
| ...container, | ||
| hostId: host.id, | ||
| hostname: host.hostname, | ||
| hostname: hostDisplayName(host), | ||
| })), | ||
| ) |
samuelxanda
marked this pull request as draft
August 24, 2026 21:09
Avoid clearing the cached host list when React Query has no data yet, and keep the agent hostname searchable in container views. Co-authored-by: Cursor <cursoragent@cursor.com>
samuelxanda
marked this pull request as ready for review
August 24, 2026 21:36
Contributor
Author
|
Superseded by #149 on branch |
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
Add a rename action on the host card menu so admins can set a dashboard-friendly display name. The agent hostname stays visible as secondary metadata, and the hosts query updates without a full page reload.
Type of change
Areas touched
apps/server(NestJS)apps/web(React / Vite)apps/agent(Go)packages/protocol(shared WebSocket contracts)infrastructure/.github/workflowsdocsRelated issues
Closes #124
Depends on the API from #123 / #145 (
PATCH /api/hosts/:idanddisplayNameonGET /api/hosts).How to test
npm run test --workspace=@docksight/web -- src/lib/host-name.test.ts src/services/hosts.test.tsChecklist
docs/if module boundaries or the protocol changed.docs/decisions/if this is a larger architectural change.