2
0

Website show remaining time instead of percentage

This commit is contained in:
glax 2023-06-11 16:34:57 +02:00
parent 9fd8bf1741
commit 3b2643d949

View File

@ -368,7 +368,10 @@ function ShowTasksQueue(){
json.forEach(task => { json.forEach(task => {
downloadTasksOutput.appendChild(CreateProgressChild(task)); downloadTasksOutput.appendChild(CreateProgressChild(task));
document.querySelector(`#progress${task.taskId.replaceAll('=','')}`).value = task.progress; document.querySelector(`#progress${task.taskId.replaceAll('=','')}`).value = task.progress;
document.querySelector(`#progressStr${task.taskId.replaceAll('=','')}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2}); var finishedHours = task.executionApproximatelyRemaining.split(':')[0];
var finishedMinutes = task.executionApproximatelyRemaining.split(':')[1];
var finishedSeconds = task.executionApproximatelyRemaining.split(':')[2].split('.')[0];
document.querySelector(`#progressStr${task.taskId.replaceAll('=','')}`).innerText = `${finishedHours}:${finishedMinutes}:${finishedSeconds}`;
}); });
}); });
@ -399,7 +402,7 @@ function CreateProgressChild(task){
child.appendChild(progress); child.appendChild(progress);
var progressStr = document.createElement("span"); var progressStr = document.createElement("span");
progressStr.innerText = "00.00%"; progressStr.innerText = " \t∞";
progressStr.className = "progressStr"; progressStr.className = "progressStr";
progressStr.id = `progressStr${task.taskId.replaceAll('=','')}`; progressStr.id = `progressStr${task.taskId.replaceAll('=','')}`;
child.appendChild(progressStr); child.appendChild(progressStr);
@ -485,7 +488,10 @@ setInterval(() => {
GetRunningTasks().then((json) => { GetRunningTasks().then((json) => {
json.forEach(task => { json.forEach(task => {
document.querySelector(`#progress${task.taskId.replaceAll('=','')}`).value = task.progress; document.querySelector(`#progress${task.taskId.replaceAll('=','')}`).value = task.progress;
document.querySelector(`#progressStr${task.taskId.replaceAll('=','')}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2}); var finishedHours = task.executionApproximatelyRemaining.split(':')[0];
var finishedMinutes = task.executionApproximatelyRemaining.split(':')[1];
var finishedSeconds = task.executionApproximatelyRemaining.split(':')[2].split('.')[0];
document.querySelector(`#progressStr${task.taskId.replaceAll('=','')}`).innerText = `${finishedHours}:${finishedMinutes}:${finishedSeconds}`;
}); });
}); });
},500); },500);