Compare commits

..

No commits in common. "2aec8840090d8c8f3168503ddc6031f7e4042ba3" and "16c1094875a0827223a26ac540f32fb38dcd4903" have entirely different histories.

View File

@ -40,7 +40,6 @@ const settingApiUri = document.querySelector("#settingApiUri");
const tagTasksRunning = document.querySelector("#tasksRunningTag"); const tagTasksRunning = document.querySelector("#tasksRunningTag");
const tagTasksQueued = document.querySelector("#tasksQueuedTag"); const tagTasksQueued = document.querySelector("#tasksQueuedTag");
const downloadTasksPopup = document.querySelector("#downloadTasksPopup"); const downloadTasksPopup = document.querySelector("#downloadTasksPopup");
const downloadTasksOutput = downloadTasksPopup.querySelector("popup-content");
searchbox.addEventListener("keyup", (event) => FilterResults()); searchbox.addEventListener("keyup", (event) => FilterResults());
settingsCog.addEventListener("click", () => OpenSettings()); settingsCog.addEventListener("click", () => OpenSettings());
@ -360,14 +359,24 @@ function FilterResults(){
} }
function ShowTasksQueue(){ function ShowTasksQueue(){
downloadTasksPopup.style.display = "flex";
downloadTasksOutput.replaceChildren(); var outputDom = downloadTasksPopup.querySelector("popup-content");
GetRunningTasks() outputDom.replaceChildren();
.then(json => { GetRunningTasks().then((taskJson) => {
tagTasksRunning.innerText = json.length; console.log(taskJson);
json.forEach(task => { taskJson.forEach(task => {
downloadTasksOutput.appendChild(CreateProgressChild(task)); outputDom.appendChild(CreateProgressChild(task));
}); });
});
GetQueue().then((taskJson) => {
taskJson.forEach(task => {
outputDom.appendChild(CreateProgressChild(task));
});
});
setInterval(() => {
GetRunningTasks().then((json) => {
json.forEach(task => {
if(task.chapter != undefined){ if(task.chapter != undefined){
document.querySelector(`#progress${task.publication.internalId}-${task.chapter.sortNumber}`).value = task.progress; document.querySelector(`#progress${task.publication.internalId}-${task.chapter.sortNumber}`).value = task.progress;
document.querySelector(`#progressStr${task.publication.internalId}-${task.chapter.sortNumber}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2}); document.querySelector(`#progressStr${task.publication.internalId}-${task.chapter.sortNumber}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2});
@ -376,15 +385,8 @@ function ShowTasksQueue(){
document.querySelector(`#progressStr${task.publication.internalId}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2}); document.querySelector(`#progressStr${task.publication.internalId}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2});
} }
}); });
GetQueue()
.then(json => {
tagTasksQueued.innerText = json.length;
json.forEach(task => {
downloadTasksOutput.appendChild(CreateProgressChild(task));
}); });
}); },500);
downloadTasksPopup.style.display = "flex";
} }
function CreateProgressChild(task){ function CreateProgressChild(task){
@ -432,7 +434,6 @@ function CreateProgressChild(task){
//Resets the tasks shown //Resets the tasks shown
ResetContent(); ResetContent();
downloadTasksOutput.replaceChildren();
//Get Tasks and show them //Get Tasks and show them
GetDownloadTasks() GetDownloadTasks()
.then(json => json.forEach(task => { .then(json => json.forEach(task => {
@ -445,17 +446,11 @@ GetDownloadTasks()
GetRunningTasks() GetRunningTasks()
.then(json => { .then(json => {
tagTasksRunning.innerText = json.length; tagTasksRunning.innerText = json.length;
json.forEach(task => {
downloadTasksOutput.appendChild(CreateProgressChild(task));
});
}); });
GetQueue() GetQueue()
.then(json => { .then(json => {
tagTasksQueued.innerText = json.length; tagTasksQueued.innerText = json.length;
json.forEach(task => {
downloadTasksOutput.appendChild(CreateProgressChild(task));
});
}) })
setInterval(() => { setInterval(() => {
@ -488,19 +483,6 @@ setInterval(() => {
GetQueue() GetQueue()
.then(json => { .then(json => {
tagTasksQueued.innerText = json.length; tagTasksQueued.innerText = json.length;
}); })
}, 1000);
setInterval(() => { }, 1000);
GetRunningTasks().then((json) => {
json.forEach(task => {
if(task.chapter != undefined){
document.querySelector(`#progress${task.publication.internalId}-${task.chapter.sortNumber}`).value = task.progress;
document.querySelector(`#progressStr${task.publication.internalId}-${task.chapter.sortNumber}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2});
}else{
document.querySelector(`#progress${task.publication.internalId}`).value = task.progress;
document.querySelector(`#progressStr${task.publication.internalId}`).innerText = task.progress.toLocaleString(undefined,{style: 'percent', minimumFractionDigits:2});
}
});
});
},500);