Merge pull request #564 from patriceac/Fix-UI-display-when-removing-the-last-task

Fix UI display when removing the last task
This commit is contained in:
cmdr2 2022-11-30 16:14:59 +05:30 committed by GitHub
commit 321e5f1ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -901,7 +901,7 @@ function createTask(task) {
taskQueue.splice(idx, 1)
}
taskEntry.remove()
removeTask(taskEntry)
}
})})
@ -1045,16 +1045,20 @@ async function stopAllTasks() {
}
}
function removeTask(taskToRemove) {
taskToRemove.remove()
if (document.querySelector('.imageTaskContainer') === null) {
previewTools.style.display = 'none'
initialText.style.display = 'block'
}
}
clearAllPreviewsBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Are you sure? Remove all results and tasks from the results pane?", async function() {
await stopAllTasks()
let taskEntries = document.querySelectorAll('.imageTaskContainer')
taskEntries.forEach(task => {
task.remove()
})
previewTools.style.display = 'none'
initialText.style.display = 'block'
taskEntries.forEach(removeTask)
})})
stopImageBtn.addEventListener('click', (e) => { shiftOrConfirm(e, "Are you sure? Do you want to stop all the tasks?", async function(e) {