Files
start-os/ui/src/app/pages/apps-routes/app-show/components/app-show-progress/app-show-progress.component.ts
Alex Inkin 5e681aa3fb refactor(app-show): refactor component (#961)
* refactor(app-show): refactor component

* chore: remove precommit hook for the time being

* chore: fix mutation by spreading

Co-authored-by: Drew Ansbacher <drew.ansbacher@spiredigital.com>
2022-01-21 20:35:52 -07:00

39 lines
1023 B
TypeScript

import { ChangeDetectionStrategy, Component, Input } from '@angular/core'
import {
InstallProgress,
PackageDataEntry,
} from 'src/app/services/patch-db/data-model'
import { ProgressData } from 'src/app/util/package-loading-progress'
@Component({
selector: 'app-show-progress',
templateUrl: './app-show-progress.component.html',
styleUrls: ['./app-show-progress.component.scss'],
changeDetection: ChangeDetectionStrategy.OnPush,
})
export class AppShowProgressComponent {
@Input()
pkg: PackageDataEntry
@Input()
installProgress: ProgressData
get unpackingBuffer(): number {
return this.installProgress.validateProgress === 100 &&
!this.installProgress.unpackProgress
? 0
: 1
}
get validationBuffer(): number {
return this.installProgress.downloadProgress === 100 &&
!this.installProgress.validateProgress
? 0
: 1
}
getColor(action: keyof InstallProgress): string {
return this.pkg['install-progress'][action] ? 'success' : 'secondary'
}
}