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

Commit6ca152d

Browse files
committed
add open_in option to coder_app
1 parentc9dbd6f commit6ca152d

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

‎provider/app.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,28 @@ func appResource() *schema.Resource {
223223
ForceNew:true,
224224
Optional:true,
225225
},
226+
"open_in": {
227+
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. "+
230+
"`\"slim-window\"` opens a fresh browser window with slim navigation options.",
231+
ForceNew:true,
232+
Optional:true,
233+
Default:"slim-window",
234+
ValidateDiagFunc:func(valinterface{},c cty.Path) diag.Diagnostics {
235+
valStr,ok:=val.(string)
236+
if!ok {
237+
returndiag.Errorf("expected string, got %T",val)
238+
}
239+
240+
switchvalStr {
241+
case"tab","window","slim-window":
242+
returnnil
243+
}
244+
245+
returndiag.Errorf(`invalid "coder_app" open_in value, must be one of "tab", "window", "slim-window": %q`,valStr)
246+
},
247+
},
226248
},
227249
}
228250
}

‎provider/app_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ func TestApp(t *testing.T) {
4242
}
4343
order = 4
4444
hidden = false
45+
open_in = "slim-window"
4546
}
4647
`,
4748
Check:func(state*terraform.State)error {
@@ -64,6 +65,7 @@ func TestApp(t *testing.T) {
6465
"healthcheck.0.threshold",
6566
"order",
6667
"hidden",
68+
"open_in",
6769
} {
6870
value:=resource.Primary.Attributes[key]
6971
t.Logf("%q = %q",key,value)
@@ -98,6 +100,7 @@ func TestApp(t *testing.T) {
98100
display_name = "Testing"
99101
url = "https://google.com"
100102
external = true
103+
open_in = "slim-window"
101104
}
102105
`,
103106
external:true,
@@ -116,6 +119,7 @@ func TestApp(t *testing.T) {
116119
url = "https://google.com"
117120
external = true
118121
subdomain = true
122+
open_in = "slim-window"
119123
}
120124
`,
121125
expectError:regexp.MustCompile("conflicts with subdomain"),
@@ -209,6 +213,7 @@ func TestApp(t *testing.T) {
209213
interval = 5
210214
threshold = 6
211215
}
216+
open_in = "slim-window"
212217
}
213218
`,sharingLine)
214219

@@ -248,6 +253,7 @@ func TestApp(t *testing.T) {
248253
namestring
249254
configstring
250255
hiddenbool
256+
openInstring
251257
}{{
252258
name:"Is Hidden",
253259
config:`
@@ -263,9 +269,11 @@ func TestApp(t *testing.T) {
263269
url = "https://google.com"
264270
external = true
265271
hidden = true
272+
open_in = "slim-window"
266273
}
267274
`,
268275
hidden:true,
276+
openIn:"slim-window",
269277
}, {
270278
name:"Is Not Hidden",
271279
config:`
@@ -281,9 +289,11 @@ func TestApp(t *testing.T) {
281289
url = "https://google.com"
282290
external = true
283291
hidden = false
292+
open_in = "window"
284293
}
285294
`,
286295
hidden:false,
296+
openIn:"window",
287297
}}
288298
for_,tc:=rangecases {
289299
tc:=tc
@@ -300,6 +310,7 @@ func TestApp(t *testing.T) {
300310
resource:=state.Modules[0].Resources["coder_app.test"]
301311
require.NotNil(t,resource)
302312
require.Equal(t,strconv.FormatBool(tc.hidden),resource.Primary.Attributes["hidden"])
313+
require.Equal(t,tc.openIn,resource.Primary.Attributes["open_in"])
303314
returnnil
304315
},
305316
ExpectError:nil,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp