fix: Meldungsseite benutzt noch falsche Funktion zur Darstellung der Meldungen.

This commit is contained in:
ISA
2025-04-22 07:30:49 +02:00
parent 8b15235040
commit df119e8e7a
6 changed files with 32 additions and 40 deletions

View File

@@ -31,22 +31,20 @@ const Last20MessagesTable: React.FC = () => {
// Hilfsfunktion zum Parsen der Nachrichten
const parseMessages = (messages: string | null) => {
if (typeof messages === "string") {
messages = messages
.replace(/<tr>/g, "\n")
.replace(/<\/?td>/g, "")
.replace(/<\/tr>/g, "")
.trim();
const rows = messages.split("\n");
return rows.map((row) => [
row.substring(0, 5),
row.substring(5, 10),
row.substring(10, 29),
row.substring(33, row.length - 1),
row.substring(row.length - 1),
]);
}
return [];
if (!messages) return [];
const rows = messages
.split("<tr>")
.slice(1) // erstes Element ist leer
.map((row) => {
const cols = row
.replace(/<\/tr>/, "")
.split("</td><td>")
.map((col) => col.replace(/<[^>]+>/g, ""));
return cols;
});
return rows;
};
const last20Messages = parseMessages(rawLast20Messages);