Skip to content

Clear workspaces on reconnect and fetch immediately on return #182

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
Mar 3, 2023
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
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@

- support for Gateway 2023

### Fixed

- the "Select IDE and Project" button is no longer disabled for a time after
going back a step

### Changed

- initial authentication is now asynchronous which means no hang on the main
screen while that happens and it shows in the progress bar

## 2.1.7 - 2023-02-28

### Fixed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,11 +212,13 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
tfUrl = textField().resizableColumn().align(AlignX.FILL).gap(RightGap.SMALL).bindText(localWizardModel::coderURL).applyToComponent {
addActionListener {
poller?.cancel()
listTableModelOfWorkspaces.items = emptyList()
askTokenAndOpenSession(true)
}
}.component
button(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.connect.text")) {
poller?.cancel()
listTableModelOfWorkspaces.items = emptyList()
askTokenAndOpenSession(true)
}.applyToComponent {
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
Expand Down Expand Up @@ -309,9 +311,9 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
}

override fun onInit(wizardModel: CoderWorkspacesWizardModel) {
enableNextButtonCallback(false)
listTableModelOfWorkspaces.items = emptyList()
if (localWizardModel.coderURL.isNotBlank() && localWizardModel.token.isNotBlank()) {
triggerWorkspacePolling()
triggerWorkspacePolling(true)
} else {
val url = appPropertiesService.getValue(CODER_URL_KEY)
val token = appPropertiesService.getValue(SESSION_TOKEN)
Expand Down Expand Up @@ -434,7 +436,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :

this.indicator.fraction = 1.0
updateWorkspaceActions()
triggerWorkspacePolling()
triggerWorkspacePolling(false)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't really see the harm in requesting the workspaces a bit earlier.

}
}

Expand Down Expand Up @@ -465,10 +467,13 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
return tokenFromUser
}

private fun triggerWorkspacePolling() {
private fun triggerWorkspacePolling(fetchNow: Boolean) {
poller?.cancel()

poller = cs.launch {
if (fetchNow) {
loadWorkspaces()
}
while (isActive) {
delay(5000)
loadWorkspaces()
Expand Down