diff --git a/nextcloud_backup/backend/src/tools/messageManager.ts b/nextcloud_backup/backend/src/tools/messageManager.ts
index 5b3d6af..b0915ad 100644
--- a/nextcloud_backup/backend/src/tools/messageManager.ts
+++ b/nextcloud_backup/backend/src/tools/messageManager.ts
@@ -1,3 +1,4 @@
+import { randomUUID } from "crypto";
import { DateTime } from "luxon";
import { Message, MessageType } from "../types/message.js";
@@ -8,6 +9,7 @@ class MessageManager {
public addMessage(type: MessageType, message: string, detail?: string, isImportant = false) {
this.messages.push({
+ id: randomUUID(),
message: message,
type: type,
time: DateTime.now(),
diff --git a/nextcloud_backup/backend/src/types/message.ts b/nextcloud_backup/backend/src/types/message.ts
index 859636e..cff0e96 100644
--- a/nextcloud_backup/backend/src/types/message.ts
+++ b/nextcloud_backup/backend/src/types/message.ts
@@ -9,6 +9,7 @@ export enum MessageType {
export interface Message {
+ id: string;
time: DateTime;
type: MessageType;
message: string;
diff --git a/nextcloud_backup/frontend/src/components/MessageBar.vue b/nextcloud_backup/frontend/src/components/MessageBar.vue
index 3a40f78..519e73f 100644
--- a/nextcloud_backup/frontend/src/components/MessageBar.vue
+++ b/nextcloud_backup/frontend/src/components/MessageBar.vue
@@ -9,7 +9,7 @@
-
+
@@ -69,13 +69,17 @@
import { getMessages } from "@/services/messageService";
import { MessageType, type Message } from "@/types/messages";
import { DateTime } from "luxon";
-import { ref } from "vue";
+import { onBeforeUnmount, ref } from "vue";
const messages = ref([]);
-getMessages().then((values) => {
- messages.value = values;
-});
+const interval = setInterval(refreshMessages, 1000);
+
+function refreshMessages() {
+ getMessages().then((values) => {
+ messages.value = values;
+ });
+}
function getMessageColor(messageType: MessageType) {
switch (messageType) {
@@ -132,6 +136,10 @@ function getTimeDelta(time: string) {
} as any);
}
}
-
const show = ref([]);
+refreshMessages();
+
+onBeforeUnmount(() => {
+ clearInterval(interval);
+});
diff --git a/nextcloud_backup/frontend/src/types/messages.ts b/nextcloud_backup/frontend/src/types/messages.ts
index 192a5a0..ad67d52 100644
--- a/nextcloud_backup/frontend/src/types/messages.ts
+++ b/nextcloud_backup/frontend/src/types/messages.ts
@@ -8,6 +8,7 @@ export enum MessageType {
}
export interface Message {
+ id: string;
time: string;
type: MessageType;
message: string;