Skip to content

Commit a64cb33

Browse files
authored
Merge pull request #21 from coder/improve-authentication-flow
Start auth flow when user hits ENTER in the url field
2 parents c935a50 + 7546726 commit a64cb33

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/kotlin/com/coder/gateway/views/CoderGatewayConnectorWizardView.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
3030
private fun setupWizard() {
3131
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
3232

33-
registerStep(CoderAuthStepView())
33+
registerStep(CoderAuthStepView { next() })
3434
registerStep(CoderWorkspacesStepView())
3535
registerStep(CoderLocateRemoteProjectStepView())
3636

src/main/kotlin/com/coder/gateway/views/steps/CoderAuthStepView.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ import kotlinx.coroutines.cancel
3939
import org.zeroturnaround.exec.ProcessExecutor
4040
import java.awt.Dimension
4141

42-
class CoderAuthStepView : CoderWorkspacesWizardStep, Disposable {
42+
class CoderAuthStepView(private val nextAction: () -> Unit) : CoderWorkspacesWizardStep, Disposable {
4343
private val cs = CoroutineScope(Dispatchers.Main)
4444
private var model = CoderWorkspacesWizardModel()
4545
private val coderClient: CoderRestClientService = ApplicationManager.getApplication().getService(CoderRestClientService::class.java)
@@ -59,7 +59,11 @@ class CoderAuthStepView : CoderWorkspacesWizardStep, Disposable {
5959
browserLink(CoderGatewayBundle.message("gateway.connector.view.login.documentation.action"), "https://coder.com/docs/coder/latest/workspaces")
6060
}.bottomGap(BottomGap.MEDIUM)
6161
row(CoderGatewayBundle.message("gateway.connector.view.login.url.label")) {
62-
textField().resizableColumn().horizontalAlign(HorizontalAlign.FILL).gap(RightGap.SMALL).bindText(model::coderURL)
62+
textField().resizableColumn().horizontalAlign(HorizontalAlign.FILL).gap(RightGap.SMALL).bindText(model::coderURL).applyToComponent {
63+
addActionListener {
64+
nextAction()
65+
}
66+
}
6367
cell()
6468
}
6569
}

0 commit comments

Comments
 (0)