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

Commitc4b8cc8

Browse files
committed
Support owner param in link handler
1 parenteed4676 commitc4b8cc8

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

‎CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,14 @@
44

55
##Unreleased
66

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+
715
##2.15.0 - 2024-10-04
816

917
###Added

‎src/main/kotlin/com/coder/gateway/util/LinkHandler.kt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,15 @@ open class LinkHandler(
5252
// TODO: Show a dropdown and ask for the workspace if missing.
5353
val workspaceName= parameters.workspace()?:throwMissingArgumentException("Query parameter\"$WORKSPACE\" is missing")
5454

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. If no
57+
// owner is included, assume the current user.
58+
val owner= (parameters.owner()?: client.me.username).ifBlank { client.me.username }
59+
5560
val workspaces= client.workspaces()
5661
val workspace=
5762
workspaces.firstOrNull {
58-
it.name== workspaceName
63+
it.ownerName== owner&& it.name== workspaceName
5964
}?:throwIllegalArgumentException("The workspace$workspaceName does not exist")
6065

6166
when (workspace.latestBuild.status) {

‎src/main/kotlin/com/coder/gateway/util/LinkMap.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ private const val TYPE = "type"
55
constvalURL="url"
66
constvalTOKEN="token"
77
constvalWORKSPACE="workspace"
8+
constvalOWNER="owner"
89
constvalAGENT_NAME="agent"
910
constvalAGENT_ID="agent_id"
1011
privateconstvalFOLDER="folder"
@@ -24,6 +25,8 @@ fun Map<String, String>.token() = this[TOKEN]
2425

2526
funMap<String,String>.workspace()=this[WORKSPACE]
2627

28+
funMap<String,String>.owner()=this[OWNER]
29+
2730
funMap<String,String?>.agentName()=this[AGENT_NAME]
2831

2932
funMap<String,String?>.agentID()=this[AGENT_ID]

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp