Only refresh items when tasks are added/removed #1

This commit is contained in:
glax 2023-05-23 18:17:39 +02:00
parent f0256494fd
commit 6d0fcc13fb

View File

@ -185,21 +185,25 @@ GetTasks()
var publication = CreatePublication(task.publication, task.connectorName); var publication = CreatePublication(task.publication, task.connectorName);
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event)); publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
tasksContent.appendChild(publication); tasksContent.appendChild(publication);
tasks.push(task);
if(tasks.filter(tTask => tTask.publication.internalId === task.publication.internalId) < 1)
tasks.push(task);
})); }));
setInterval(() => { setInterval(() => {
ResetContent(); var cTasks = [];
GetTasks() GetTasks()
//.then(json => console.log(json)) //.then(json => console.log(json))
.then(json => json.forEach(task => { .then(json => json.forEach(task => cTasks.push(task)))
var publication = CreatePublication(task.publication, task.connectorName); .then(() => {
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event)); if(tasks.length != cTasks.length) {
tasksContent.appendChild(publication); ResetContent();
var publication = CreatePublication(task.publication, task.connectorName);
publication.addEventListener("click", (event) => ShowPublicationViewerWindow(task.publication.internalId, event));
tasksContent.appendChild(publication);
if(tasks.filter(tTask => tTask.publication.internalId === task.publication.internalId) < 1) tasks = cTasks;
tasks.push(task); }
})); }
);
}, 1000); }, 1000);