mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-26 17:47:20 +00:00
Fix task progress notification
This commit is contained in:
parent
1c8f2bf61d
commit
d2bd0c7c7e
1 changed files with 6 additions and 2 deletions
|
@ -10,10 +10,12 @@ import { notification } from "./notification";
|
||||||
class TaskDispatcher {
|
class TaskDispatcher {
|
||||||
private running: boolean;
|
private running: boolean;
|
||||||
private tasks: Record<string, Task.Callable[]> = {};
|
private tasks: Record<string, Task.Callable[]> = {};
|
||||||
|
private progress: Record<string, Site.Progress> = {};
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.running = false;
|
this.running = false;
|
||||||
this.tasks = {};
|
this.tasks = {};
|
||||||
|
this.progress = {};
|
||||||
|
|
||||||
window.addEventListener("beforeunload", this.onBeforeUnload.bind(this));
|
window.addEventListener("beforeunload", this.onBeforeUnload.bind(this));
|
||||||
}
|
}
|
||||||
|
@ -108,9 +110,10 @@ class TaskDispatcher {
|
||||||
// TODO: FIX ME!
|
// TODO: FIX ME!
|
||||||
item.value += 1;
|
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));
|
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(
|
updateNotification(
|
||||||
notification.progress.update(
|
notification.progress.update(
|
||||||
item.id,
|
item.id,
|
||||||
|
@ -122,6 +125,7 @@ class TaskDispatcher {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
showNotification(notification.progress.pending(item.id, item.header));
|
showNotification(notification.progress.pending(item.id, item.header));
|
||||||
|
this.progress[item.id] = item;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue