diff --git a/terminus-core/src/components/baseTab.component.ts b/terminus-core/src/components/baseTab.component.ts index d236cce3..c9993895 100644 --- a/terminus-core/src/components/baseTab.component.ts +++ b/terminus-core/src/components/baseTab.component.ts @@ -15,6 +15,8 @@ export abstract class BaseTabComponent { protected progress = new Subject() protected activity = new Subject() + private progressClearTimeout: number + get focused$ (): Observable { return this.focused } get blurred$ (): Observable { return this.blurred } get titleChange$ (): Observable { return this.titleChange } @@ -40,6 +42,14 @@ export abstract class BaseTabComponent { setProgress (progress: number) { this.progress.next(progress) + if (progress) { + if (this.progressClearTimeout) { + clearTimeout(this.progressClearTimeout) + } + this.progressClearTimeout = setTimeout(() => { + this.setProgress(null) + }, 5000) + } } displayActivity (): void { diff --git a/terminus-core/src/components/tabHeader.component.scss b/terminus-core/src/components/tabHeader.component.scss index 6a1ea431..963a9112 100644 --- a/terminus-core/src/components/tabHeader.component.scss +++ b/terminus-core/src/components/tabHeader.component.scss @@ -79,7 +79,7 @@ $tabs-height: 36px; position: absolute; left: 0; top: 0; - bottom: 0; + height: 5px; z-index: -1; } } diff --git a/terminus-terminal/src/components/terminalTab.component.ts b/terminus-terminal/src/components/terminalTab.component.ts index fd3aac84..eedf4050 100644 --- a/terminus-terminal/src/components/terminalTab.component.ts +++ b/terminus-terminal/src/components/terminalTab.component.ts @@ -295,11 +295,13 @@ export class TerminalTabComponent extends BaseTabComponent { } write (data: string) { - let percentageMatch = /(\d+(\.\d+)?)%/.exec(data) + let percentageMatch = /(^|[^\d])(\d+(\.\d+)?)%([^\d]|$)/.exec(data) if (percentageMatch) { - let percentage = percentageMatch[2] ? parseFloat(percentageMatch[1]) : parseInt(percentageMatch[1]) - this.setProgress(percentage) - console.log('Detected progress:', percentage) + let percentage = percentageMatch[3] ? parseFloat(percentageMatch[2]) : parseInt(percentageMatch[2]) + if (percentage > 0 && percentage <= 100) { + this.setProgress(percentage) + console.log('Detected progress:', percentage) + } } else { this.setProgress(null) }