Skip to content

fix: remove window option from open_in parameter #327

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/resources/app.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ resource "coder_app" "vim" {
- `healthcheck` (Block Set, Max: 1) HTTP health checking to determine the application readiness. (see [below for nested schema](#nestedblock--healthcheck))
- `hidden` (Boolean) Determines if the app is visible in the UI (minimum Coder version: v2.16).
- `icon` (String) A URL to an icon that will display in the dashboard. View built-in icons here: https://github.com/coder/coder/tree/main/site/static/icon. Use a built-in icon with `"${data.coder_workspace.me.access_url}/icon/<path>"`.
- `open_in` (String) Determines where the app will be opened. Valid values are `"tab"`, `"window"`, and `"slim-window" (default)`. `"tab"` opens in a new tab in the same browser window. `"window"` opens a fresh browser window with navigation options. `"slim-window"` opens a new browser window without navigation controls.
- `open_in` (String) Determines where the app will be opened. Valid values are `"tab"` and `"slim-window" (default)`. `"tab"` opens in a new tab in the same browser window. `"slim-window"` opens a new browser window without navigation controls.
- `order` (Number) The order determines the position of app in the UI presentation. The lowest order is shown first and apps with equal order are sorted by name (ascending order).
- `share` (String) Determines the level which the application is shared at. Valid levels are `"owner"` (default), `"authenticated"` and `"public"`. Level `"owner"` disables sharing on the app, so only the workspace owner can access it. Level `"authenticated"` shares the app with all authenticated users. Level `"public"` shares it with any user, including unauthenticated users. Permitted application sharing levels can be configured site-wide via a flag on `coder server` (Enterprise only).
- `subdomain` (Boolean) Determines whether the app will be accessed via it's own subdomain or whether it will be accessed via a path on Coder. If wildcards have not been setup by the administrator then apps with `subdomain` set to `true` will not be accessible. Defaults to `false`.
Expand Down
18 changes: 5 additions & 13 deletions integration/coder-app-open-in/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,11 @@ resource "coder_agent" "dev" {
dir = "/workspace"
}

resource "coder_app" "window" {
resource "coder_app" "tab" {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The resource name is tab, so we the property coder_app.tab.open_in is available, but you're referring to coder_app.slim-window.open_in hence the issue?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed , nice catch - just fixed it. 🤔

agent_id = coder_agent.dev.id
slug = "window"
slug = "tab"
share = "owner"
open_in = "window"
}

resource "coder_app" "slim-window" {
agent_id = coder_agent.dev.id
slug = "slim-window"
share = "owner"
open_in = "slim-window"
open_in = "tab"
}

resource "coder_app" "defaulted" {
Expand All @@ -40,9 +33,8 @@ resource "coder_app" "defaulted" {
locals {
# NOTE: these must all be strings in the output
output = {
"coder_app.window.open_in" = tostring(coder_app.window.open_in)
"coder_app.slim-window.open_in" = tostring(coder_app.slim-window.open_in)
"coder_app.defaulted.open_in" = tostring(coder_app.defaulted.open_in)
"coder_app.tab.open_in" = tostring(coder_app.tab.open_in)
"coder_app.defaulted.open_in" = tostring(coder_app.defaulted.open_in)
}
}

Expand Down
5 changes: 2 additions & 3 deletions integration/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ func TestIntegration(t *testing.T) {
name: "coder-app-open-in",
minVersion: "v2.19.0",
expectedOutput: map[string]string{
"coder_app.window.open_in": "window",
"coder_app.slim-window.open_in": "slim-window",
"coder_app.defaulted.open_in": "slim-window",
"coder_app.tab.open_in": "tab",
"coder_app.defaulted.open_in": "slim-window",
},
},
{
Expand Down
8 changes: 4 additions & 4 deletions provider/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ func appResource() *schema.Resource {
},
"open_in": {
Type: schema.TypeString,
Description: "Determines where the app will be opened. Valid values are `\"tab\"`, `\"window\"`, and `\"slim-window\" (default)`. " +
"`\"tab\"` opens in a new tab in the same browser window. `\"window\"` opens a fresh browser window with navigation options. " +
Description: "Determines where the app will be opened. Valid values are `\"tab\"` and `\"slim-window\" (default)`. " +
"`\"tab\"` opens in a new tab in the same browser window. " +
"`\"slim-window\"` opens a new browser window without navigation controls.",
ForceNew: true,
Optional: true,
Expand All @@ -238,11 +238,11 @@ func appResource() *schema.Resource {
}

switch valStr {
case "tab", "window", "slim-window":
case "tab", "slim-window":
return nil
}

return diag.Errorf(`invalid "coder_app" open_in value, must be one of "tab", "window", "slim-window": %q`, valStr)
return diag.Errorf(`invalid "coder_app" open_in value, must be one of "tab", "slim-window": %q`, valStr)
},
},
},
Expand Down
11 changes: 3 additions & 8 deletions provider/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,7 @@ func TestApp(t *testing.T) {
{
name: "InvalidValue",
value: "nonsense",
expectError: regexp.MustCompile(`invalid "coder_app" open_in value, must be one of "tab", "window", "slim-window": "nonsense"`),
},
{
name: "ExplicitWindow",
value: "window",
expectValue: "window",
expectError: regexp.MustCompile(`invalid "coder_app" open_in value, must be one of "tab", "slim-window": "nonsense"`),
},
{
name: "ExplicitSlimWindow",
Expand Down Expand Up @@ -389,11 +384,11 @@ func TestApp(t *testing.T) {
url = "https://google.com"
external = true
hidden = false
open_in = "window"
open_in = "tab"
}
`,
hidden: false,
openIn: "window",
openIn: "tab",
}}
for _, tc := range cases {
tc := tc
Expand Down
Loading