mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
feat(site): allow recreating devcontainers and showing dirty status (#18049)
This change allows showing the devcontainer dirty status in the UI as well as a recreate button to update the devcontainer. Closes #16424
This commit is contained in:
Generated
+23
@@ -17201,6 +17201,14 @@ const docTemplate = `{
|
||||
"description": "DevcontainerDirty is true if the devcontainer configuration has changed\nsince the container was created. This is used to determine if the\ncontainer needs to be rebuilt.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"devcontainer_status": {
|
||||
"description": "DevcontainerStatus is the status of the devcontainer, if this\ncontainer is a devcontainer. This is used to determine if the\ndevcontainer is running, stopped, starting, or in an error state.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentDevcontainerStatus"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"description": "ID is the unique identifier of the container.",
|
||||
"type": "string"
|
||||
@@ -17265,6 +17273,21 @@ const docTemplate = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentDevcontainerStatus": {
|
||||
"type": "string",
|
||||
"enum": [
|
||||
"running",
|
||||
"stopped",
|
||||
"starting",
|
||||
"error"
|
||||
],
|
||||
"x-enum-varnames": [
|
||||
"WorkspaceAgentDevcontainerStatusRunning",
|
||||
"WorkspaceAgentDevcontainerStatusStopped",
|
||||
"WorkspaceAgentDevcontainerStatusStarting",
|
||||
"WorkspaceAgentDevcontainerStatusError"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceAgentHealth": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
Generated
+18
@@ -15706,6 +15706,14 @@
|
||||
"description": "DevcontainerDirty is true if the devcontainer configuration has changed\nsince the container was created. This is used to determine if the\ncontainer needs to be rebuilt.",
|
||||
"type": "boolean"
|
||||
},
|
||||
"devcontainer_status": {
|
||||
"description": "DevcontainerStatus is the status of the devcontainer, if this\ncontainer is a devcontainer. This is used to determine if the\ndevcontainer is running, stopped, starting, or in an error state.",
|
||||
"allOf": [
|
||||
{
|
||||
"$ref": "#/definitions/codersdk.WorkspaceAgentDevcontainerStatus"
|
||||
}
|
||||
]
|
||||
},
|
||||
"id": {
|
||||
"description": "ID is the unique identifier of the container.",
|
||||
"type": "string"
|
||||
@@ -15770,6 +15778,16 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"codersdk.WorkspaceAgentDevcontainerStatus": {
|
||||
"type": "string",
|
||||
"enum": ["running", "stopped", "starting", "error"],
|
||||
"x-enum-varnames": [
|
||||
"WorkspaceAgentDevcontainerStatusRunning",
|
||||
"WorkspaceAgentDevcontainerStatusStopped",
|
||||
"WorkspaceAgentDevcontainerStatusStarting",
|
||||
"WorkspaceAgentDevcontainerStatusError"
|
||||
]
|
||||
},
|
||||
"codersdk.WorkspaceAgentHealth": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
|
||||
@@ -956,7 +956,7 @@ func (api *API) workspaceAgentRecreateDevcontainer(rw http.ResponseWriter, r *ht
|
||||
}
|
||||
defer release()
|
||||
|
||||
err = agentConn.RecreateDevcontainer(ctx, container)
|
||||
m, err := agentConn.RecreateDevcontainer(ctx, container)
|
||||
if err != nil {
|
||||
if errors.Is(err, context.Canceled) {
|
||||
httpapi.Write(ctx, rw, http.StatusRequestTimeout, codersdk.Response{
|
||||
@@ -977,7 +977,7 @@ func (api *API) workspaceAgentRecreateDevcontainer(rw http.ResponseWriter, r *ht
|
||||
return
|
||||
}
|
||||
|
||||
httpapi.Write(ctx, rw, http.StatusNoContent, nil)
|
||||
httpapi.Write(ctx, rw, http.StatusAccepted, m)
|
||||
}
|
||||
|
||||
// @Summary Get connection info for workspace agent
|
||||
|
||||
@@ -1483,7 +1483,7 @@ func TestWorkspaceAgentRecreateDevcontainer(t *testing.T) {
|
||||
|
||||
ctx := testutil.Context(t, testutil.WaitLong)
|
||||
|
||||
err := client.WorkspaceAgentRecreateDevcontainer(ctx, agentID, devContainer.ID)
|
||||
_, err := client.WorkspaceAgentRecreateDevcontainer(ctx, agentID, devContainer.ID)
|
||||
if wantStatus > 0 {
|
||||
cerr, ok := codersdk.AsError(err)
|
||||
require.True(t, ok, "expected error to be a coder error")
|
||||
|
||||
Reference in New Issue
Block a user