@@ -10,13 +10,13 @@ import com.coder.gateway.models.WorkspaceAgentListModel
1010import com.coder.gateway.models.WorkspaceProjectIDE
1111import com.coder.gateway.models.toWorkspaceProjectIDE
1212import com.coder.gateway.sdk.CoderRestClient
13- import com.coder.gateway.sdk.ex.APIResponseException
1413import com.coder.gateway.sdk.v2.models.WorkspaceStatus
1514import com.coder.gateway.sdk.v2.models.toAgentList
1615import com.coder.gateway.services.CoderRecentWorkspaceConnectionsService
1716import com.coder.gateway.services.CoderRestClientService
1817import com.coder.gateway.services.CoderSettingsService
1918import com.coder.gateway.util.humanizeConnectionError
19+ import com.coder.gateway.util.toURL
2020import com.coder.gateway.util.withPath
2121import com.coder.gateway.util.withoutNull
2222import com.intellij.icons.AllIcons
@@ -56,7 +56,6 @@ import kotlinx.coroutines.launch
5656import kotlinx.coroutines.withContext
5757import java.awt.Component
5858import java.awt.Dimension
59- import java.net.URL
6059import java.util.Locale
6160import javax.swing.JComponent
6261import javax.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- private fun getConnectionsByDeployment (filter : Boolean ): Map <URL , Map <String , List <WorkspaceProjectIDE >>> {
307+ private fun getConnectionsByDeployment (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 (e is APIResponseException && 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