From aaf4b7c6731c35252a7d89cf8cac64eb54d0b064 Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Sat, 19 Mar 2022 12:03:50 +0800 Subject: [PATCH] Fix display issues in the notification center --- frontend/src/modules/task/utilities.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/frontend/src/modules/task/utilities.ts b/frontend/src/modules/task/utilities.ts index 8acb95a74..d1deae3a0 100644 --- a/frontend/src/modules/task/utilities.ts +++ b/frontend/src/modules/task/utilities.ts @@ -1,5 +1,7 @@ import { LOG } from "@/utilities/console"; import taskManager from "."; +import { siteAddProgress, siteRemoveProgress } from "../redux/actions"; +import store from "../redux/store"; import { GroupName } from "./group"; export function createTask( @@ -19,10 +21,27 @@ export function createTask( export function dispatchTask(tasks: Task.TaskRef[], group: GroupName) { setTimeout(async () => { - for (const ref of tasks) { + for (let index = 0; index < tasks.length; index++) { + const ref = tasks[index]; LOG("info", "dispatching task", ref.name); + + store.dispatch( + siteAddProgress([ + { + id: group, + header: group, + name: ref.name, + value: index, + count: tasks.length, + }, + ]) + ); + await taskManager.run(ref); } + + // TODO: Also remove from taskManager + store.dispatch(siteRemoveProgress([group])); }); }