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

Commit3b36d68

Browse files
committed
Avoid URL as map key
1 parent89e04b0 commit3b36d68

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

‎src/main/kotlin/com/coder/gateway/views/CoderGatewayRecentWorkspaceConnectionsView.kt‎

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@ import com.coder.gateway.models.WorkspaceAgentListModel
1010
importcom.coder.gateway.models.WorkspaceProjectIDE
1111
importcom.coder.gateway.models.toWorkspaceProjectIDE
1212
importcom.coder.gateway.sdk.CoderRestClient
13-
importcom.coder.gateway.sdk.ex.APIResponseException
1413
importcom.coder.gateway.sdk.v2.models.WorkspaceStatus
1514
importcom.coder.gateway.sdk.v2.models.toAgentList
1615
importcom.coder.gateway.services.CoderRecentWorkspaceConnectionsService
1716
importcom.coder.gateway.services.CoderRestClientService
1817
importcom.coder.gateway.services.CoderSettingsService
1918
importcom.coder.gateway.util.humanizeConnectionError
19+
importcom.coder.gateway.util.toURL
2020
importcom.coder.gateway.util.withPath
2121
importcom.coder.gateway.util.withoutNull
2222
importcom.intellij.icons.AllIcons
@@ -56,7 +56,6 @@ import kotlinx.coroutines.launch
5656
importkotlinx.coroutines.withContext
5757
importjava.awt.Component
5858
importjava.awt.Dimension
59-
importjava.net.URL
6059
importjava.util.Locale
6160
importjavax.swing.JComponent
6261
importjavax.swing.event.DocumentEvent
@@ -159,7 +158,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
159158
panel {
160159
connectionsByDeployment.forEach { (deploymentURL, connectionsByWorkspace)->
161160
var first=true
162-
val deployment= deployments[deploymentURL.toString()]
161+
val deployment= deployments[deploymentURL]
163162
val deploymentError= deployment?.error
164163
connectionsByWorkspace.forEach { (workspaceName, connections)->
165164
// Show the error at the top of each deployment list.
@@ -198,7 +197,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
198197
label(workspaceName).applyToComponent {
199198
font=JBFont.h3().asBold()
200199
}.align(AlignX.LEFT).gap(RightGap.SMALL)
201-
label(deploymentURL.toString()).applyToComponent {
200+
label(deploymentURL).applyToComponent {
202201
foreground=UIUtil.getContextHelpForeground()
203202
font=ComponentPanelBuilder.getCommentFont(font)
204203
}
@@ -305,7 +304,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
305304
/**
306305
* Get valid connections grouped by deployment and workspace.
307306
*/
308-
privatefungetConnectionsByDeployment(filter:Boolean):Map<URL,Map<String,List<WorkspaceProjectIDE>>> {
307+
privatefungetConnectionsByDeployment(filter:Boolean):Map<String,Map<String,List<WorkspaceProjectIDE>>> {
309308
return recentConnectionsService.getAllRecentConnections()
310309
// Validate and parse connections.
311310
.mapNotNull {
@@ -319,7 +318,7 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
319318
}
320319
.filter {!filter|| matchesFilter(it) }
321320
// Group by the deployment.
322-
.groupBy { it.deploymentURL }
321+
.groupBy { it.deploymentURL.toString() }
323322
// Group the connections in each deployment by workspace.
324323
.mapValues { (_, connections)->
325324
connections
@@ -369,12 +368,12 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
369368
withContext(Dispatchers.IO) {
370369
val connectionsByDeployment= getConnectionsByDeployment(false)
371370
connectionsByDeployment.forEach { (deploymentURL, connectionsByWorkspace)->
372-
val deployment= deployments.getOrPut(deploymentURL.toString()) {DeploymentInfo() }
371+
val deployment= deployments.getOrPut(deploymentURL) {DeploymentInfo() }
373372
try {
374373
val client= deployment.client
375374
?:CoderRestClientService(
376-
deploymentURL,
377-
settings.token(deploymentURL)?.first,
375+
deploymentURL.toURL(),
376+
settings.token(deploymentURL.toURL())?.first,
378377
)
379378

380379
// Delete connections that have no workspace.
@@ -390,13 +389,13 @@ class CoderGatewayRecentWorkspaceConnectionsView(private val setContentCallback:
390389
deployment.items= items
391390
deployment.error=null
392391
}catch (e:Exception) {
393-
val msg= humanizeConnectionError(deploymentURL, settings.requireTokenAuth, e)
392+
val msg= humanizeConnectionError(deploymentURL.toURL(), settings.requireTokenAuth, e)
394393
deployment.items=null
395394
deployment.error= msg
396395
logger.error(msg, e)
397-
if (eisAPIResponseException&& e.isUnauthorized&& settings.requireTokenAuth) {
398-
//TODO: Ask for a token and reconfigure the CLI.
399-
}
396+
// TODO: Ask for a token and reconfigure the CLI.
397+
//if (e is APIResponseException && e.isUnauthorized && settings.requireTokenAuth) {
398+
//}
400399
}
401400
}
402401
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp