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

Commit3ac53e8

Browse files
authored
impl: ability to customize the links to Dashboard (#211)
Some clients (Netflix in this specific case) rely on mainly their owndashboard tools instead of the Coder one. Two main reasons that werementioned by Netflix:- aggregate many dev tools in a unified internal console- specific platform/security needs that their own UI handles betterFor this reason they would like the actions that open up the CoderDashboard (`Create workspace` and `Open in dashboard`) to be fullycustomizable, and allow clients to override the URL.For `Create workspace` we now have a config that defaults$lastDeploymentUrl/templates, but it can be replaced with a complete newURL. It also supports `$workspaceOwner` as a placeholder that isreplaced by the plugin with the username that logged in.For `Open in dashboard` a full URL can be provided and we alsointroduced two placeholders `$workspaceOwner` and `$workspaceName` whichwill be replaced by the plugin but only for this action.For now the decision is to not allow configuration from UI since Netflixis the only target for this change, and they deploy at scale a templatedsettings.json.
1 parent947be1c commit3ac53e8

File tree

8 files changed

+47
-9
lines changed

8 files changed

+47
-9
lines changed

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,16 @@ storage paths. The options can be configured from the plugin's main Workspaces p
360360
-`Header command` command that outputs additional HTTP headers. Each line of output must be in the format key=value.
361361
The environment variable CODER_URL will be available to the command process.
362362

363+
-`lastDeploymentURL` the last Coder deployment URL that Coder Toolbox successfully authenticated to.
364+
365+
-`workspaceViewUrl` specifies the dashboard page full URL where users can view details about a workspace.
366+
Helpful for customers that have their own in-house dashboards. Defaults to the Coder deployment workspace page.
367+
This setting supports`$workspaceOwner` and`$workspaceName` as placeholders.
368+
369+
-`workspaceCreateUrl` specifies the dashboard page full URL where users can create new workspaces.
370+
Helpful for customers that have their own in-house dashboards. Defaults to the Coder deployment templates page.
371+
This setting supports`$workspaceOwner` as placeholder with the replacing value being the username that logged in.
372+
363373
###TLS settings
364374

365375
The following options control the secure communication behavior of the plugin with Coder deployment and its available

‎gradle.properties‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
version=0.7.1
1+
version=0.7.3
22
group=com.coder.toolbox
33
name=coder-toolbox

‎src/main/kotlin/com/coder/toolbox/CoderRemoteEnvironment.kt‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,13 @@ class CoderRemoteEnvironment(
9191
}
9292
actions.add(
9393
Action(context,"Open in dashboard") {
94+
val urlTemplate= context.settingsStore.workspaceViewUrl
95+
?: client.url.withPath("/@${workspace.ownerName}/${workspace.name}").toString()
96+
val url= urlTemplate
97+
.replace("\$workspaceOwner","${workspace.ownerName}")
98+
.replace("\$workspaceName", workspace.name)
9499
context.desktop.browse(
95-
client.url.withPath("/@${workspace.ownerName}/${workspace.name}").toString()
100+
url
96101
) {
97102
context.ui.showErrorInfoPopup(it)
98103
}

‎src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,11 @@ class CoderRemoteProvider(
224224
overrideval additionalPluginActions:StateFlow<List<ActionDescription>>=MutableStateFlow(
225225
listOf(
226226
Action(context,"Create workspace") {
227-
context.desktop.browse(client?.url?.withPath("/templates").toString()) {
227+
val url= context.settingsStore.workspaceCreateUrl?: client?.url?.withPath("/templates").toString()
228+
context.desktop.browse(
229+
url
230+
.replace("\$workspaceOwner", client?.me()?.username?:"")
231+
) {
228232
context.ui.showErrorInfoPopup(it)
229233
}
230234
},

‎src/main/kotlin/com/coder/toolbox/settings/ReadOnlyCoderSettings.kt‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,17 @@ interface ReadOnlyCoderSettings {
137137
*/
138138
val sshConfigOptions:String?
139139

140+
/**
141+
* A custom full URL to the dashboard page used for viewing details about a workspace.
142+
* Supports `$workspaceOwner` and `$workspaceName` as placeholders.
143+
*/
144+
val workspaceViewUrl:String?
145+
146+
/**
147+
* A custom full URL to the dashboard page used for creating workspaces.
148+
* Supports `$workspaceOwner` as placeholder.
149+
*/
150+
val workspaceCreateUrl:String?
140151

141152
/**
142153
* The path where network information for SSH hosts are stored

‎src/main/kotlin/com/coder/toolbox/store/CoderSettingsStore.kt‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,11 @@ class CoderSettingsStore(
8080
.normalize()
8181
.toString()
8282

83+
overrideval workspaceViewUrl:String?
84+
get()= store[WORKSPACE_VIEW_URL]
85+
overrideval workspaceCreateUrl:String?
86+
get()= store[WORKSPACE_CREATE_URL]
87+
8388
/**
8489
* Where the specified deployment should put its data.
8590
*/

‎src/main/kotlin/com/coder/toolbox/store/StoreKeys.kt‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,8 @@ internal const val SSH_CONFIG_OPTIONS = "sshConfigOptions"
4646

4747
internalconstvalNETWORK_INFO_DIR="networkInfoDir"
4848

49+
internalconstvalWORKSPACE_VIEW_URL="workspaceViewUrl"
50+
internalconstvalWORKSPACE_CREATE_URL="workspaceCreateUrl"
51+
4952
internalconstvalSSH_AUTO_CONNECT_PREFIX="ssh_auto_connect_"
5053

‎src/test/kotlin/com/coder/toolbox/util/URLExtensionsTest.kt‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,21 @@ internal class URLExtensionsTest {
99
@Test
1010
funtestToURL() {
1111
assertEquals(
12-
URL("https","localhost",8080,"/path"),
13-
"https://localhost:8080/path".toURL(),
12+
expected=URI.create("https://localhost:8080/path").toURL(),
13+
actual="https://localhost:8080/path".toURL(),
1414
)
1515
}
1616

1717
@Test
1818
funtestWithPath() {
1919
assertEquals(
20-
URL("https","localhost",8080,"/foo/bar"),
21-
URL("https","localhost",8080,"/").withPath("/foo/bar"),
20+
expected="https://localhost:8080/foo/bar".toURL(),
21+
actual="https://localhost:8080/".toURL().withPath("/foo/bar"),
2222
)
2323

2424
assertEquals(
25-
URL("https","localhost",8080,"/foo/bar"),
26-
URL("https","localhost",8080,"/old/path").withPath("/foo/bar"),
25+
expected="https://localhost:8080/foo/bar".toURL(),
26+
actual="https://localhost:8080/old/path".toURL().withPath("/foo/bar"),
2727
)
2828
}
2929

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp