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

Commit7531563

Browse files
committed
feat: Add DevURL support
This adds DevURLs as a property to a workspace agent.The resource is added to the Terraform provider here:coder/terraform-provider-coder#17DevURLs will be opened in the dashboard or via the CLIwith `coder open <name>`. If `command` is specified, aterminal will appear locally and in the web. If `target`is specified, the browser will open to an exposed instanceof that target.
1 parent914a2f4 commit7531563

24 files changed

+1036
-214
lines changed

‎.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"coderdtest",
88
"codersdk",
99
"devel",
10+
"apps",
1011
"drpc",
1112
"drpcconn",
1213
"drpcmux",

‎coderd/database/databasefake/databasefake.go

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ func New() database.Store {
3434
templateVersions:make([]database.TemplateVersion,0),
3535
templates:make([]database.Template,0),
3636
workspaceBuilds:make([]database.WorkspaceBuild,0),
37+
workspaceApps:make([]database.WorkspaceApp,0),
3738
workspaces:make([]database.Workspace,0),
3839
}
3940
}
@@ -62,6 +63,7 @@ type fakeQuerier struct {
6263
templateVersions []database.TemplateVersion
6364
templates []database.Template
6465
workspaceBuilds []database.WorkspaceBuild
66+
workspaceApps []database.WorkspaceApp
6567
workspaces []database.Workspace
6668
}
6769

@@ -328,6 +330,41 @@ func (q *fakeQuerier) GetWorkspaceByOwnerIDAndName(_ context.Context, arg databa
328330
return database.Workspace{},sql.ErrNoRows
329331
}
330332

333+
func (q*fakeQuerier)GetWorkspaceAppsByAgentID(_ context.Context,id uuid.UUID) ([]database.WorkspaceApp,error) {
334+
q.mutex.RLock()
335+
deferq.mutex.RUnlock()
336+
337+
apps:=make([]database.WorkspaceApp,0)
338+
for_,app:=rangeq.workspaceApps {
339+
ifapp.AgentID==id {
340+
apps=append(apps,app)
341+
}
342+
}
343+
iflen(apps)==0 {
344+
returnnil,sql.ErrNoRows
345+
}
346+
returnapps,nil
347+
}
348+
349+
func (q*fakeQuerier)GetWorkspaceAppsByAgentIDs(_ context.Context,ids []uuid.UUID) ([]database.WorkspaceApp,error) {
350+
q.mutex.RLock()
351+
deferq.mutex.RUnlock()
352+
353+
apps:=make([]database.WorkspaceApp,0)
354+
for_,app:=rangeq.workspaceApps {
355+
for_,id:=rangeids {
356+
ifapp.AgentID.String()==id.String() {
357+
apps=append(apps,app)
358+
break
359+
}
360+
}
361+
}
362+
iflen(apps)==0 {
363+
returnnil,sql.ErrNoRows
364+
}
365+
returnapps,nil
366+
}
367+
331368
func (q*fakeQuerier)GetWorkspaceOwnerCountsByTemplateIDs(_ context.Context,templateIDs []uuid.UUID) ([]database.GetWorkspaceOwnerCountsByTemplateIDsRow,error) {
332369
q.mutex.RLock()
333370
deferq.mutex.RUnlock()
@@ -1353,6 +1390,23 @@ func (q *fakeQuerier) InsertWorkspaceBuild(_ context.Context, arg database.Inser
13531390
returnworkspaceBuild,nil
13541391
}
13551392

1393+
func (q*fakeQuerier)InsertWorkspaceApp(_ context.Context,arg database.InsertWorkspaceAppParams) (database.WorkspaceApp,error) {
1394+
q.mutex.Lock()
1395+
deferq.mutex.Unlock()
1396+
1397+
workspaceApp:= database.WorkspaceApp{
1398+
ID:arg.ID,
1399+
AgentID:arg.AgentID,
1400+
CreatedAt:arg.CreatedAt,
1401+
Name:arg.Name,
1402+
Icon:arg.Icon,
1403+
Command:arg.Command,
1404+
Target:arg.Target,
1405+
}
1406+
q.workspaceApps=append(q.workspaceApps,workspaceApp)
1407+
returnworkspaceApp,nil
1408+
}
1409+
13561410
func (q*fakeQuerier)UpdateAPIKeyByID(_ context.Context,arg database.UpdateAPIKeyByIDParams)error {
13571411
q.mutex.Lock()
13581412
deferq.mutex.Unlock()

‎coderd/database/dump.sql

Lines changed: 19 additions & 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+
DROPTABLE workspace_apps;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
CREATETABLEworkspace_apps (
2+
id uuidNOT NULL,
3+
created_attimestamp with time zoneNOT NULL,
4+
agent_id uuidNOT NULLREFERENCES workspace_agents (id)ON DELETE CASCADE,
5+
namevarchar(64)NOT NULL,
6+
iconvarchar(256)NOT NULL,
7+
-- A command to run when opened.
8+
commandvarchar(65534),
9+
-- A URL or port to target.
10+
targetvarchar(65534),
11+
PRIMARY KEY (id),
12+
UNIQUE(agent_id, name)
13+
)

‎coderd/database/models.go

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

‎coderd/database/querier.go

Lines changed: 3 additions & 0 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: 118 additions & 0 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
-- name: GetWorkspaceAppsByAgentID :many
2+
SELECT*FROM workspace_appsWHERE agent_id= $1;
3+
4+
-- name: GetWorkspaceAppsByAgentIDs :many
5+
SELECT*FROM workspace_appsWHERE agent_id= ANY(@ids :: uuid [ ]);
6+
7+
-- name: InsertWorkspaceApp :one
8+
INSERT INTO
9+
workspace_apps (
10+
id,
11+
created_at,
12+
agent_id,
13+
name,
14+
icon,
15+
command,
16+
target
17+
)
18+
VALUES
19+
($1, $2, $3, $4, $5, $6, $7) RETURNING*;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp