Skip to content

fix: access the settings page for the auth. wizard #105

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 1 commit into from
May 5, 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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

- rendering glitches when a Workspace is stopped while SSH connection is alive
- misleading message saying that there are no workspaces rendered during manual authentication
- Coder Settings can now be accessed from the authentication wizard

## 0.2.0 - 2025-04-24

Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/com/coder/toolbox/CoderRemoteProvider.kt
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ class CoderRemoteProvider(
if (autologin && lastDeploymentURL.isNotBlank() && (lastToken.isNotBlank() || !settings.requireTokenAuth)) {
try {
AuthWizardState.goToStep(WizardStep.LOGIN)
return AuthWizardPage(context, true, ::onConnect)
return AuthWizardPage(context, settingsPage, true, ::onConnect)
} catch (ex: Exception) {
errorBuffer.add(ex)
}
Expand All @@ -306,7 +306,7 @@ class CoderRemoteProvider(
firstRun = false

// Login flow.
val authWizard = AuthWizardPage(context, false, ::onConnect)
val authWizard = AuthWizardPage(context, settingsPage, false, ::onConnect)
// We might have navigated here due to a polling error.
errorBuffer.forEach {
authWizard.notify("Error encountered", it)
Expand Down
12 changes: 9 additions & 3 deletions src/main/kotlin/com/coder/toolbox/views/AuthWizardPage.kt
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ import kotlinx.coroutines.flow.update

class AuthWizardPage(
private val context: CoderToolboxContext,
private val settingsPage: CoderSettingsPage,
initialAutoLogin: Boolean = false,
onConnect: (
client: CoderRestClient,
cli: CoderCLIManager,
) -> Unit,
) : CoderPage(context, context.i18n.ptrl("Authenticate to Coder")) {
) : CoderPage(context, context.i18n.ptrl("Authenticate to Coder"), false) {
private val shouldAutoLogin = MutableStateFlow(initialAutoLogin)

private val settingsAction = Action(context.i18n.ptrl("Settings"), actionBlock = {
context.ui.showUiPage(settingsPage)
})
private val signInStep = SignInStep(context, this::notify)
private val tokenStep = TokenStep(context)
private val connectStep = ConnectStep(context, shouldAutoLogin, this::notify, this::displaySteps, onConnect)
Expand Down Expand Up @@ -47,7 +50,8 @@ class AuthWizardPage(
if (signInStep.onNext()) {
displaySteps()
}
})
}),
settingsAction
)
}
signInStep.onVisible()
Expand All @@ -64,6 +68,7 @@ class AuthWizardPage(
displaySteps()
}
}),
settingsAction,
Action(context.i18n.ptrl("Back"), closesPage = false, actionBlock = {
tokenStep.onBack()
displaySteps()
Expand All @@ -79,6 +84,7 @@ class AuthWizardPage(
}
actionButtons.update {
listOf(
settingsAction,
Action(context.i18n.ptrl("Back"), closesPage = false, actionBlock = {
connectStep.onBack()
shouldAutoLogin.update {
Expand Down
Loading