mirror of
https://github.com/coder/coder.git
synced 2025-07-12 00:14:10 +00:00
feat: support devcontainer agents in ui and unify backend (#18332)
This commit consolidates two container endpoints on the backend and improves the frontend devcontainer support by showing names and displaying apps as appropriate. With this change, the frontend now has knowledge of the subagent and we can also display things like port forwards. The frontend was updated to show dev container labels on the border as well as subagent connection status. The recreation flow was also adjusted a bit to show placeholder app icons when relevant. Support for apps was also added, although these are still WIP on the backend. And the port forwarding utility was added in since the sub agents now provide the necessary info. Fixes coder/internal#666
This commit is contained in:
committed by
GitHub
parent
cda9208580
commit
97474bb28b
@ -393,12 +393,6 @@ func (c *Client) WorkspaceAgentListeningPorts(ctx context.Context, agentID uuid.
|
||||
return listeningPorts, json.NewDecoder(res.Body).Decode(&listeningPorts)
|
||||
}
|
||||
|
||||
// WorkspaceAgentDevcontainersResponse is the response to the devcontainers
|
||||
// request.
|
||||
type WorkspaceAgentDevcontainersResponse struct {
|
||||
Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
|
||||
}
|
||||
|
||||
// WorkspaceAgentDevcontainerStatus is the status of a devcontainer.
|
||||
type WorkspaceAgentDevcontainerStatus string
|
||||
|
||||
@ -422,6 +416,15 @@ type WorkspaceAgentDevcontainer struct {
|
||||
Status WorkspaceAgentDevcontainerStatus `json:"status"`
|
||||
Dirty bool `json:"dirty"`
|
||||
Container *WorkspaceAgentContainer `json:"container,omitempty"`
|
||||
Agent *WorkspaceAgentDevcontainerAgent `json:"agent,omitempty"`
|
||||
}
|
||||
|
||||
// WorkspaceAgentDevcontainerAgent represents the sub agent for a
|
||||
// devcontainer.
|
||||
type WorkspaceAgentDevcontainerAgent struct {
|
||||
ID uuid.UUID `json:"id" format:"uuid"`
|
||||
Name string `json:"name"`
|
||||
Directory string `json:"directory"`
|
||||
}
|
||||
|
||||
// WorkspaceAgentContainer describes a devcontainer of some sort
|
||||
@ -450,14 +453,6 @@ type WorkspaceAgentContainer struct {
|
||||
// Volumes is a map of "things" mounted into the container. Again, this
|
||||
// is somewhat implementation-dependent.
|
||||
Volumes map[string]string `json:"volumes"`
|
||||
// DevcontainerStatus is the status of the devcontainer, if this
|
||||
// container is a devcontainer. This is used to determine if the
|
||||
// devcontainer is running, stopped, starting, or in an error state.
|
||||
DevcontainerStatus WorkspaceAgentDevcontainerStatus `json:"devcontainer_status,omitempty"`
|
||||
// DevcontainerDirty is true if the devcontainer configuration has changed
|
||||
// since the container was created. This is used to determine if the
|
||||
// container needs to be rebuilt.
|
||||
DevcontainerDirty bool `json:"devcontainer_dirty"`
|
||||
}
|
||||
|
||||
func (c *WorkspaceAgentContainer) Match(idOrName string) bool {
|
||||
@ -486,6 +481,8 @@ type WorkspaceAgentContainerPort struct {
|
||||
// WorkspaceAgentListContainersResponse is the response to the list containers
|
||||
// request.
|
||||
type WorkspaceAgentListContainersResponse struct {
|
||||
// Devcontainers is a list of devcontainers visible to the workspace agent.
|
||||
Devcontainers []WorkspaceAgentDevcontainer `json:"devcontainers"`
|
||||
// Containers is a list of containers visible to the workspace agent.
|
||||
Containers []WorkspaceAgentContainer `json:"containers"`
|
||||
// Warnings is a list of warnings that may have occurred during the
|
||||
|
Reference in New Issue
Block a user