fixed spinner handling - fixes #6489, fixes #6476, fixes #3383

This commit is contained in:
Eugene Pankov
2022-05-27 14:44:49 +02:00
parent f160353abe
commit 509ae8d32e

View File

@@ -138,6 +138,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
},
})
private spinnerActive = false
private spinnerPaused = false
private toolbarRevealTimeout = new ResettableTimeout(() => {
this.revealToolbar = false
}, 1000)
@@ -760,7 +761,7 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}
protected startSpinner (text?: string): void {
if (this.spinnerActive) {
if (this.spinnerActive || this.spinnerPaused) {
return
}
if (text) {
@@ -782,11 +783,19 @@ export class BaseTerminalTabComponent extends BaseTabComponent implements OnInit
}
protected async withSpinnerPaused (work: () => any): Promise<void> {
const wasActive = this.spinnerActive
this.stopSpinner()
await work()
if (wasActive) {
this.startSpinner()
this.spinnerPaused = true
if (this.spinnerActive) {
this.spinner.stop(true)
}
try {
await work()
} finally {
this.spinnerPaused = false
if (this.spinnerActive) {
this.zone.runOutsideAngular(() => {
this.spinner.start()
})
}
}
}