File tree Expand file tree Collapse file tree 3 files changed +18
-1
lines changed
src/main/kotlin/com/coder/gateway/util Expand file tree Collapse file tree 3 files changed +18
-1
lines changed Original file line number Diff line number Diff line change 4
4
5
5
## Unreleased
6
6
7
+ ### Added
8
+
9
+ - Support an "owner" parameter when launching an IDE from the dashboard. This
10
+ makes it possible to reliably connect to the right workspace in the case where
11
+ multiple users are using the same workspace name and the workspace filter is
12
+ configured to show multiple users' workspaces. This requires an updated
13
+ Gateway module that includes the new "owner" parameter.
14
+
7
15
## 2.15.0 - 2024-10-04
8
16
9
17
### Added
Original file line number Diff line number Diff line change @@ -52,10 +52,16 @@ open class LinkHandler(
52
52
// TODO: Show a dropdown and ask for the workspace if missing.
53
53
val workspaceName = parameters.workspace() ? : throw MissingArgumentException (" Query parameter \" $WORKSPACE \" is missing" )
54
54
55
+ // The owner was added to support getting into another user's workspace
56
+ // but may not exist if the Coder Gateway module is out of date.
57
+ val owner = parameters.owner()
58
+
55
59
val workspaces = client.workspaces()
56
60
val workspace =
57
61
workspaces.firstOrNull {
58
- it.name == workspaceName
62
+ // Without an owner, just find the first workspace that matches.
63
+ (owner.isNullOrBlank() || it.ownerName == owner) &&
64
+ it.name == workspaceName
59
65
} ? : throw IllegalArgumentException (" The workspace $workspaceName does not exist" )
60
66
61
67
when (workspace.latestBuild.status) {
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ private const val TYPE = "type"
5
5
const val URL = " url"
6
6
const val TOKEN = " token"
7
7
const val WORKSPACE = " workspace"
8
+ const val OWNER = " owner"
8
9
const val AGENT_NAME = " agent"
9
10
const val AGENT_ID = " agent_id"
10
11
private const val FOLDER = " folder"
@@ -24,6 +25,8 @@ fun Map<String, String>.token() = this[TOKEN]
24
25
25
26
fun Map <String , String >.workspace () = this [WORKSPACE ]
26
27
28
+ fun Map <String , String >.owner () = this [OWNER ]
29
+
27
30
fun Map <String , String ?>.agentName () = this [AGENT_NAME ]
28
31
29
32
fun Map <String , String ?>.agentID () = this [AGENT_ID ]
You can’t perform that action at this time.
0 commit comments