Clickable folder link after download

This commit is contained in:
Geomitron
2020-02-12 10:56:32 -05:00
parent 7d4d339018
commit 6c26c98468
7 changed files with 28 additions and 5 deletions

View File

@@ -20,7 +20,10 @@
Download Anyway
</button>
<div class="header">{{download.header}}</div>
<div class="description">{{download.description}}</div>
<div *ngIf="download.type != 'done'" class="description">{{download.description}}</div>
<div *ngIf="download.type == 'done'" class="description">
<a (click)="openFolder(download.description)">{{download.description}}</a>
</div>
<div appProgressBar [percent]="download.percent" class="ui progress">
<div class="bar">
<div class="progress"></div>

View File

@@ -1,6 +1,7 @@
import { Component, ChangeDetectorRef } from '@angular/core'
import { DownloadProgress } from '../../../../../electron/shared/interfaces/download.interface'
import { DownloadService } from '../../../../core/services/download.service'
import { ElectronService } from 'src/app/core/services/electron.service'
@Component({
selector: 'app-downloads-modal',
@@ -11,7 +12,7 @@ export class DownloadsModalComponent {
downloads: DownloadProgress[] = []
constructor(private downloadService: DownloadService, ref: ChangeDetectorRef) {
constructor(private electronService: ElectronService, private downloadService: DownloadService, ref: ChangeDetectorRef) {
downloadService.onDownloadUpdated(download => {
const index = this.downloads.findIndex(thisDownload => thisDownload.versionID == download.versionID)
if (index == -1) {
@@ -45,8 +46,13 @@ export class DownloadsModalComponent {
getBackgroundColor(download: DownloadProgress) {
switch(download.type) {
case 'good': return 'unset'
case 'done': return 'unset'
case 'warning': return 'yellow'
case 'error': return 'indianred'
}
}
openFolder(filepath: string) {
this.electronService.sendIPC('open-folder', filepath)
}
}

View File

@@ -26,6 +26,7 @@ export class DownloadService {
}
addDownload(versionID: number, newDownload: NewDownload) {
if (this.downloads.findIndex(download => download.versionID == versionID) != -1) { return } // Don't download something twice
this.electronService.receiveIPC('download-updated', result => {
this.downloadUpdatedEmitter.emit(result)