Skip to content

Commit 288a8a4

Browse files
authored
Merge pull request #182 from coder/asher/clear-fetch-workspaces
Clear workspaces on reconnect and fetch immediately on return
2 parents f51b551 + e209bd3 commit 288a8a4

File tree

2 files changed

+19
-4
lines changed

2 files changed

+19
-4
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@
88

99
- support for Gateway 2023
1010

11+
### Fixed
12+
13+
- the "Select IDE and Project" button is no longer disabled for a time after
14+
going back a step
15+
16+
### Changed
17+
18+
- initial authentication is now asynchronous which means no hang on the main
19+
screen while that happens and it shows in the progress bar
20+
1121
## 2.1.7 - 2023-02-28
1222

1323
### Fixed

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

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -212,11 +212,13 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
212212
tfUrl = textField().resizableColumn().align(AlignX.FILL).gap(RightGap.SMALL).bindText(localWizardModel::coderURL).applyToComponent {
213213
addActionListener {
214214
poller?.cancel()
215+
listTableModelOfWorkspaces.items = emptyList()
215216
askTokenAndOpenSession(true)
216217
}
217218
}.component
218219
button(CoderGatewayBundle.message("gateway.connector.view.coder.workspaces.connect.text")) {
219220
poller?.cancel()
221+
listTableModelOfWorkspaces.items = emptyList()
220222
askTokenAndOpenSession(true)
221223
}.applyToComponent {
222224
background = WelcomeScreenUIManager.getMainAssociatedComponentBackground()
@@ -309,9 +311,9 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
309311
}
310312

311313
override fun onInit(wizardModel: CoderWorkspacesWizardModel) {
312-
enableNextButtonCallback(false)
314+
listTableModelOfWorkspaces.items = emptyList()
313315
if (localWizardModel.coderURL.isNotBlank() && localWizardModel.token.isNotBlank()) {
314-
triggerWorkspacePolling()
316+
triggerWorkspacePolling(true)
315317
} else {
316318
val url = appPropertiesService.getValue(CODER_URL_KEY)
317319
val token = appPropertiesService.getValue(SESSION_TOKEN)
@@ -434,7 +436,7 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
434436

435437
this.indicator.fraction = 1.0
436438
updateWorkspaceActions()
437-
triggerWorkspacePolling()
439+
triggerWorkspacePolling(false)
438440
}
439441
}
440442

@@ -465,10 +467,13 @@ class CoderWorkspacesStepView(val enableNextButtonCallback: (Boolean) -> Unit) :
465467
return tokenFromUser
466468
}
467469

468-
private fun triggerWorkspacePolling() {
470+
private fun triggerWorkspacePolling(fetchNow: Boolean) {
469471
poller?.cancel()
470472

471473
poller = cs.launch {
474+
if (fetchNow) {
475+
loadWorkspaces()
476+
}
472477
while (isActive) {
473478
delay(5000)
474479
loadWorkspaces()

0 commit comments

Comments
 (0)