diff --git a/src/components/admin/club/newsletter/NewsletterMailProgressModal.vue b/src/components/admin/club/newsletter/NewsletterMailProgressModal.vue new file mode 100644 index 0000000..2083eeb --- /dev/null +++ b/src/components/admin/club/newsletter/NewsletterMailProgressModal.vue @@ -0,0 +1,44 @@ + + + + Newsletter Mail-Versand Logs + + + + + + {{ entry }} + + + + + + + abbrechen + + + + + + + + + diff --git a/src/components/admin/club/newsletter/NewsletterPrintingProgressModal.vue b/src/components/admin/club/newsletter/NewsletterPrintingProgressModal.vue new file mode 100644 index 0000000..416c1e1 --- /dev/null +++ b/src/components/admin/club/newsletter/NewsletterPrintingProgressModal.vue @@ -0,0 +1,50 @@ + + + + Newsletter Druck-Prozess Logs + + + + + + + + + {{ entry.iteration }}/{{ entry.total }}: {{ entry.msg }} + + + + + + abbrechen + + + + + + + + diff --git a/src/stores/admin/club/newsletter/newsletterPrintout.ts b/src/stores/admin/club/newsletter/newsletterPrintout.ts index e4a500c..945ac24 100644 --- a/src/stores/admin/club/newsletter/newsletterPrintout.ts +++ b/src/stores/admin/club/newsletter/newsletterPrintout.ts @@ -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, - mailSourceMessages: [] as Array, + 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); } }); } diff --git a/src/stores/notification.ts b/src/stores/notification.ts index 49297aa..872b108 100644 --- a/src/stores/notification.ts +++ b/src/stores/notification.ts @@ -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( diff --git a/src/views/admin/club/newsletter/NewsletterPrintout.vue b/src/views/admin/club/newsletter/NewsletterPrintout.vue index dfa2ccf..0580400 100644 --- a/src/views/admin/club/newsletter/NewsletterPrintout.vue +++ b/src/views/admin/club/newsletter/NewsletterPrintout.vue @@ -61,6 +61,12 @@ + + Druck Logs + + + Versand Logs + @@ -84,7 +90,15 @@ export default defineComponent({ newsletterId: String, }, computed: { - ...mapState(useNewsletterPrintoutStore, ["printout", "loading", "printing", "sending", "sendingPreview"]), + ...mapState(useNewsletterPrintoutStore, [ + "printout", + "loading", + "printing", + "sending", + "sendingPreview", + "mailSourceMessages", + "pdfSourceMessages", + ]), ...mapState(useAbilityStore, ["can"]), }, mounted() { @@ -118,6 +132,20 @@ export default defineComponent({ }) .catch(() => {}); }, + openPdfLogs() { + this.openModal( + markRaw( + defineAsyncComponent(() => import("@/components/admin/club/newsletter/NewsletterPrintingProgressModal.vue")) + ) + ); + }, + openMailLogs() { + this.openModal( + markRaw( + defineAsyncComponent(() => import("@/components/admin/club/newsletter/NewsletterMailProgressModal.vue")) + ) + ); + }, }, });
Newsletter Mail-Versand Logs
+ {{ entry }} +
Newsletter Druck-Prozess Logs
{{ entry.iteration }}/{{ entry.total }}: {{ entry.msg }}