Skip to content

Report rest client errors, dispose coroutine scopes & disable last Next button #23

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 3 commits into from
Jun 24, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Fix: disable next action button in the last step of the wizard
-when no IDE could be resolved
  • Loading branch information
fioan89 committed Jun 24, 2022
commit 0714fdcdee3bfd06c112e083e2300002a2be69ab
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {

registerStep(CoderAuthStepView { next() })
registerStep(CoderWorkspacesStepView())
registerStep(CoderLocateRemoteProjectStepView())
registerStep(CoderLocateRemoteProjectStepView {
nextButton.isVisible = false
})

addToBottom(createBackComponent())

Expand Down Expand Up @@ -64,9 +66,15 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
nextButton.text = nextActionText
previousButton.text = previousActionText
}
showNavigationButtons()
}
}

private fun showNavigationButtons() {
nextButton.isVisible = true
previousButton.isVisible = true
}

private fun next() {
if (!doNextCallback()) return
if (currentStep + 1 < steps.size) {
Expand All @@ -81,6 +89,7 @@ class CoderGatewayConnectorWizardView : BorderLayoutPanel(), Disposable {
nextButton.text = nextActionText
previousButton.text = previousActionText
}
showNavigationButtons()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import javax.swing.JPanel
import javax.swing.ListCellRenderer
import javax.swing.SwingConstants

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

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