diff options
author | Alex <alexta69@gmail.com> | 2021-07-29 21:17:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-29 21:17:07 +0300 |
commit | 09da20881cffb0545195e3a061b22c8aa1fdcec6 (patch) | |
tree | 90621657d7da91cd1db644cbdcbb527639c2e703 /ui/src/app/app.component.ts | |
parent | Merge pull request #37 from Rpsl/master (diff) | |
parent | Remove download from "done" when retry it (diff) | |
download | metube-09da20881cffb0545195e3a061b22c8aa1fdcec6.tar.gz metube-09da20881cffb0545195e3a061b22c8aa1fdcec6.tar.bz2 metube-09da20881cffb0545195e3a061b22c8aa1fdcec6.zip |
Merge pull request #38 from Rpsl/retry_button
Added retry button for failed download
Diffstat (limited to 'ui/src/app/app.component.ts')
-rw-r--r-- | ui/src/app/app.component.ts | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/ui/src/app/app.component.ts b/ui/src/app/app.component.ts index cc8ceb2..8b668c6 100644 --- a/ui/src/app/app.component.ts +++ b/ui/src/app/app.component.ts @@ -1,5 +1,6 @@ import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core'; import { faTrashAlt, faCheckCircle, faTimesCircle } from '@fortawesome/free-regular-svg-icons'; +import { faRedoAlt } from '@fortawesome/free-solid-svg-icons'; import { DownloadsService, Status } from './downloads.service'; import { MasterCheckboxComponent } from './master-checkbox.component'; @@ -21,7 +22,7 @@ export class AppComponent implements AfterViewInit { ]; quality: string = "best"; addInProgress = false; - + @ViewChild('queueMasterCheckbox') queueMasterCheckbox: MasterCheckboxComponent; @ViewChild('queueDelSelected') queueDelSelected: ElementRef; @ViewChild('doneMasterCheckbox') doneMasterCheckbox: MasterCheckboxComponent; @@ -32,6 +33,7 @@ export class AppComponent implements AfterViewInit { faTrashAlt = faTrashAlt; faCheckCircle = faCheckCircle; faTimesCircle = faTimesCircle; + faRedoAlt = faRedoAlt; constructor(public downloads: DownloadsService) { } @@ -68,9 +70,12 @@ export class AppComponent implements AfterViewInit { this.doneDelSelected.nativeElement.disabled = checked == 0; } - addDownload() { + addDownload(url?: string, quality?: string) { + url = url ?? this.addUrl + quality = quality ?? this.quality + this.addInProgress = true; - this.downloads.add(this.addUrl, this.quality).subscribe((status: Status) => { + this.downloads.add(url, quality).subscribe((status: Status) => { if (status.status === 'error') { alert(`Error adding URL: ${status.msg}`); } else { @@ -80,6 +85,11 @@ export class AppComponent implements AfterViewInit { }); } + retryDownload(key: string, quality:string){ + this.addDownload(key, quality); + this.downloads.delById('done', [key]).subscribe(); + } + delDownload(where: string, id: string) { this.downloads.delById(where, [id]).subscribe(); } |