enhance: display process logs

This commit is contained in:
Julian Krauser 2025-01-12 14:05:08 +01:00
parent a8e2b05d8e
commit 3da0f4cd49
5 changed files with 145 additions and 13 deletions

View file

@ -13,8 +13,8 @@ export const useNewsletterPrintoutStore = defineStore("newsletterPrintout", {
printing: undefined as undefined | "loading" | "success" | "failed",
sending: undefined as undefined | "loading" | "success" | "failed",
sendingPreview: undefined as undefined | "loading" | "success" | "failed",
pdfSourceMessages: [] as Array<Object>,
mailSourceMessages: [] as Array<Object>,
pdfSourceMessages: [] as Array<{ kind: string; factor: string; [key: string]: string }>,
mailSourceMessages: [] as Array<{ kind: string; factor: string; [key: string]: string }>,
pdfPrintingAbort: undefined as undefined | AbortController,
mailSendingAbort: undefined as undefined | AbortController,
};
@ -118,8 +118,12 @@ export const useNewsletterPrintoutStore = defineStore("newsletterPrintout", {
let data = JSON.parse(r);
this.pdfSourceMessages.push(data);
let type: NotificationType = "info";
if (data.factor == "failed") type = "error";
notificationStore.push(`Druck: ${data.iteration}/${data.total}`, `${data.msg}`, type);
let timeout = undefined;
if (data.factor == "failed") {
type = "error";
timeout = 0;
}
notificationStore.push(`Druck: ${data.iteration}/${data.total}`, `${data.msg}`, type, timeout);
}
});
this.fetchNewsletterPrintout();
@ -136,8 +140,12 @@ export const useNewsletterPrintoutStore = defineStore("newsletterPrintout", {
let data = JSON.parse(r);
this.mailSourceMessages.push(data);
let type: NotificationType = "info";
if (data.factor == "failed") type = "error";
notificationStore.push(`Mailversand: ${data.iteration}/${data.total}`, `${data.msg}`, type);
let timeout = undefined;
if (data.factor == "failed") {
type = "error";
timeout = 0;
}
notificationStore.push(`Mailversand: ${data.iteration}/${data.total}`, `${data.msg}`, type, timeout);
}
});
}

View file

@ -27,12 +27,14 @@ export const useNotificationStore = defineStore("notification", {
type,
indicator: false,
});
setTimeout(() => {
this.notifications[this.notifications.findIndex((n) => n.id === id)].indicator = true;
}, 100);
this.timeouts[id] = setTimeout(() => {
this.revoke(id);
}, timeout);
if (timeout != 0) {
setTimeout(() => {
this.notifications[this.notifications.findIndex((n) => n.id === id)].indicator = true;
}, 100);
this.timeouts[id] = setTimeout(() => {
this.revoke(id);
}, timeout);
}
},
revoke(id: string) {
this.notifications.splice(