From 64b46472ff2669eaa2bdb2e8d0d619da3d3e3b7e Mon Sep 17 00:00:00 2001 From: Faur Ioan-Aurel Date: Thu, 10 Apr 2025 00:36:28 +0300 Subject: [PATCH] fix: go to previous step when connection fails - happens when an error is encountered during connection (like exceptions caused by an expired token) - right now the auth wizard stays on the last step. - with this changeset the auth steps reset to the initial sign in for auto-connect, or it goes back one step back to the token input step for manual authentication --- CHANGELOG.md | 4 ++++ src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt | 2 +- src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt | 5 +++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index be5a605..b45bc45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - action buttons on the token input step were swapped to achieve better keyboard navigation +### Fixed + +- authorization wizard automatically goes to a previous screen when an error is encountered during connection to Coder deployment + ## 0.1.3 - 2025-04-09 ### Fixed diff --git a/src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt b/src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt index a39288d..ad0a6de 100644 --- a/src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt +++ b/src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt @@ -22,7 +22,7 @@ class AuthWizardPage( private val signInStep = SignInStep(context) private val tokenStep = TokenStep(context) - private val connectStep = ConnectStep(context, shouldAutoLogin, this::notify, onConnect) + private val connectStep = ConnectStep(context, shouldAutoLogin, this::notify, this::displaySteps, onConnect) /** diff --git a/src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt b/src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt index ca77f30..30f757b 100644 --- a/src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt +++ b/src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt @@ -27,6 +27,7 @@ class ConnectStep( private val context: CoderToolboxContext, private val shouldAutoLogin: StateFlow, private val notify: (String, Throwable) -> Unit, + private val refreshWizard: () -> Unit, private val onConnect: ( client: CoderRestClient, cli: CoderCLIManager, @@ -102,9 +103,13 @@ class ConnectStep( } catch (ex: CancellationException) { if (ex.message != USER_HIT_THE_BACK_BUTTON) { notify("Connection to ${url.host} was configured", ex) + onBack() + refreshWizard() } } catch (ex: Exception) { notify("Failed to configure ${url.host}", ex) + onBack() + refreshWizard() } } } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy