Skip to content

Commit

Permalink
add stalled state in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
isc30 committed Mar 29, 2024
1 parent 2ef0ddc commit 716d896
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
10 changes: 6 additions & 4 deletions client/src/app/torrent-status.pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { RealDebridStatus, Torrent } from './models/torrent.model';
name: 'status',
})
export class TorrentStatusPipe implements PipeTransform {
constructor(private pipe: FileSizePipe) {}
constructor(private pipe: FileSizePipe) { }

transform(torrent: Torrent): string {
if (torrent.error) {
Expand Down Expand Up @@ -38,9 +38,8 @@ export class TorrentStatusPipe implements PipeTransform {

speed = this.pipe.transform(allSpeeds, 'filesize');

return `Downloading file ${downloading.length + downloaded.length}/${
torrent.downloads.length
} (${progress.toFixed(2)}% - ${speed}/s)`;
return `Downloading file ${downloading.length + downloaded.length}/${torrent.downloads.length
} (${progress.toFixed(2)}% - ${speed}/s)`;
}

const unpacking = torrent.downloads.where((m) => m.unpackingStarted && !m.unpackingFinished && m.bytesDone > 0);
Expand Down Expand Up @@ -87,6 +86,9 @@ export class TorrentStatusPipe implements PipeTransform {

switch (torrent.rdStatus) {
case RealDebridStatus.Downloading:
if (torrent.rdSeeders < 1) {
return `Torrent stalled`
}
const speed = this.pipe.transform(torrent.rdSpeed, 'filesize');
return `Torrent downloading (${torrent.rdProgress}% - ${speed}/s)`;
case RealDebridStatus.Processing:
Expand Down
6 changes: 5 additions & 1 deletion client/src/app/torrent-table/torrent-table.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<th>Name</th>
<th>Category</th>
<th>Priority</th>
<th>Seeders</th>
<th>Files</th>
<th>Downloads</th>
<th>Size</th>
Expand All @@ -40,6 +41,9 @@
<td>
{{ torrent.priority }}
</td>
<td>
{{ torrent.rdSeeders }}
</td>
<td>
{{ torrent.files.length | number }}
</td>
Expand Down Expand Up @@ -74,7 +78,7 @@
>
Retry Selected
</button>

<button
class="button is-primary"
(click)="changeSettingsModal()"
Expand Down

0 comments on commit 716d896

Please sign in to comment.