Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion coderd/apidoc/docs.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion coderd/apidoc/swagger.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 8 additions & 10 deletions coderd/database/db2sdk/db2sdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,16 +537,14 @@ func WorkspaceAppStatuses(statuses []database.WorkspaceAppStatus) []codersdk.Wor

func WorkspaceAppStatus(status database.WorkspaceAppStatus) codersdk.WorkspaceAppStatus {
return codersdk.WorkspaceAppStatus{
ID: status.ID,
CreatedAt: status.CreatedAt,
WorkspaceID: status.WorkspaceID,
AgentID: status.AgentID,
AppID: status.AppID,
NeedsUserAttention: status.NeedsUserAttention,
URI: status.Uri.String,
Icon: status.Icon.String,
Message: status.Message,
State: codersdk.WorkspaceAppStatusState(status.State),
ID: status.ID,
CreatedAt: status.CreatedAt,
WorkspaceID: status.WorkspaceID,
AgentID: status.AgentID,
AppID: status.AppID,
URI: status.Uri.String,
Message: status.Message,
State: codersdk.WorkspaceAppStatusState(status.State),
}
}

Expand Down
18 changes: 8 additions & 10 deletions coderd/database/dbmem/dbmem.go
Original file line number Diff line number Diff line change
Expand Up @@ -9764,16 +9764,14 @@ func (q *FakeQuerier) InsertWorkspaceAppStatus(_ context.Context, arg database.I
defer q.mutex.Unlock()

status := database.WorkspaceAppStatus{
ID: arg.ID,
CreatedAt: arg.CreatedAt,
WorkspaceID: arg.WorkspaceID,
AgentID: arg.AgentID,
AppID: arg.AppID,
NeedsUserAttention: arg.NeedsUserAttention,
State: arg.State,
Message: arg.Message,
Uri: arg.Uri,
Icon: arg.Icon,
ID: arg.ID,
CreatedAt: arg.CreatedAt,
WorkspaceID: arg.WorkspaceID,
AgentID: arg.AgentID,
AppID: arg.AppID,
State: arg.State,
Message: arg.Message,
Uri: arg.Uri,
}
q.workspaceAppStatuses = append(q.workspaceAppStatuses, status)
return status, nil
Expand Down
4 changes: 1 addition & 3 deletions coderd/database/dump.sql

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE ONLY workspace_app_statuses
ADD COLUMN IF NOT EXISTS needs_user_attention BOOLEAN NOT NULL DEFAULT FALSE,
ADD COLUMN IF NOT EXISTS icon TEXT;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ALTER TABLE ONLY workspace_app_statuses
DROP COLUMN IF EXISTS needs_user_attention,
DROP COLUMN IF EXISTS icon;
18 changes: 8 additions & 10 deletions coderd/database/models.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 14 additions & 24 deletions coderd/database/queries.sql.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions coderd/database/queries/workspaceapps.sql
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ WHERE
id = $1;

-- name: InsertWorkspaceAppStatus :one
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message, needs_user_attention, uri, icon)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10)
INSERT INTO workspace_app_statuses (id, created_at, workspace_id, agent_id, app_id, state, message, uri)
VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
RETURNING *;

