Skip to content

Commit 03e2cc3

Browse files
committed
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.
1 parent 93ab80e commit 03e2cc3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ class ConnectStep(
8585
// allows interleaving with the back/cancel action
8686
yield()
8787
client.initializeSession()
88-
statusField.textState.update { (context.i18n.ptrl("Checking Coder CLI...")) }
88+
logAndReportProgress("Checking Coder CLI...")
8989
val cli = ensureCLI(
9090
context, client.url,
9191
client.buildVersion
@@ -94,12 +94,12 @@ class ConnectStep(
9494
}
9595
// We only need to log in if we are using token-based auth.
9696
if (context.settingsStore.requireTokenAuth) {
97-
statusField.textState.update { (context.i18n.ptrl("Configuring Coder CLI...")) }
97+
logAndReportProgress("Configuring Coder CLI...")
9898
// allows interleaving with the back/cancel action
9999
yield()
100100
cli.login(client.token!!)
101101
}
102-
statusField.textState.update { (context.i18n.ptrl("Successfully configured ${CoderCliSetupContext.url!!.host}...")) }
102+
logAndReportProgress("Successfully configured ${CoderCliSetupContext.url!!.host}...")
103103
// allows interleaving with the back/cancel action
104104
yield()
105105
CoderCliSetupContext.reset()
@@ -119,6 +119,11 @@ class ConnectStep(
119119
}
120120
}
121121

122+
private fun logAndReportProgress(msg: String) {
123+
context.logger.info(msg)
124+
statusField.textState.update { context.i18n.pnotr(msg) }
125+
}
126+
122127
override fun onNext(): Boolean {
123128
return false
124129
}

0 commit comments

Comments
 (0)