Skip to content

fix: go to previous step when connection fails #77

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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
Expand Down
2 changes: 1 addition & 1 deletion src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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)


/**
Expand Down
5 changes: 5 additions & 0 deletions src/main/kotlin/com/coder/toolbox/views/ConnectStep.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class ConnectStep(
private val context: CoderToolboxContext,
private val shouldAutoLogin: StateFlow<Boolean>,
private val notify: (String, Throwable) -> Unit,
private val refreshWizard: () -> Unit,
private val onConnect: (
client: CoderRestClient,
cli: CoderCLIManager,
Expand Down Expand Up @@ -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()
}
}
}
Expand Down
Loading