Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,6 +360,12 @@ storage paths. The options can be configured from the plugin's main Workspaces p
- `Header command` command that outputs additional HTTP headers. Each line of output must be in the format key=value.
The environment variable CODER_URL will be available to the command process.

- `lastDeploymentURL` the last Coder deployment URL that Coder Toolbox successfully authenticated to.

- `workspaceCreatePath` specifies the dashboard page’s relative path (to `lastDeploymentURL`) or full URL where users
can create new workspaces. Helpful for customers that have their own in-house dashboards. Defaults to `/templates` if
missing.

### TLS settings

The following options control the secure communication behavior of the plugin with Coder deployment and its available
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
version=0.7.1
version=0.7.2-alpha1
group=com.coder.toolbox
name=coder-toolbox
9 changes: 8 additions & 1 deletion src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,14 @@ class CoderRemoteProvider(
override val additionalPluginActions: StateFlow<List<ActionDescription>> = MutableStateFlow(
listOf(
Action(context, "Create workspace") {
context.desktop.browse(client?.url?.withPath("/templates").toString()) {
val wsCreatePath = context.settingsStore.workspaceCreatePath
val url = if (wsCreatePath.startsWith("http://") || wsCreatePath.startsWith("https://")) {
wsCreatePath
} else {
client?.url?.withPath(wsCreatePath).toString()
}

context.desktop.browse(url) {
context.ui.showErrorInfoPopup(it)
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ interface ReadOnlyCoderSettings {
*/
val sshConfigOptions: String?

/**
* A relative path or full URL to the dashboard page used for creating workspaces.
*/
val workspaceCreatePath: String

/**
* The path where network information for SSH hosts are stored
Expand Down
3 changes: 3 additions & 0 deletions src/main/kotlin/com/coder/toolbox/store/CoderSettingsStore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ class CoderSettingsStore(
.normalize()
.toString()

override val workspaceCreatePath: String
get() = store[WORKSPACE_CREATE_PATH] ?: "/templates"

/**
* Where the specified deployment should put its data.
*/
Expand Down
2 changes: 2 additions & 0 deletions src/main/kotlin/com/coder/toolbox/store/StoreKeys.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,5 +46,7 @@ internal const val SSH_CONFIG_OPTIONS = "sshConfigOptions"

internal const val NETWORK_INFO_DIR = "networkInfoDir"

internal const val WORKSPACE_CREATE_PATH = "workspaceCreatePath"

internal const val SSH_AUTO_CONNECT_PREFIX = "ssh_auto_connect_"

12 changes: 6 additions & 6 deletions src/test/kotlin/com/coder/toolbox/util/URLExtensionsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,21 @@ internal class URLExtensionsTest {
@Test
fun testToURL() {
assertEquals(
URL("https", "localhost", 8080, "/path"),
"https://localhost:8080/path".toURL(),
expected = URI.create("https://localhost:8080/path").toURL(),
actual = "https://localhost:8080/path".toURL(),
)
}

@Test
fun testWithPath() {
assertEquals(
URL("https", "localhost", 8080, "/foo/bar"),
URL("https", "localhost", 8080, "/").withPath("/foo/bar"),
expected = "https://localhost:8080/foo/bar".toURL(),
actual = "https://localhost:8080/".toURL().withPath("/foo/bar"),
)

assertEquals(
URL("https", "localhost", 8080, "/foo/bar"),
URL("https", "localhost", 8080, "/old/path").withPath("/foo/bar"),
expected = "https://localhost:8080/foo/bar".toURL(),
actual = "https://localhost:8080/old/path".toURL().withPath("/foo/bar"),
)
}

Expand Down
Loading