feat: Filter für Quelle

This commit is contained in:
Ismail Ali
2025-06-25 22:49:02 +02:00
parent dcddbe989a
commit 2d8c51525d
16 changed files with 492 additions and 23 deletions

View File

@@ -6,6 +6,6 @@ NEXT_PUBLIC_USE_MOCK_BACKEND_LOOP_START=false
NEXT_PUBLIC_EXPORT_STATIC=false
NEXT_PUBLIC_USE_CGI=false
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.448
NEXT_PUBLIC_APP_VERSION=1.6.449
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)

View File

@@ -5,5 +5,5 @@ NEXT_PUBLIC_CPL_API_PATH=/CPL
NEXT_PUBLIC_EXPORT_STATIC=true
NEXT_PUBLIC_USE_CGI=true
# App-Versionsnummer
NEXT_PUBLIC_APP_VERSION=1.6.448
NEXT_PUBLIC_APP_VERSION=1.6.449
NEXT_PUBLIC_CPL_MODE=production

View File

@@ -1,3 +1,8 @@
## [1.6.449] 2025-06-25
- refactor: alle Feature-Flags entfernt wegen Aufwand und Zeit
---
## [1.6.448] 2025-06-25
- Add: SERVICE JSON Files

View File

@@ -84,9 +84,9 @@ export default function AnalogInputsChart({
const chartData = {
datasets: [
{
label: `Messkurve ${selectedInput?.label ?? "Eingang"} (${
label: `Messkurve ${selectedInput?.label ?? "Eingang"} [${
selectedInput?.unit ?? ""
})`,
}]`,
data: inputData.map((point: any) => ({
x: point.t,
y: point.m,
@@ -147,7 +147,7 @@ export default function AnalogInputsChart({
y: {
title: {
display: true,
text: `Messwert (${selectedInput?.unit ?? ""})`,
text: `Messwert [${selectedInput?.unit ?? ""}]`,
},
},
},

View File

@@ -2,13 +2,13 @@
## 🔄 Zusatzfunktionen (prio niedrig) Kai, 25. Juni 2025
- [ ] TODO:Messwertanzeige eines Eingangs: Zeitraum einstellbar, Bezeichnung und Einheit in die Messkurve, Datum in die Messkurve
- [ ] TODO:Messwertanzeige eines Eingangs: Zeitraum einstellbar, Bezeichnung und Einheit in die Messkurve, Datum in die Messkurve von DIA0 als Parameter
- Einheit in eckigen Klammern und Chart Daten mit Parameter DIA0 usw.
- [ ] FIXME: Kabelüberwachung vertikal angezeigt
- [ ] TODO: Startseite Meldungen: Spalte Quelle wie bei Berichte (nicht "Modul")
- [ ] TODO: Startseite Spaltenreihenfolge: Pop (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status
- [ ] TODO: Berichte Spaltenreihenfolge: Pop (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status
- [ ] TODO: Filter für Quelle
- [x] FIXME: Kabelüberwachung vertikal angezeigt
- [ ] TODO: Startseite Meldungen: Spalte Quelle wie bei Berichte (nicht "Modul") , kommen die von JSON nur 20 darstellen?
- [ ] TODO: Startseite Spaltenreihenfolge: Prio (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status
- [x] TODO: Berichte Spaltenreihenfolge: Prio (farbiger Punkt), Zeitstempel, Quelle, Meldung, Status
- [x] TODO: Filter für Quelle
- [ ] TODO: System: Button bei jedem Messwert für Detailansicht (inkl. Kurve im Popup und Zeitauswahl)
- [ ] TODO: Einstellungen Benutzerverwaltung: Admin kann Adminpasswort ändern
- [ ] TODO: Einstellungen OPC: Anzahl der aktuellen Clients (ggf. KAS-Variable einbauen)

View File

@@ -0,0 +1,17 @@
{
"win_appVersion": "0.02",
"win_deviceName": "CPLV4 Ismail Rastede",
"win_mac1": "0 48 86 81 46 143",
"win_ip": "10.10.0.243",
"win_subnet": "255.255.255.0",
"win_gateway": "10.10.0.1",
"win_cplInternalTimestamp": "23.10.24 15:10:28 Uhr",
"win_opcState": "1",
"win_opcSessions": "0",
"win_opcName": "CPL V4 OPC UA Application Deutsche Bahne",
"win_ntp1": "192.53.103.108",
"win_ntp2": "0.0.0.0",
"win_ntp3": "0.0.0.0",
"win_ntpTimezone": "2",
"win_ntpActive": "1"
}

View File

@@ -0,0 +1,64 @@
{
"win_de_state": [
1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_invert": [
0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_counter": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_time_filter": [
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_weighting": [
3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_counter_active": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_offline": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_de_label": [
"DE1",
"DE2",
"DE3",
"DE4",
"DE5",
"DE6",
"DE7",
"DE8",
"DE9",
"DE10",
"DE11",
"DE12",
"DE13",
"DE14",
"DE15",
"DE16",
"DE17",
"DE18",
"DE19",
"DE20",
"DE21",
"DE22",
"DE23",
"DE24",
"DE25",
"DE26",
"DE27",
"DE28",
"DE29",
"DE30",
"DE31",
"DE32"
]
}

View File

@@ -0,0 +1,4 @@
{
"win_da_state": [1, 1, 1, 1],
"win_da_bezeichnung": ["Ausgang2", "Ausgang2", "Ausgang3", "Ausgang4"]
}

View File

@@ -0,0 +1,203 @@
{
"win_kueOnline": [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1
],
"win_kuePSTmMinus96V": [
0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_kueCableBreak": [
1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1, 1, 1, 1
],
"win_kueGroundFault": [
1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_kueAlarm1": [
1, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1, 0,
1, 0, 0, 0, 0, 0, 0
],
"win_kueAlarm2": [
1, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_kueOverflow": [
1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_kueIso": [
10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.5, 10.0, 10.0, 10.0,
10.0, 10.0, 10.5, 10.0, 200.0, 200.0, 200.0, 200.0
],
"win_kueLimit1": [
3, 9.9, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0,
10.0, 10.0, 10.0, 10.0, 10.0, 10.0, 10.0
],
"win_kueDelay1": [
3, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420, 420,
420, 420
],
"win_kueResidence": [
0.0, 0.612, 0.0, 0.645, 0.822, 0.97, 0.0, 0.0, 1.452, 0.0, 0.734, 0.37,
0.566, 0.0, 0.738, 0.684, 1.166, 0.595, 0.0, 1.651, 1.18, 1.387, 1.214, 0.0,
1.475, 0.615, 0.494, 1.217, 65.0, 65.0, 65.0, 65.0
],
"win_kueLimit2Low": [
3, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1, 0.1,
0.1, 0.1
],
"win_kueLimit2High": [
3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1
],
"win_kueLoopInterval": [
3, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6,
6, 6, 6, 6, 6, 6, 6
],
"win_kueVersion": [
420, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419, 419,
419, 419
],
"win_kueID": [
"Test3",
"B23",
"Kabel 3",
"Kabel 4",
"Kabel 5",
"Kabel 6",
"FTZ4562",
"Kabel 8",
"12344",
"Kabel 10",
"Kabel 11",
"Kabel 12",
"Kabel 13",
"Kabel 14",
"Kabel 15",
"H56-77",
"Kabel 17",
"Kabel 18",
"Kabel 19",
"Kabel 20",
"Kabel 21",
"Kabel 22",
"Kabel 23",
"Kabel 24",
"Kabel 25",
"Kabel 26",
"Kabel 27",
"Kabel 28",
"Kabel 29",
"Kabel 30",
"Kabel 31",
"Kabel 32"
],
"win_kueName": [
"Kabel 1",
"Kabel 2",
"Kabel 3",
"Kabel 4",
"Kabel 5",
"Kabel 6",
"Kabel 7",
"Kabel 8",
"Kabel 9",
"Kabel 10",
"Kabel 11",
"Kabel 12",
"Kabel 13",
"Kabel 14",
"Kabel 15",
"Kabel 16",
"Kabel 17",
"Kabel 18",
"Kabel 19",
"Kabel 20",
"Kabel 21",
"Kabel 22",
"Kabel 23",
"Kabel 24",
"Kabel 25",
"Kabel 26",
"Kabel 27",
"Kabel 28",
"Kabel 29",
"Kabel 30",
"Kabel 31",
"Kabel 32"
],
"win_tdrActive": [
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1
],
"win_tdrAtten": [
11, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0, 2.0,
2.0, 2.0
],
"win_tdrSpeed": [
112, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100, 100,
100, 100
],
"win_tdrTrigger": [
102, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80
],
"win_tdrPulse": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_tdrAmp": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_tdrLocation": [
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0
],
"win_tdrLast": [
"2024-10-17 07:51:54:000",
"2024-09-30 08:38:50:000",
"?",
"?",
"?",
"?",
"?",
"?",
"2024-09-30 08:36:43:000",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?",
"?"
],
"win_memoryInterval": [
5, 0, 15, 0, 0, 15, 15, 0, 0, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 0
]
}

View File

@@ -0,0 +1,142 @@
[
{
"id": 11595,
"code": "02501",
"timestamp": "2025-06-20 10:01:33",
"message": "Isofehler gehend",
"status": 0
},
{
"id": 11594,
"code": "02501",
"timestamp": "2025-06-20 10:01:12",
"message": "Isofehler kommend",
"status": 1
},
{
"id": 11593,
"code": "02000",
"timestamp": "2025-06-20 09:51:37",
"message": "DE 1 gehend",
"status": 0
},
{
"id": 11592,
"code": "02001",
"timestamp": "2025-06-20 09:51:20",
"message": "DE 2 gehend",
"status": 0
},
{
"id": 11591,
"code": "02001",
"timestamp": "2025-06-20 09:50:50",
"message": "DE 2 kommend",
"status": 1
},
{
"id": 11590,
"code": "02031",
"timestamp": "2025-06-20 09:42:38",
"message": "DE 32 gehend",
"status": 0
},
{
"id": 11589,
"code": "02031",
"timestamp": "2025-06-20 09:42:27",
"message": "DE 32 kommend",
"status": 1
},
{
"id": 11588,
"code": "02031",
"timestamp": "2025-06-20 09:42:16",
"message": "DE 32 gehend",
"status": 0
},
{
"id": 11587,
"code": "02000",
"timestamp": "2025-06-20 09:41:36",
"message": "DE 11 kommend",
"status": 1
},
{
"id": 11586,
"code": "02003",
"timestamp": "2025-06-20 09:41:16",
"message": "DE 4 gehend",
"status": 0
},
{
"id": 11585,
"code": "02501",
"timestamp": "2025-06-20 09:31:57",
"message": "Isofehler gehend",
"status": 0
},
{
"id": 11584,
"code": "02501",
"timestamp": "2025-06-20 09:26:26",
"message": "Isofehler kommend",
"status": 1
},
{
"id": 11583,
"code": "02501",
"timestamp": "2025-06-20 09:19:26",
"message": "Isofehler gehend",
"status": 0
},
{
"id": 11582,
"code": "02002",
"timestamp": "2025-06-20 09:17:53",
"message": "DE 3 kommend",
"status": 1
},
{
"id": 11581,
"code": "02501",
"timestamp": "2025-06-20 09:17:33",
"message": "Isofehler kommend",
"status": 1
},
{
"id": 11580,
"code": "02000",
"timestamp": "2025-06-20 09:12:09",
"message": "DE 1 gehend",
"status": 0
},
{
"id": 11579,
"code": "02003",
"timestamp": "2025-06-20 09:05:30",
"message": "DE 4 kommend",
"status": 1
},
{
"id": 11578,
"code": "02002",
"timestamp": "2025-06-20 09:05:27",
"message": "DE 3 gehend",
"status": 0
},
{
"id": 11577,
"code": "02001",
"timestamp": "2025-06-20 09:05:23",
"message": "DE 2 gehend",
"status": 0
},
{
"id": 11576,
"code": "02000",
"timestamp": "2025-06-20 09:02:09",
"message": "DE 11 kommend",
"status": 1
}
]

View File

@@ -0,0 +1,5 @@
{
"win_opcUaZustand": "1",
"win_opcUaActiveClientCount": "0",
"win_opcUaNodesetName": "CPL V4 OPC UA Application Deutsche Bahn"
}

View File

@@ -0,0 +1,5 @@
{
"win_systemVoltTempMockData": [
15.06, 4.984809, -15.086375, -96.480942, 59.782001, 56.919998
]
}

4
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "cpl-v4",
"version": "1.6.448",
"version": "1.6.449",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "cpl-v4",
"version": "1.6.448",
"version": "1.6.449",
"dependencies": {
"@fontsource/roboto": "^5.1.0",
"@iconify-icons/ri": "^1.2.10",

View File

@@ -1,6 +1,6 @@
{
"name": "cpl-v4",
"version": "1.6.448",
"version": "1.6.449",
"private": true,
"scripts": {
"dev": "next dev",

View File

@@ -12,7 +12,7 @@ export default async function handler(
"mocks",
"device-cgi-simulator",
"SERVICE",
"last20MessagesMockData.js"
"last20MessagesMockData.json"
);
try {

View File

@@ -1,6 +1,6 @@
"use client";
// /pages/meldungen.tsx
import React, { useState } from "react";
import React, { useState, useEffect } from "react";
import DateRangePickerMeldungen from "../components/main/meldungen/DateRangePickerMeldungen";
type Meldung = {
@@ -16,6 +16,7 @@ const ITEMS_PER_PAGE = 10;
export default function Messages() {
const [messages, setMessages] = useState<Meldung[]>([]);
const [currentPage, setCurrentPage] = useState(1);
const [sourceFilter, setSourceFilter] = useState<string>("Alle");
// Datum initialisieren: von = heute - 30 Tage, bis = heute
const today = new Date();
@@ -60,12 +61,23 @@ export default function Messages() {
}
};
const totalPages = Math.ceil(messages.length / ITEMS_PER_PAGE);
const currentMessages = messages.slice(
const filteredMessages =
sourceFilter === "Alle"
? messages
: messages.filter((m) => m.i === sourceFilter);
const totalPages = Math.ceil(filteredMessages.length / ITEMS_PER_PAGE);
const currentMessages = filteredMessages.slice(
(currentPage - 1) * ITEMS_PER_PAGE,
currentPage * ITEMS_PER_PAGE
);
const allSources = Array.from(new Set(messages.map((m) => m.i))).sort();
// einmal beim laden de Seite die Meldungen abrufen
useEffect(() => {
fetchMessages();
}, []);
return (
<div className="p-4">
<h1 className="text-xl font-bold mb-4">Berichte</h1>
@@ -83,17 +95,29 @@ export default function Messages() {
>
Anzeigen
</button>
<select
value={sourceFilter}
onChange={(e) => setSourceFilter(e.target.value)}
className=" border border-solid border-spacing-1 px-4 py-3 rounded h-fit ml-6"
>
<option value="Alle">Alle Quellen</option>
{allSources.map((src) => (
<option key={src} value={src}>
{src}
</option>
))}
</select>
</div>
<div className="overflow-x-auto">
<table className="min-w-full border">
<thead className="bg-gray-100 text-left">
<tr>
<th className="p-2 border">Status</th>
<th className="p-2 border">Prio</th>
<th className="p-2 border">Zeitstempel</th>
<th className="p-2 border">Gewicht</th>
<th className="p-2 border">Text</th>
<th className="p-2 border">Quelle</th>
<th className="p-2 border">Meldung</th>
<th className="p-2 border">Status</th>
</tr>
</thead>
<tbody>
@@ -106,9 +130,9 @@ export default function Messages() {
></div>
</td>
<td className="border p-2">{msg.t}</td>
<td className="border p-2">{msg.s}</td>
<td className="border p-2">{msg.m}</td>
<td className="border p-2">{msg.i}</td>
<td className="border p-2">{msg.m}</td>
<td className="border p-2">{msg.s}</td>
</tr>
))}
</tbody>