diff --git a/client/src/app/torrent-table/torrent-table.component.html b/client/src/app/torrent-table/torrent-table.component.html index fc8796b..65459b9 100644 --- a/client/src/app/torrent-table/torrent-table.component.html +++ b/client/src/app/torrent-table/torrent-table.component.html @@ -56,14 +56,25 @@ - +
+ + + +
+ + diff --git a/client/src/app/torrent-table/torrent-table.component.ts b/client/src/app/torrent-table/torrent-table.component.ts index ded74c4..3ca6eba 100644 --- a/client/src/app/torrent-table/torrent-table.component.ts +++ b/client/src/app/torrent-table/torrent-table.component.ts @@ -21,6 +21,10 @@ export class TorrentTableComponent implements OnInit { public deleteRdTorrent: boolean; public deleteLocalFiles: boolean; + public isRetryModalActive: boolean; + public retryError: string; + public retrying: boolean; + constructor(private router: Router, private torrentService: TorrentService) {} ngOnInit(): void { @@ -101,4 +105,37 @@ export class TorrentTableComponent implements OnInit { }, }); } + + public showRetryModal(): void { + this.retryError = null; + + this.isRetryModalActive = true; + } + + public retryCancel(): void { + this.isRetryModalActive = false; + } + + public retryOk(): void { + this.retrying = true; + + let calls: Observable[] = []; + + this.selectedTorrents.forEach((torrentId) => { + calls.push(this.torrentService.retry(torrentId)); + }); + + forkJoin(calls).subscribe({ + complete: () => { + this.isRetryModalActive = false; + this.retrying = false; + + this.selectedTorrents = []; + }, + error: (err) => { + this.retryError = err.error; + this.retrying = false; + }, + }); + } }