Skip to content

Commit 289338f

Browse files
authored
feat(site): connect open_in parameter (coder#16036)
Second step to resolve [open_in issue](coder/terraform-provider-coder#297) This PR improves the way the open_in parameter is forwarded across the code, changing the last `string` to const everywhere. Also make sure it is available and forwarded up to the `CreateLink` component.
1 parent b5c85a8 commit 289338f

File tree

13 files changed

+510
-466
lines changed

13 files changed

+510
-466
lines changed

agent/proto/agent.pb.go

Lines changed: 419 additions & 429 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

agent/proto/agent.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ message WorkspaceApp {
4242
}
4343
Health health = 12;
4444
bool hidden = 13;
45-
string open_in = 14;
4645
}
4746

4847
message WorkspaceAgentScript {

coderd/apidoc/docs.go

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

coderd/apidoc/swagger.json

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

coderd/database/db2sdk/db2sdk.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ func Apps(dbApps []database.WorkspaceApp, agent database.WorkspaceAgent, ownerNa
518518
},
519519
Health: codersdk.WorkspaceAppHealth(dbApp.Health),
520520
Hidden: dbApp.Hidden,
521+
OpenIn: codersdk.WorkspaceAppOpenIn(dbApp.OpenIn),
521522
})
522523
}
523524
return apps

codersdk/agentsdk/convert.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,6 @@ func AppFromProto(protoApp *proto.WorkspaceApp) (codersdk.WorkspaceApp, error) {
255255
},
256256
Health: health,
257257
Hidden: protoApp.Hidden,
258-
OpenIn: protoApp.OpenIn,
259258
}, nil
260259
}
261260

@@ -286,7 +285,6 @@ func ProtoFromApp(a codersdk.WorkspaceApp) (*proto.WorkspaceApp, error) {
286285
},
287286
Health: proto.WorkspaceApp_Health(health),
288287
Hidden: a.Hidden,
289-
OpenIn: a.OpenIn,
290288
}, nil
291289
}
292290

codersdk/workspaceapps.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,12 @@ const (
2828
WorkspaceAppSharingLevelPublic WorkspaceAppSharingLevel = "public"
2929
)
3030

31+
var MapWorkspaceAppSharingLevels = map[WorkspaceAppSharingLevel]struct{}{
32+
WorkspaceAppSharingLevelOwner: {},
33+
WorkspaceAppSharingLevelAuthenticated: {},
34+
WorkspaceAppSharingLevelPublic: {},
35+
}
36+
3137
type WorkspaceAppOpenIn string
3238

3339
const (
@@ -36,10 +42,10 @@ const (
3642
WorkspaceAppOpenInTab WorkspaceAppOpenIn = "tab"
3743
)
3844

39-
var MapWorkspaceAppSharingLevels = map[WorkspaceAppSharingLevel]struct{}{
40-
WorkspaceAppSharingLevelOwner: {},
41-
WorkspaceAppSharingLevelAuthenticated: {},
42-
WorkspaceAppSharingLevelPublic: {},
45+
var MapWorkspaceAppOpenIns = map[WorkspaceAppOpenIn]struct{}{
46+
WorkspaceAppOpenInSlimWindow: {},
47+
WorkspaceAppOpenInWindow: {},
48+
WorkspaceAppOpenInTab: {},
4349
}
4450

4551
type WorkspaceApp struct {
@@ -70,7 +76,7 @@ type WorkspaceApp struct {
7076
Healthcheck Healthcheck `json:"healthcheck"`
7177
Health WorkspaceAppHealth `json:"health"`
7278
Hidden bool `json:"hidden"`
73-
OpenIn string `json:"open_in"`
79+
OpenIn WorkspaceAppOpenIn `json:"open_in"`
7480
}
7581

7682
type Healthcheck struct {

docs/reference/api/agents.md

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/reference/api/builds.md

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

docs/reference/api/schemas.md

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

0 commit comments

Comments
 (0)