-- name: GetWorkspaceAppStatusesByAppIDs :many
Expand All @@ -54,6 +54,6 @@ SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ]);
-- name: GetLatestWorkspaceAppStatusesByWorkspaceIDs :many
SELECT DISTINCT ON (workspace_id)
*
FROM workspace_app_statuses
FROM workspace_app_statuses
WHERE workspace_id = ANY(@ids :: uuid[])
ORDER BY workspace_id, created_at DESC;
5 changes: 0 additions & 5 deletions coderd/workspaceagents.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,11 +366,6 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req
String: req.URI,
Valid: req.URI != "",
},
Icon: sql.NullString{
String: req.Icon,
Valid: req.Icon != "",
},
NeedsUserAttention: req.NeedsUserAttention,
})
if err != nil {
httpapi.Write(ctx, rw, http.StatusInternalServerError, codersdk.Response{
Expand Down
7 changes: 6 additions & 1 deletion coderd/workspaceagents_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,8 +366,10 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
AppSlug: "vscode",
Message: "testing",
URI: "https://example.com",
Icon: "https://example.com/icon.png",
State: codersdk.WorkspaceAppStatusStateComplete,
// Ensure deprecated fields are ignored.
Icon: "https://example.com/icon.png",
NeedsUserAttention: true,
})
require.NoError(t, err)

Expand All @@ -376,6 +378,9 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
agent, err := client.WorkspaceAgent(ctx, workspace.LatestBuild.Resources[0].Agents[0].ID)
require.NoError(t, err)
require.Len(t, agent.Apps[0].Statuses, 1)
// Deprecated fields should be ignored.
require.Empty(t, agent.Apps[0].Statuses[0].Icon)
require.False(t, agent.Apps[0].Statuses[0].NeedsUserAttention)
})
}

Expand Down
14 changes: 8 additions & 6 deletions codersdk/agentsdk/agentsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,12 +583,14 @@ func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {

// PatchAppStatus updates the status of a workspace app.
type PatchAppStatus struct {
AppSlug string `json:"app_slug"`
NeedsUserAttention bool `json:"needs_user_attention"`
State codersdk.WorkspaceAppStatusState `json:"state"`
Message string `json:"message"`
URI string `json:"uri"`
Icon string `json:"icon"`
AppSlug string `json:"app_slug"`
State codersdk.WorkspaceAppStatusState `json:"state"`
Message string `json:"message"`
URI string `json:"uri"`
// Deprecated: this field is unused and will be removed in a future version.
Icon string `json:"icon"`
// Deprecated: this field is unused and will be removed in a future version.
NeedsUserAttention bool `json:"needs_user_attention"`
}

func (c *Client) PatchAppStatus(ctx context.Context, req PatchAppStatus) error {
Expand Down
20 changes: 5 additions & 15 deletions codersdk/toolsdk/toolsdk.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,6 @@ var (
"type": "string",
"description": "A link to a relevant resource, such as a PR or issue.",
},
"emoji": map[string]any{
"type": "string",
"description": "An emoji that visually represents your current progress. Choose an emoji that helps the user understand your current status at a glance.",
},
"state": map[string]any{
"type": "string",
"description": "The state of your task. This can be one of the following: working, complete, or failure. Select the state that best represents your current progress.",
Expand All @@ -81,7 +77,7 @@ var (
},
},
},
Required: []string{"summary", "link", "emoji", "state"},
Required: []string{"summary", "link", "state"},
},
},
Handler: func(ctx context.Context, args map[string]any) (string, error) {
Expand All @@ -104,22 +100,16 @@ var (
if !ok {
return "", xerrors.New("link must be a string")
}
emoji, ok := args["emoji"].(string)
if !ok {
return "", xerrors.New("emoji must be a string")
}
state, ok := args["state"].(string)
if !ok {
return "", xerrors.New("state must be a string")
}

if err := agentClient.PatchAppStatus(ctx, agentsdk.PatchAppStatus{
AppSlug: appSlug,
Message: summary,
URI: link,
Icon: emoji,
NeedsUserAttention: false, // deprecated, to be removed later
State: codersdk.WorkspaceAppStatusState(state),
AppSlug: appSlug,
Message: summary,
URI: link,
State: codersdk.WorkspaceAppStatusState(state),
}); err != nil {
return "", err
}
Expand Down
1 change: 0 additions & 1 deletion codersdk/toolsdk/toolsdk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ func TestTools(t *testing.T) {
"summary": "test summary",
"state": "complete",
"link": "https://example.com",
"emoji": "✅",
})
require.NoError(t, err)
})
Expand Down
Loading
Loading
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy