mirror of
https://github.com/transmission/transmission
synced 2024-12-21 23:32:35 +00:00
Update torrent-row.js (#7245)
This commit is contained in:
parent
384b265033
commit
a1befba4d8
1 changed files with 13 additions and 8 deletions
|
@ -45,7 +45,8 @@ const TorrentRendererHelper = {
|
|||
getProgressInfo: (controller, t) => {
|
||||
const status = t.getStatus();
|
||||
const classList = ['torrent-progress-bar'];
|
||||
let percent = null;
|
||||
let percent = 100;
|
||||
let ratio = null;
|
||||
|
||||
if (status === Torrent._StatusStopped) {
|
||||
classList.push('paused');
|
||||
|
@ -62,11 +63,13 @@ const TorrentRendererHelper = {
|
|||
percent = t.getPercentDone() * 100;
|
||||
} else {
|
||||
classList.push('seed');
|
||||
const seed_ratio_limit = t.seedRatioLimit(controller);
|
||||
percent =
|
||||
seed_ratio_limit > 0
|
||||
? (t.getUploadRatio() * 100) / seed_ratio_limit
|
||||
: 100;
|
||||
if (status !== Torrent._StatusStopped) {
|
||||
const seed_ratio_limit = t.seedRatioLimit(controller);
|
||||
ratio =
|
||||
seed_ratio_limit > 0
|
||||
? (t.getUploadRatio() * 100) / seed_ratio_limit
|
||||
: 100;
|
||||
}
|
||||
}
|
||||
if (t.isQueued()) {
|
||||
classList.push('queued');
|
||||
|
@ -75,15 +78,17 @@ const TorrentRendererHelper = {
|
|||
return {
|
||||
classList,
|
||||
percent,
|
||||
ratio,
|
||||
};
|
||||
},
|
||||
|
||||
renderProgressbar: (controller, t, progressbar) => {
|
||||
const info = TorrentRendererHelper.getProgressInfo(controller, t);
|
||||
const pct_str = `${Formatter.percentString(info.percent, 2)}%`;
|
||||
const percent = Math.min(info.ratio || info.percent, 100);
|
||||
const pct_str = `${Formatter.percentString(percent, 2)}%`;
|
||||
progressbar.className = info.classList.join(' ');
|
||||
progressbar.style.setProperty('--progress', pct_str);
|
||||
progressbar.dataset.progress = pct_str;
|
||||
progressbar.dataset.progress = info.ratio ? '100%' : pct_str;
|
||||
},
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in a new issue