mirror of
https://github.com/coder/coder.git
synced 2025-07-15 22:20:27 +00:00
chore(codersdk): deprecate WorkspaceAppStatus.{NeedsUserAttention,Icon} (#17358)
https://github.com/coder/coder/pull/17163 introduced the `workspace_app_statuses` table. Two of these fields (`needs_user_attention`, `icon`) turned out to be surplus to requirements. - Removes columns `needs_user_attention` and `icon` from `workspace_app_statuses` - Marks the corresponding fields of `codersdk.WorkspaceAppStatus` as deprecated.
This commit is contained in:
@ -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 {
|
||||
|
@ -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.",
|
||||
@ -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) {
|
||||
@ -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
|
||||
}
|
||||
|
@ -75,7 +75,6 @@ func TestTools(t *testing.T) {
|
||||
"summary": "test summary",
|
||||
"state": "complete",
|
||||
"link": "https://example.com",
|
||||
"emoji": "✅",
|
||||
})
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
@ -100,18 +100,22 @@ type Healthcheck struct {
|
||||
}
|
||||
|
||||
type WorkspaceAppStatus struct {
|
||||
ID uuid.UUID `json:"id" format:"uuid"`
|
||||
CreatedAt time.Time `json:"created_at" format:"date-time"`
|
||||
WorkspaceID uuid.UUID `json:"workspace_id" format:"uuid"`
|
||||
AgentID uuid.UUID `json:"agent_id" format:"uuid"`
|
||||
AppID uuid.UUID `json:"app_id" format:"uuid"`
|
||||
State WorkspaceAppStatusState `json:"state"`
|
||||
NeedsUserAttention bool `json:"needs_user_attention"`
|
||||
Message string `json:"message"`
|
||||
ID uuid.UUID `json:"id" format:"uuid"`
|
||||
CreatedAt time.Time `json:"created_at" format:"date-time"`
|
||||
WorkspaceID uuid.UUID `json:"workspace_id" format:"uuid"`
|
||||
AgentID uuid.UUID `json:"agent_id" format:"uuid"`
|
||||
AppID uuid.UUID `json:"app_id" format:"uuid"`
|
||||
State WorkspaceAppStatusState `json:"state"`
|
||||
Message string `json:"message"`
|
||||
// URI is the URI of the resource that the status is for.
|
||||
// e.g. https://github.com/org/repo/pull/123
|
||||
// e.g. file:///path/to/file
|
||||
URI string `json:"uri"`
|
||||
|
||||
// Deprecated: This field is unused and will be removed in a future version.
|
||||
// Icon is an external URL to an icon that will be rendered in the UI.
|
||||
Icon string `json:"icon"`
|
||||
// Deprecated: This field is unused and will be removed in a future version.
|
||||
// NeedsUserAttention specifies whether the status needs user attention.
|
||||
NeedsUserAttention bool `json:"needs_user_attention"`
|
||||
}
|
||||
|
Reference in New Issue
Block a user