Skip to content

Commit 278a0b6

Browse files
committed
Fix: disable next button when no workspace is selected
- resolves #60
1 parent 1543d4e commit 278a0b6

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
- left panel is no longer visible when a new connection is triggered from Coder's "Recent Workspaces" panel.
99
This provides consistency with other plugins compatible with Gateway
10+
- the "Select IDE and Project" button in the "Coder Workspaces" view is now disabled when no workspace is selected
1011

1112
### Changed
1213

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
2929
private fun setupWizard() {
3030
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
3131

32-
registerStep(CoderWorkspacesStepView())
32+
registerStep(CoderWorkspacesStepView { nextButton.isEnabled = it })
3333
registerStep(CoderLocateRemoteProjectStepView {
3434
nextButton.isVisible = false
3535
})

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

+5-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ import javax.swing.table.DefaultTableCellRenderer
5959
import javax.swing.table.TableCellRenderer
6060

6161

62-
class CoderWorkspacesStepView : CoderWorkspacesWizardStep, Disposable {
62+
class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) : CoderWorkspacesWizardStep, Disposable {
6363
private val cs = CoroutineScope(Dispatchers.Main)
6464
private var wizardModel = CoderWorkspacesWizardModel()
6565
private val coderClient: CoderRestClientService = ApplicationManager.getApplication().getService(CoderRestClientService::class.java)
@@ -77,6 +77,9 @@ class CoderWorkspacesStepView : CoderWorkspacesWizardStep, Disposable {
7777
}
7878

7979
setSelectionMode(ListSelectionModel.SINGLE_SELECTION)
80+
selectionModel.addListSelectionListener {
81+
enableNextButtonCallback(selectedObject != null)
82+
}
8083
}
8184

8285
override val component = panel {
@@ -118,6 +121,7 @@ class CoderWorkspacesStepView : CoderWorkspacesWizardStep, Disposable {
118121
override val nextActionText = CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.next.text")
119122

120123
override fun onInit(wizardModel: CoderWorkspacesWizardModel) {
124+
enableNextButtonCallback(false)
121125
}
122126

123127
private fun loginAndLoadWorkspace() {

0 commit comments

Comments
 (0)