diff options
Diffstat (limited to 'ui/src/app')
-rw-r--r-- | ui/src/app/app.component.html | 14 | ||||
-rw-r--r-- | ui/src/app/app.component.ts | 16 | ||||
-rw-r--r-- | ui/src/app/downloads.service.ts | 1 |
3 files changed, 24 insertions, 7 deletions
diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html index e1f29d6..2ec41dd 100644 --- a/ui/src/app/app.component.html +++ b/ui/src/app/app.component.html @@ -39,7 +39,7 @@ <tr> <th scope="col" style="width: 1rem;"> <app-master-checkbox #queueMasterCheckbox [id]="'queue'" [list]="downloads.queue" (changed)="queueSelectionChanged($event)"></app-master-checkbox> - </th> + </th> <th scope="col"> <button type="button" class="btn btn-link px-0 mr-4" disabled #queueDelSelected (click)="delSelectedDownloads('queue')"><fa-icon [icon]="faTrashAlt"></fa-icon> Cancel selected</button> </th> @@ -69,13 +69,14 @@ <tr> <th scope="col" style="width: 1rem;"> <app-master-checkbox #doneMasterCheckbox [id]="'done'" [list]="downloads.done" (changed)="doneSelectionChanged($event)"></app-master-checkbox> - </th> + </th> <th scope="col"> <button type="button" class="btn btn-link px-0 mr-4" disabled #doneDelSelected (click)="delSelectedDownloads('done')"><fa-icon [icon]="faTrashAlt"></fa-icon> Clear selected</button> <button type="button" class="btn btn-link px-0 mr-4" disabled #doneClearCompleted (click)="clearCompletedDownloads()"><fa-icon [icon]="faCheckCircle"></fa-icon> Clear completed</button> <button type="button" class="btn btn-link px-0 mr-4" disabled #doneClearFailed (click)="clearFailedDownloads()"><fa-icon [icon]="faTimesCircle"></fa-icon> Clear failed</button> </th> <th scope="col" style="width: 2rem;"></th> + <th scope="col" style="width: 2rem;"></th> </tr> </thead> <tbody> @@ -90,9 +91,14 @@ </div> <span ngbTooltip="{{download.value.msg}}">{{ download.value.title }}</span> </td> - <td><button type="button" class="btn btn-link" (click)="delDownload('done', download.key)"><fa-icon [icon]="faTrashAlt"></fa-icon></button></td> + <td> + <button *ngIf="download.value.status == 'error'" type="button" class="btn btn-link" (click)="retryDownload(download.key, download.value.quality)"><fa-icon [icon]="faRedoAlt"></fa-icon></button> + </td> + <td> + <button type="button" class="btn btn-link" (click)="delDownload('done', download.key)"><fa-icon [icon]="faTrashAlt"></fa-icon></button> + </td> </tr> </tbody> </table> - + </main><!-- /.container --> 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(); } diff --git a/ui/src/app/downloads.service.ts b/ui/src/app/downloads.service.ts index 4da30fe..5fd3b5a 100644 --- a/ui/src/app/downloads.service.ts +++ b/ui/src/app/downloads.service.ts @@ -15,6 +15,7 @@ interface Download { url: string, status: string; msg: string; + quality: string; percent: number; speed: number; eta: number; |