Skip to content
Merged
Prev Previous commit
Next Next commit
impl: log plugin setup progress
During plugin initialization we have a couple of steps that are only reported in the screen.
If there is any error happening in between the steps, it is hard to identify between which steps
things went wrong without a screenshots provided by the user.
  • Loading branch information
fioan89 committed Aug 26, 2025
commit 03e2cc3b8a24028d96fc5dfd7b8eab23e90b2899
11 changes: 8 additions & 3 deletions src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ class ConnectStep(
// allows interleaving with the back/cancel action
yield()
client.initializeSession()
statusField.textState.update { (context.i18n.ptrl("Checking Coder CLI...")) }
logAndReportProgress("Checking Coder CLI...")
val cli = ensureCLI(
context, client.url,
client.buildVersion
Expand All @@ -94,12 +94,12 @@ class ConnectStep(
}
// We only need to log in if we are using token-based auth.
if (context.settingsStore.requireTokenAuth) {
statusField.textState.update { (context.i18n.ptrl("Configuring Coder CLI...")) }
logAndReportProgress("Configuring Coder CLI...")
// allows interleaving with the back/cancel action
yield()
cli.login(client.token!!)
}
statusField.textState.update { (context.i18n.ptrl("Successfully configured ${CoderCliSetupContext.url!!.host}...")) }
logAndReportProgress("Successfully configured ${CoderCliSetupContext.url!!.host}...")
// allows interleaving with the back/cancel action
yield()
CoderCliSetupContext.reset()
Expand All @@ -119,6 +119,11 @@ class ConnectStep(
}
}

private fun logAndReportProgress(msg: String) {
context.logger.info(msg)
statusField.textState.update { context.i18n.pnotr(msg) }
}

override fun onNext(): Boolean {
return false
}
Expand Down