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