Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit975a32c

Browse files
committed
chore(codersdk): deprecate unused WorkspaceAppStatus fields
1 parente54aa44 commit975a32c

21 files changed

+119
-129
lines changed

‎coderd/apidoc/docs.go

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/apidoc/swagger.json

Lines changed: 4 additions & 1 deletion
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/db2sdk/db2sdk.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -537,16 +537,14 @@ func WorkspaceAppStatuses(statuses []database.WorkspaceAppStatus) []codersdk.Wor
537537

538538
funcWorkspaceAppStatus(status database.WorkspaceAppStatus) codersdk.WorkspaceAppStatus {
539539
return codersdk.WorkspaceAppStatus{
540-
ID:status.ID,
541-
CreatedAt:status.CreatedAt,
542-
WorkspaceID:status.WorkspaceID,
543-
AgentID:status.AgentID,
544-
AppID:status.AppID,
545-
NeedsUserAttention:status.NeedsUserAttention,
546-
URI:status.Uri.String,
547-
Icon:status.Icon.String,
548-
Message:status.Message,
549-
State:codersdk.WorkspaceAppStatusState(status.State),
540+
ID:status.ID,
541+
CreatedAt:status.CreatedAt,
542+
WorkspaceID:status.WorkspaceID,
543+
AgentID:status.AgentID,
544+
AppID:status.AppID,
545+
URI:status.Uri.String,
546+
Message:status.Message,
547+
State:codersdk.WorkspaceAppStatusState(status.State),
550548
}
551549
}
552550

