Skip to content

Commit 464d613

Browse files
authored
fix: remove window option from open_in parameter (#327)
* remove window option * fix missing integration test * fix tests * run linter
1 parent b7ab1bb commit 464d613

File tree

5 files changed

+15
-29
lines changed

5 files changed

+15
-29
lines changed

docs/resources/app.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ resource "coder_app" "vim" {
6666
- `healthcheck` (Block Set, Max: 1) HTTP health checking to determine the application readiness. (see [below for nested schema](#nestedblock--healthcheck))
6767
- `hidden` (Boolean) Determines if the app is visible in the UI (minimum Coder version: v2.16).
6868
- `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>"`.
69-
- `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.
69+
- `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.
7070
- `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).
7171
- `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).
7272
- `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`.

integration/coder-app-open-in/main.tf

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,11 @@ resource "coder_agent" "dev" {
1717
dir = "/workspace"
1818
}
1919

20-
resource "coder_app" "window" {
20+
resource "coder_app" "tab" {
2121
agent_id = coder_agent.dev.id
22-
slug = "window"
22+
slug = "tab"
2323
share = "owner"
24-
open_in = "window"
25-
}
26-
27-
resource "coder_app" "slim-window" {
28-
agent_id = coder_agent.dev.id
29-
slug = "slim-window"
30-
share = "owner"
31-
open_in = "slim-window"
24+
open_in = "tab"
3225
}
3326

3427
resource "coder_app" "defaulted" {
@@ -40,9 +33,8 @@ resource "coder_app" "defaulted" {
4033
locals {
4134
# NOTE: these must all be strings in the output
4235
output = {
43-
"coder_app.window.open_in" = tostring(coder_app.window.open_in)
44-
"coder_app.slim-window.open_in" = tostring(coder_app.slim-window.open_in)
45-
"coder_app.defaulted.open_in" = tostring(coder_app.defaulted.open_in)
36+
"coder_app.tab.open_in" = tostring(coder_app.tab.open_in)
37+
"coder_app.defaulted.open_in" = tostring(coder_app.defaulted.open_in)
4638
}
4739
}
4840

integration/integration_test.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ func TestIntegration(t *testing.T) {
147147
name: "coder-app-open-in",
148148
minVersion: "v2.19.0",
149149
expectedOutput: map[string]string{
150-
"coder_app.window.open_in": "window",
151-
"coder_app.slim-window.open_in": "slim-window",
152-
"coder_app.defaulted.open_in": "slim-window",
150+
"coder_app.tab.open_in": "tab",
151+
"coder_app.defaulted.open_in": "slim-window",
153152
},
154153
},
155154
{

provider/app.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,8 @@ func appResource() *schema.Resource {
225225
},
226226
"open_in": {
227227
Type: schema.TypeString,
228-
Description: "Determines where the app will be opened. Valid values are `\"tab\"`, `\"window\"`, and `\"slim-window\" (default)`. " +
229-
"`\"tab\"` opens in a new tab in the same browser window. `\"window\"` opens a fresh browser window with navigation options. " +
228+
Description: "Determines where the app will be opened. Valid values are `\"tab\"` and `\"slim-window\" (default)`. " +
229+
"`\"tab\"` opens in a new tab in the same browser window. " +
230230
"`\"slim-window\"` opens a new browser window without navigation controls.",
231231
ForceNew: true,
232232
Optional: true,
@@ -238,11 +238,11 @@ func appResource() *schema.Resource {
238238
}
239239

240240
switch valStr {
241-
case "tab", "window", "slim-window":
241+
case "tab", "slim-window":
242242
return nil
243243
}
244244

245-
return diag.Errorf(`invalid "coder_app" open_in value, must be one of "tab", "window", "slim-window": %q`, valStr)
245+
return diag.Errorf(`invalid "coder_app" open_in value, must be one of "tab", "slim-window": %q`, valStr)
246246
},
247247
},
248248
},

provider/app_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,7 @@ func TestApp(t *testing.T) {
263263
{
264264
name: "InvalidValue",
265265
value: "nonsense",
266-
expectError: regexp.MustCompile(`invalid "coder_app" open_in value, must be one of "tab", "window", "slim-window": "nonsense"`),
267-
},
268-
{
269-
name: "ExplicitWindow",
270-
value: "window",
271-
expectValue: "window",
266+
expectError: regexp.MustCompile(`invalid "coder_app" open_in value, must be one of "tab", "slim-window": "nonsense"`),
272267
},
273268
{
274269
name: "ExplicitSlimWindow",
@@ -389,11 +384,11 @@ func TestApp(t *testing.T) {
389384
url = "https://google.com"
390385
external = true
391386
hidden = false
392-
open_in = "window"
387+
open_in = "tab"
393388
}
394389
`,
395390
hidden: false,
396-
openIn: "window",
391+
openIn: "tab",
397392
}}
398393
for _, tc := range cases {
399394
tc := tc

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy