Overall progress bar turns red on download fail

This commit is contained in:
Geomitron
2020-07-06 21:35:09 -04:00
parent 03f061d9c7
commit f673751528
3 changed files with 7 additions and 1 deletions

View File

@@ -6,7 +6,7 @@
</button>
</div>
<a *ngIf="downloading" class="item right" (click)="showDownloads()">
<div #progressBar appProgressBar [percent]="percent" class="ui progress">
<div #progressBar appProgressBar [percent]="percent" class="ui progress" [style.background-color]="error ? 'indianred' : undefined">
<div class="bar">
<div class="progress"></div>
</div>

View File

@@ -15,6 +15,7 @@ export class StatusBarComponent {
resultCount = 0
downloading = false
error = false
percent = 0
batchResults: VersionResult[]
chartGroups: VersionResult[][]
@@ -30,6 +31,7 @@ export class StatusBarComponent {
setTimeout(() => { // Make sure this is the last callback executed to get the accurate downloadCount
this.downloading = downloadService.downloadCount > 0
this.percent = downloadService.totalPercent
this.error = downloadService.anyErrorsExist
ref.detectChanges()
}, 0)
})

View File

@@ -26,6 +26,10 @@ export class DownloadService {
return total / this.downloads.length
}
get anyErrorsExist() {
return this.downloads.find(download => download.type == 'error') ? true : false
}
addDownload(versionID: number, newDownload: NewDownload) {
if (!this.downloads.find(download => download.versionID == versionID)) { // Don't download something twice
this.electronService.receiveIPC('download-updated', result => {