Skip to content

Commit fda6c44

Browse files
committed
Add more logs around authenticating
Also rename the function since it loads all workspaces, not just one.
1 parent cfc7dbb commit fda6c44

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/kotlin/com/coder/gateway/views/steps/CoderWorkspacesStepView.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
353353
localWizardModel.token = token
354354
}
355355
if (!url.isNullOrBlank() && !token.isNullOrBlank()) {
356-
loginAndLoadWorkspace(token, true)
356+
loginAndLoadWorkspaces(token, true)
357357
}
358358
}
359359
updateWorkspaceActions()
@@ -451,10 +451,10 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
451451
}
452452
// False so that subsequent authentication failures do not keep opening
453453
// the browser as it was already opened earlier.
454-
loginAndLoadWorkspace(pastedToken, false)
454+
loginAndLoadWorkspaces(pastedToken, false)
455455
}
456456

457-
private fun loginAndLoadWorkspace(token: String, openBrowser: Boolean) {
457+
private fun loginAndLoadWorkspaces(token: String, openBrowser: Boolean) {
458458
LifetimeDefinition().launchUnderBackgroundProgress(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.cli.downloader.dialog.title"), canBeCancelled = false, isIndeterminate = true) {
459459
this.indicator.apply {
460460
text = "Authenticating..."
@@ -575,23 +575,28 @@ class CoderWorkspacesStepView(val setNextButtonEnabled: (Boolean) -> Unit) : Cod
575575
* versions do not match.
576576
*/
577577
private fun authenticate(token: String) {
578+
logger.info("Authenticating...")
578579
coderClient.initClientSession(localWizardModel.coderURL.toURL(), token)
579580

581+
logger.info("Checking Coder version...")
580582
if (!CoderSemVer.isValidVersion(coderClient.buildVersion)) {
583+
logger.warn("Got invalid version ${coderClient.buildVersion}")
581584
notificationBanner.apply {
582585
component.isVisible = true
583586
showWarning(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.invalid.coder.version", coderClient.buildVersion))
584587
}
585588
} else {
586589
val coderVersion = CoderSemVer.parse(coderClient.buildVersion)
587590
if (!coderVersion.isInClosedRange(CoderSupportedVersions.minCompatibleCoderVersion, CoderSupportedVersions.maxCompatibleCoderVersion)) {
591+
logger.warn("Running with incompatible version ${coderClient.buildVersion}")
588592
notificationBanner.apply {
589593
component.isVisible = true
590594
showWarning(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.unsupported.coder.version", coderClient.buildVersion))
591595
}
592596
}
593597
}
594598

599+
logger.info("Authenticated successfully")
595600
appPropertiesService.setValue(CODER_URL_KEY, localWizardModel.coderURL)
596601
appPropertiesService.setValue(SESSION_TOKEN, token)
597602
}

0 commit comments

Comments
 (0)