summaryrefslogtreecommitdiffhomepage
path: root/frontend/src/modules/task/index.ts
diff options
context:
space:
mode:
authorMarian Moravcik <[email protected]>2023-01-12 12:18:25 +0100
committerMarian Moravcik <[email protected]>2023-01-12 12:18:25 +0100
commitd2bd0c7c7e559bf9742ed2ebb4944e3913970caa (patch)
tree972120e0b8a215209eaaaae4416e78b9a1c6131f /frontend/src/modules/task/index.ts
parent1c8f2bf61d71da16a80d1b66d93008d6c32d0fbf (diff)
downloadbazarr-d2bd0c7c7e559bf9742ed2ebb4944e3913970caa.tar.gz
bazarr-d2bd0c7c7e559bf9742ed2ebb4944e3913970caa.zip
Fix task progress notificationv1.1.5-beta.2
Diffstat (limited to 'frontend/src/modules/task/index.ts')
-rw-r--r--frontend/src/modules/task/index.ts8
1 files changed, 6 insertions, 2 deletions
diff --git a/frontend/src/modules/task/index.ts b/frontend/src/modules/task/index.ts
index a1439148c..7e2687c57 100644
--- a/frontend/src/modules/task/index.ts
+++ b/frontend/src/modules/task/index.ts
@@ -10,10 +10,12 @@ import { notification } from "./notification";
class TaskDispatcher {
private running: boolean;
private tasks: Record<string, Task.Callable[]> = {};
+ private progress: Record<string, Site.Progress> = {};
constructor() {
this.running = false;
this.tasks = {};
+ this.progress = {};
window.addEventListener("beforeunload", this.onBeforeUnload.bind(this));
}
@@ -108,9 +110,10 @@ class TaskDispatcher {
// TODO: FIX ME!
item.value += 1;
- if (item.value >= item.count) {
+ if (item.value >= item.count && this.progress[item.id] !== undefined) {
updateNotification(notification.progress.end(item.id, item.header));
- } else if (item.value > 1) {
+ delete this.progress[item.id];
+ } else if (item.value > 1 && this.progress[item.id] !== undefined) {
updateNotification(
notification.progress.update(
item.id,
@@ -122,6 +125,7 @@ class TaskDispatcher {
);
} else {
showNotification(notification.progress.pending(item.id, item.header));
+ this.progress[item.id] = item;
}
});
}