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

Commit3f26d05

Browse files
committed
feat: add default_apps field to agent
1 parent22e781e commit3f26d05

File tree

22 files changed

+416
-235
lines changed

22 files changed

+416
-235
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
@@ -1336,6 +1336,7 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13361336
ShutdownScript:dbAgent.ShutdownScript.String,
13371337
ShutdownScriptTimeoutSeconds:dbAgent.ShutdownScriptTimeoutSeconds,
13381338
Subsystems:subsystems,
1339+
DefaultApps:convertDefaultApps(dbAgent.DefaultApps),
13391340
}
13401341
node:=coordinator.Node(dbAgent.ID)
13411342
ifnode!=nil {
@@ -1397,6 +1398,18 @@ func convertWorkspaceAgent(derpMap *tailcfg.DERPMap, coordinator tailnet.Coordin
13971398
returnworkspaceAgent,nil
13981399
}
13991400

1401+
funcconvertDefaultApps(apps []string) []codersdk.DefaultApp {
1402+
dapps:=make([]codersdk.DefaultApp,0,len(apps))
1403+
for_,app:=rangeapps {
1404+
switchcodersdk.DefaultApp(app) {
1405+
casecodersdk.DefaultAppVSCodeDesktop,codersdk.DefaultAppVSCodeInsiders,codersdk.DefaultAppPortForward,codersdk.DefaultAppWebTerminal:
1406+
dapps=append(dapps,codersdk.DefaultApp(app))
1407+
}
1408+
}
1409+
1410+
returndapps
1411+
}
1412+
14001413
// @Summary Submit workspace agent stats
14011414
// @ID submit-workspace-agent-stats
14021415
// @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