‎coderd/database/dbmem/dbmem.go

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9764,16 +9764,14 @@ func (q *FakeQuerier) InsertWorkspaceAppStatus(_ context.Context, arg database.I
97649764
deferq.mutex.Unlock()
97659765

97669766
status:= database.WorkspaceAppStatus{
9767-
ID:arg.ID,
9768-
CreatedAt:arg.CreatedAt,
9769-
WorkspaceID:arg.WorkspaceID,
9770-
AgentID:arg.AgentID,
9771-
AppID:arg.AppID,
9772-
NeedsUserAttention:arg.NeedsUserAttention,
9773-
State:arg.State,
9774-
Message:arg.Message,
9775-
Uri:arg.Uri,
9776-
Icon:arg.Icon,
9767+
ID:arg.ID,
9768+
CreatedAt:arg.CreatedAt,
9769+
WorkspaceID:arg.WorkspaceID,
9770+
AgentID:arg.AgentID,
9771+
AppID:arg.AppID,
9772+
State:arg.State,
9773+
Message:arg.Message,
9774+
Uri:arg.Uri,
97779775
}
97789776
q.workspaceAppStatuses=append(q.workspaceAppStatuses,status)
97799777
returnstatus,nil

‎coderd/database/dump.sql

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTERTABLE ONLY workspace_app_statuses
2+
ADD COLUMN IF NOT EXISTS needs_user_attentionBOOLEANNOT NULL DEFAULT FALSE,
3+
ADD COLUMN IF NOT EXISTS iconTEXT;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTERTABLE ONLY workspace_app_statuses
2+
DROP COLUMN IF EXISTS needs_user_attention,
3+
DROP COLUMN IF EXISTS icon;

‎coderd/database/models.go

Lines changed: 8 additions & 10 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries.sql.go

Lines changed: 14 additions & 24 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspaceapps.sql

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ WHERE
4444
id= $1;
4545

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

5151
-- name: GetWorkspaceAppStatusesByAppIDs :many
@@ -54,6 +54,6 @@ SELECT * FROM workspace_app_statuses WHERE app_id = ANY(@ids :: uuid [ ]);
5454
-- name: GetLatestWorkspaceAppStatusesByWorkspaceIDs :many
5555
SELECT DISTINCTON (workspace_id)
5656
*
57-
FROM workspace_app_statuses
57+
FROM workspace_app_statuses
5858
WHERE workspace_id= ANY(@ids :: uuid[])
5959
ORDER BY workspace_id, created_atDESC;

‎coderd/workspaceagents.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -366,11 +366,6 @@ func (api *API) patchWorkspaceAgentAppStatus(rw http.ResponseWriter, r *http.Req
366366
String:req.URI,
367367
Valid:req.URI!="",
368368
},
369-
Icon: sql.NullString{
370-
String:req.Icon,
371-
Valid:req.Icon!="",
372-
},
373-
NeedsUserAttention:req.NeedsUserAttention,
374369
})
375370
iferr!=nil {
376371
httpapi.Write(ctx,rw,http.StatusInternalServerError, codersdk.Response{

‎coderd/workspaceagents_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,10 @@ func TestWorkspaceAgentAppStatus(t *testing.T) {
366366
AppSlug:"vscode",
367367
Message:"testing",
368368
URI:"https://example.com",
369-
Icon:"https://example.com/icon.png",
370369
State:codersdk.WorkspaceAppStatusStateComplete,
370+
// Ensure deprecated fields are ignored.
371+
Icon:"https://example.com/icon.png",
372+
NeedsUserAttention:true,
371373
})
372374
require.NoError(t,err)
373375

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

‎codersdk/agentsdk/agentsdk.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,12 +583,14 @@ func (c *Client) PatchLogs(ctx context.Context, req PatchLogs) error {
583583

584584
// PatchAppStatus updates the status of a workspace app.
585585
typePatchAppStatusstruct {
586-
AppSlugstring`json:"app_slug"`
587-
NeedsUserAttentionbool`json:"needs_user_attention"`
588-
State codersdk.WorkspaceAppStatusState`json:"state"`
589-
Messagestring`json:"message"`
590-
URIstring`json:"uri"`
591-
Iconstring`json:"icon"`
586+
AppSlugstring`json:"app_slug"`
587+
State codersdk.WorkspaceAppStatusState`json:"state"`
588+
Messagestring`json:"message"`
589+
URIstring`json:"uri"`
590+
// Deprecated: this field is unused and will be removed in a future version.
591+
Iconstring`json:"icon"`
592+
// Deprecated: this field is unused and will be removed in a future version.
593+
NeedsUserAttentionbool`json:"needs_user_attention"`
592594
}
593595

594596
func (c*Client)PatchAppStatus(ctx context.Context,reqPatchAppStatus)error {

‎codersdk/toolsdk/toolsdk.go

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,6 @@ var (
6767
"type":"string",
6868
"description":"A link to a relevant resource, such as a PR or issue.",
6969
},
70-
"emoji":map[string]any{
71-
"type":"string",
72-
"description":"An emoji that visually represents your current progress. Choose an emoji that helps the user understand your current status at a glance.",
73-
},
7470
"state":map[string]any{
7571
"type":"string",
7672
"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.",
@@ -81,7 +77,7 @@ var (
8177
},
8278
},
8379
},
84-
Required: []string{"summary","link","emoji","state"},
80+
Required: []string{"summary","link","state"},
8581
},
8682
},
8783
Handler:func(ctx context.Context,argsmap[string]any) (string,error) {
@@ -104,22 +100,16 @@ var (
104100
if!ok {
105101
return"",xerrors.New("link must be a string")
106102
}
107-
emoji,ok:=args["emoji"].(string)
108-
if!ok {
109-
return"",xerrors.New("emoji must be a string")
110-
}
111103
state,ok:=args["state"].(string)
112104
if!ok {
113105
return"",xerrors.New("state must be a string")
114106
}
115107

116108
iferr:=agentClient.PatchAppStatus(ctx, agentsdk.PatchAppStatus{
117-
AppSlug:appSlug,
118-
Message:summary,
119-
URI:link,
120-
Icon:emoji,
121-
NeedsUserAttention:false,// deprecated, to be removed later
122-
State:codersdk.WorkspaceAppStatusState(state),
109+
AppSlug:appSlug,
110+
Message:summary,
111+
URI:link,
112+
State:codersdk.WorkspaceAppStatusState(state),
123113
});err!=nil {
124114
return"",err
125115
}

‎codersdk/toolsdk/toolsdk_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ func TestTools(t *testing.T) {
7575
"summary":"test summary",
7676
"state":"complete",
7777
"link":"https://example.com",
78-
"emoji":"✅",
7978
})
8079
require.NoError(t,err)
8180
})

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp