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

Commite918531

Browse files
committed
feat: add default_apps field to agent
1 parent4e36f91 commite918531

File tree

22 files changed

+417
-236
lines changed

22 files changed

+417
-236
lines changed

‎coderd/apidoc/docs.go

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

‎coderd/apidoc/swagger.json

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

‎coderd/database/dump.sql

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTERTABLE workspace_agents DROP COLUMN default_apps;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ALTERTABLE workspace_agents ADD column default_appstext[] DEFAULTNULL;

‎coderd/database/models.go

Lines changed: 3 additions & 2 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: 18 additions & 8 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎coderd/database/queries/workspaceagents.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,11 @@ INSERT INTO
6060
startup_script_behavior,
6161
startup_script_timeout_seconds,
6262
shutdown_script,
63-
shutdown_script_timeout_seconds
63+
shutdown_script_timeout_seconds,
64+
default_apps
6465
)
6566
VALUES
66-
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21) RETURNING*;
67+
($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19, $20, $21, $22) RETURNING*;
6768

6869
-- name: UpdateWorkspaceAgentConnectionByID :exec
6970
UPDATE

‎coderd/provisionerdserver/provisionerdserver.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,6 +1212,7 @@ func InsertWorkspaceResource(ctx context.Context, db database.Store, jobID uuid.
12121212
Valid:prAgent.ShutdownScript!="",
12131213
},
12141214
ShutdownScriptTimeoutSeconds:prAgent.GetShutdownScriptTimeoutSeconds(),
1215+
DefaultApps:prAgent.DefaultApps,
12151216
})
12161217
iferr!=nil {
12171218
returnxerrors.Errorf("insert agent: %w",err)

‎coderd/workspaceagents.go

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,6 +1330,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13301330
ShutdownScript:dbAgent.ShutdownScript.String,
13311331
ShutdownScriptTimeoutSeconds:dbAgent.ShutdownScriptTimeoutSeconds,
13321332
Subsystems:subsystems,
1333+
DefaultApps:convertDefaultApps(dbAgent.DefaultApps),
13331334
}
13341335
node:=coordinator.Node(dbAgent.ID)
13351336
ifnode!=nil {
@@ -1391,6 +1392,18 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13911392
returnworkspaceAgent,nil
13921393
}
13931394

1395+
funcconvertDefaultApps(apps []string) []codersdk.DefaultApp {
1396+
dapps:=make([]codersdk.DefaultApp,0,len(apps))
1397+
for_,app:=rangeapps {
1398+
switchcodersdk.DefaultApp(app) {
1399+
casecodersdk.DefaultAppVSCodeDesktop,codersdk.DefaultAppVSCodeInsiders,codersdk.DefaultAppPortForward,codersdk.DefaultAppWebTerminal:
1400+
dapps=append(dapps,codersdk.DefaultApp(app))
1401+
}
1402+
}
1403+
1404+
returndapps
1405+
}
1406+
13941407
// @Summary Submit workspace agent stats
13951408
// @ID submit-workspace-agent-stats
13961409
// @Security CoderSessionToken

‎codersdk/workspaceagents.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,16 @@ type WorkspaceAgentMetadata struct {
133133
DescriptionWorkspaceAgentMetadataDescription`json:"description"`
134134
}
135135

136+
typeDefaultAppstring
137+
138+
const (
139+
DefaultAppVSCodeDesktopDefaultApp="vscode-desktop"
140+
DefaultAppVSCodeInsidersDefaultApp="vscode-insiders"
141+
DefaultAppWebTerminalDefaultApp="web-terminal"
142+
DefaultAppPortForwardDefaultApp="port-forward-helper"
143+
DefaultAppSSHDefaultApp="ssh-helper"
144+
)
145+
136146
typeWorkspaceAgentstruct {
137147
ID uuid.UUID`json:"id" format:"uuid"`
138148
CreatedAt time.Time`json:"created_at" format:"date-time"`
@@ -169,6 +179,7 @@ type WorkspaceAgent struct {
169179
ShutdownScriptTimeoutSecondsint32`json:"shutdown_script_timeout_seconds"`
170180
Subsystems []AgentSubsystem`json:"subsystems"`
171181
HealthWorkspaceAgentHealth`json:"health"`// Health reports the health of the agent.
182+
DefaultApps []DefaultApp`json:"default_apps"`
172183
}
173184

174185
typeWorkspaceAgentHealthstruct {

‎docs/api/agents.md

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp