feat(site): connect open_in parameter (#16036)

Second step to resolve [open_in
issue](https://github.com/coder/terraform-provider-coder/issues/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.
This commit is contained in:
Vincent Vielle
2025-01-07 18:08:03 +01:00
committed by GitHub
parent b5c85a8abd
commit 289338f19e
13 changed files with 510 additions and 466 deletions
-2
View File
@@ -255,7 +255,6 @@ func AppFromProto(protoApp *proto.WorkspaceApp) (codersdk.WorkspaceApp, error) {
},
Health: health,
Hidden: protoApp.Hidden,
OpenIn: protoApp.OpenIn,
}, nil
}
@@ -286,7 +285,6 @@ func ProtoFromApp(a codersdk.WorkspaceApp) (*proto.WorkspaceApp, error) {
},
Health: proto.WorkspaceApp_Health(health),
Hidden: a.Hidden,
OpenIn: a.OpenIn,
}, nil
}
+11 -5
View File
@@ -28,6 +28,12 @@ const (
WorkspaceAppSharingLevelPublic WorkspaceAppSharingLevel = "public"
)
var MapWorkspaceAppSharingLevels = map[WorkspaceAppSharingLevel]struct{}{
WorkspaceAppSharingLevelOwner: {},
WorkspaceAppSharingLevelAuthenticated: {},
WorkspaceAppSharingLevelPublic: {},
}
type WorkspaceAppOpenIn string
const (
@@ -36,10 +42,10 @@ const (
WorkspaceAppOpenInTab WorkspaceAppOpenIn = "tab"
)
var MapWorkspaceAppSharingLevels = map[WorkspaceAppSharingLevel]struct{}{
WorkspaceAppSharingLevelOwner: {},
WorkspaceAppSharingLevelAuthenticated: {},
WorkspaceAppSharingLevelPublic: {},
var MapWorkspaceAppOpenIns = map[WorkspaceAppOpenIn]struct{}{
WorkspaceAppOpenInSlimWindow: {},
WorkspaceAppOpenInWindow: {},
WorkspaceAppOpenInTab: {},
}
type WorkspaceApp struct {
@@ -70,7 +76,7 @@ type WorkspaceApp struct {
Healthcheck Healthcheck `json:"healthcheck"`
Health WorkspaceAppHealth `json:"health"`
Hidden bool `json:"hidden"`
OpenIn string `json:"open_in"`
OpenIn WorkspaceAppOpenIn `json:"open_in"`
}
type Healthcheck struct {