Compare commits

..

4 Commits

Author SHA1 Message Date
135aca08ab
Merge pull request #22 from db-2001/fix-update-button
Preliminary fix for update button deleting all mangas
2023-10-30 19:21:57 +01:00
b47ba90f20
Merge branch 'master' into fix-update-button 2023-10-30 19:21:22 +01:00
db-2001
6245210faf Added GetMonitorJobs back to UpdateJobs 2023-10-30 14:09:41 -04:00
db-2001
c3a15a354b Preliminary fix for update button deleting all mangas 2023-10-30 13:29:39 -04:00

View File

@ -113,6 +113,19 @@ function ResetContent(){
add.appendChild(plus); add.appendChild(plus);
add.addEventListener("click", () => ShowNewMangaSearch()); add.addEventListener("click", () => ShowNewMangaSearch());
tasksContent.appendChild(add); tasksContent.appendChild(add);
//Populate with the monitored mangas
GetMonitorJobs().then((json) => {
//console.log(json);
json.forEach(job => {
var mangaView = CreateManga(job.manga, job.mangaConnector.name);
mangaView.addEventListener("click", (event) => {
ShowMangaWindow(job, job.manga, event, false);
});
tasksContent.appendChild(mangaView);
});
monitoringJobsCount = json.length;
});
} }
function ShowNewMangaSearch(){ function ShowNewMangaSearch(){
@ -172,6 +185,7 @@ createMonitorJobButton.addEventListener("click", () => {
CreateMonitorJob(newMangaConnector.value, selectedManga.internalId, newMangaTranslatedLanguage.value); CreateMonitorJob(newMangaConnector.value, selectedManga.internalId, newMangaTranslatedLanguage.value);
UpdateJobs(); UpdateJobs();
mangaViewerPopup.style.display = "none"; mangaViewerPopup.style.display = "none";
ResetContent();
}); });
startJobButton.addEventListener("click", () => { startJobButton.addEventListener("click", () => {
StartJob(selectedJob.id); StartJob(selectedJob.id);
@ -185,6 +199,7 @@ deleteJobButton.addEventListener("click", () => {
RemoveJob(selectedJob.id); RemoveJob(selectedJob.id);
UpdateJobs(); UpdateJobs();
mangaViewerPopup.style.display = "none"; mangaViewerPopup.style.display = "none";
ResetContent();
}); });
function ShowMangaWindow(job, manga, event, add){ function ShowMangaWindow(job, manga, event, add){
@ -409,6 +424,7 @@ function utf8_to_b64(str) {
} }
function UpdateJobs(){ function UpdateJobs(){
GetMonitorJobs().then((json) => { GetMonitorJobs().then((json) => {
if(monitoringJobsCount != json.length){ if(monitoringJobsCount != json.length){
ResetContent(); ResetContent();
@ -423,6 +439,8 @@ function UpdateJobs(){
monitoringJobsCount = json.length; monitoringJobsCount = json.length;
} }
}); });
//Get the jobs that are waiting in the queue
GetWaitingJobs().then((json) => { GetWaitingJobs().then((json) => {
jobsQueuedTag.innerText = json.length; jobsQueuedTag.innerText = json.length;
@ -443,6 +461,7 @@ function UpdateJobs(){
jobStatusWaiting.removeChild(child); jobStatusWaiting.removeChild(child);
}); });
//Get currently running jobs
GetRunningJobs().then((json) => { GetRunningJobs().then((json) => {
jobsRunningTag.innerText = json.length; jobsRunningTag.innerText = json.length;