WebUI: Display torrent progress percentage in General tab

This PR adds torrent progress percentage next to pieces bar in General tab, as in the GUI.

PR #21756.
This commit is contained in:
skomerko
2024-11-09 09:03:20 +01:00
committed by GitHub
parent 06fe3e5fb0
commit 71f83cf9ba
4 changed files with 27 additions and 9 deletions

View File

@@ -43,6 +43,7 @@ window.qBittorrent.PropGeneral ??= (() => {
$("progress").appendChild(piecesBar);
const clearData = () => {
document.getElementById("progressPercentage").textContent = "";
$("time_elapsed").textContent = "";
$("eta").textContent = "";
$("nb_connections").textContent = "";
@@ -101,6 +102,8 @@ window.qBittorrent.PropGeneral ??= (() => {
if (data) {
// Update Torrent data
document.getElementById("progressPercentage").textContent = window.qBittorrent.Misc.friendlyPercentage(data.progress);
const timeElapsed = (data.seeding_time > 0)
? "QBT_TR(%1 (seeded for %2))QBT_TR[CONTEXT=PropertiesWidget]"
.replace("%1", window.qBittorrent.Misc.friendlyDuration(data.time_elapsed))