Skip to content

Commit 0714fdc

Browse files
committed
Fix: disable next action button in the last step of the wizard
-when no IDE could be resolved
1 parent b83487d commit 0714fdc

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
3232

3333
registerStep(CoderAuthStepView { next() })
3434
registerStep(CoderWorkspacesStepView())
35-
registerStep(CoderLocateRemoteProjectStepView())
35+
registerStep(CoderLocateRemoteProjectStepView {
36+
nextButton.isVisible = false
37+
})
3638

3739
addToBottom(createBackComponent())
3840

@@ -64,9 +66,15 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
6466
nextButton.text = nextActionText
6567
previousButton.text = previousActionText
6668
}
69+
showNavigationButtons()
6770
}
6871
}
6972

73+
private fun showNavigationButtons() {
74+
nextButton.isVisible = true
75+
previousButton.isVisible = true
76+
}
77+
7078
private fun next() {
7179
if (!doNextCallback()) return
7280
if (currentStep + 1 < steps.size) {
@@ -81,6 +89,7 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
8189
nextButton.text = nextActionText
8290
previousButton.text = previousActionText
8391
}
92+
showNavigationButtons()
8493
}
8594
}
8695

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import javax.swing.JPanel
4444
import javax.swing.ListCellRenderer
4545
import javax.swing.SwingConstants
4646

47-
class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
47+
class CoderLocateRemoteProjectStepView(private val disableNextAction: () -> Unit) : CoderWorkspacesWizardStep, Disposable {
4848
private val cs = CoroutineScope(Dispatchers.Main)
4949
private val coderClient: CoderRestClientService = ApplicationManager.getApplication().getService(CoderRestClientService::class.java)
5050

@@ -124,6 +124,7 @@ class CoderLocateRemoteProjectStepView : CoderWorkspacesWizardStep, Disposable {
124124
}
125125
}
126126
if (workspaceOS == null) {
127+
disableNextAction()
127128
cbIDE.renderer = object : ColoredListCellRenderer<IdeWithStatus>() {
128129
override fun customizeCellRenderer(list: JList<out IdeWithStatus>, value: IdeWithStatus?, index: Int, isSelected: Boolean, cellHasFocus: Boolean) {
129130
background = UIUtil.getListBackground(isSelected, cellHasFocus)

0 commit comments

Comments
 (0)