feat: in System 5 Volt DIA0, DIA1 und DIA2 in dropdown anzeigen
This commit is contained in:
@@ -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.531
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.533
|
||||
NEXT_PUBLIC_CPL_MODE=json # json (Entwicklungsumgebung) oder jsSimulatedProd (CPL ->CGI-Interface-Simulator) oder production (CPL-> CGI-Interface Platzhalter)
|
||||
|
||||
|
||||
@@ -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.531
|
||||
NEXT_PUBLIC_APP_VERSION=1.6.533
|
||||
NEXT_PUBLIC_CPL_MODE=production
|
||||
22
CHANGELOG.md
22
CHANGELOG.md
@@ -1,3 +1,25 @@
|
||||
## [1.6.533] – 2025-07-03
|
||||
|
||||
- feat: API für Systemspannung +5V erfolgreich implementiert
|
||||
|
||||
- API-Handler `getSystemspannung5VplusHandler.ts` erstellt
|
||||
- JSON-Daten werden aus dem Verzeichnis `mocks/device-cgi-simulator/chartsData/systemspannung5Vplus/` geladen
|
||||
- unterstützt die Parameter DIA0, DIA1, DIA2 für unterschiedliche Datenfrequenzen
|
||||
- Fehlerbehandlung bei ungültigen Typen und fehlenden Dateien eingebaut
|
||||
- API getestet unter `/api/cpl/getSystemspannung5VplusHandler?typ=DIA0`
|
||||
|
||||
---
|
||||
## [1.6.532] – 2025-07-03
|
||||
|
||||
- feat: API für Systemspannung +5V erfolgreich implementiert
|
||||
|
||||
- API-Handler `getSystemspannung5VplusHandler.ts` erstellt
|
||||
- JSON-Daten werden aus dem Verzeichnis `mocks/device-cgi-simulator/chartsData/systemspannung5Vplus/` geladen
|
||||
- unterstützt die Parameter DIA0, DIA1, DIA2 für unterschiedliche Datenfrequenzen
|
||||
- Fehlerbehandlung bei ungültigen Typen und fehlenden Dateien eingebaut
|
||||
- API getestet unter `/api/cpl/getSystemspannung5VplusHandler?typ=DIA0`
|
||||
|
||||
---
|
||||
## [1.6.531] – 2025-07-03
|
||||
|
||||
- feat: API für Systemspannung +5V erfolgreich implementiert
|
||||
|
||||
@@ -9,28 +9,33 @@ type Props = {
|
||||
isOpen: boolean;
|
||||
selectedKey: string | null;
|
||||
onClose: () => void;
|
||||
zeitraum: "DIA0" | "DIA1" | "DIA2";
|
||||
setZeitraum: (typ: "DIA0" | "DIA1" | "DIA2") => void;
|
||||
};
|
||||
|
||||
export const DetailModal = ({ isOpen, selectedKey, onClose }: Props) => {
|
||||
// Mapping: Welcher Redux-Zweig zu welchem selectedKey gehört
|
||||
export const DetailModal = ({
|
||||
isOpen,
|
||||
selectedKey,
|
||||
onClose,
|
||||
zeitraum,
|
||||
setZeitraum,
|
||||
}: Props) => {
|
||||
const typMap: Record<string, "DIA0" | "DIA1" | "DIA2"> = {
|
||||
"+5V": "DIA1",
|
||||
"+15V": "DIA1",
|
||||
"-15V": "DIA1",
|
||||
"-98V": "DIA1",
|
||||
"+5V": zeitraum,
|
||||
"+15V": zeitraum,
|
||||
"-15V": zeitraum,
|
||||
"-98V": zeitraum,
|
||||
};
|
||||
|
||||
const typ = selectedKey ? typMap[selectedKey] : null;
|
||||
type ReduxDataItem = { t: string; i: number };
|
||||
|
||||
// Redux State abrufen
|
||||
const reduxData = useSelector((state: RootState) =>
|
||||
typ ? state.systemspannung5Vplus[typ] : []
|
||||
typ ? (state.systemspannung5Vplus[typ] as ReduxDataItem[]) : []
|
||||
);
|
||||
|
||||
// Zeitstempel und Werte extrahieren
|
||||
type DataPoint = { t: string; i: number };
|
||||
const labels = reduxData.map((e: unknown) => (e as DataPoint).t);
|
||||
const values = reduxData.map((e: unknown) => (e as DataPoint).i);
|
||||
const labels = reduxData.map((e: ReduxDataItem) => e.t);
|
||||
const values = reduxData.map((e: ReduxDataItem) => e.i);
|
||||
|
||||
const baseOptions = {
|
||||
responsive: true,
|
||||
@@ -68,9 +73,16 @@ export const DetailModal = ({ isOpen, selectedKey, onClose }: Props) => {
|
||||
|
||||
<div className="mb-4">
|
||||
<label className="mr-2 font-medium">Zeitraum:</label>
|
||||
<select className="border px-2 py-1 rounded">
|
||||
<option>Letzte 24 Stunden</option>
|
||||
{/* Optional: dynamische Filter */}
|
||||
<select
|
||||
className="border px-2 py-1 rounded"
|
||||
value={zeitraum}
|
||||
onChange={(e) =>
|
||||
setZeitraum(e.target.value as "DIA0" | "DIA1" | "DIA2")
|
||||
}
|
||||
>
|
||||
<option value="DIA0">Alle Messwerte</option>
|
||||
<option value="DIA1">Stündlich</option>
|
||||
<option value="DIA2">Täglich</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -35,8 +35,8 @@ export type HistoryEntry = {
|
||||
|
||||
type Props = {
|
||||
history: HistoryEntry[];
|
||||
zeitraum: "DIA0" | "DIA1" | "DIA2";
|
||||
};
|
||||
|
||||
export const SystemCharts = ({ history }: Props) => {
|
||||
const labels = history.map((h) => new Date(h.time).toLocaleTimeString());
|
||||
const formatValue = (v: number) => v.toFixed(2);
|
||||
|
||||
4
package-lock.json
generated
4
package-lock.json
generated
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.531",
|
||||
"version": "1.6.533",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.531",
|
||||
"version": "1.6.533",
|
||||
"dependencies": {
|
||||
"@fontsource/roboto": "^5.1.0",
|
||||
"@iconify-icons/ri": "^1.2.10",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "cpl-v4",
|
||||
"version": "1.6.531",
|
||||
"version": "1.6.533",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"dev": "next dev",
|
||||
|
||||
@@ -7,7 +7,7 @@ export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const { typ = "DIA0" } = req.query;
|
||||
const { typ = "DIA1" } = req.query;
|
||||
|
||||
if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) {
|
||||
return res
|
||||
|
||||
@@ -8,6 +8,7 @@ import { SystemOverviewGrid } from "@/components/main/system/SystemOverviewGrid"
|
||||
import { SystemCharts } from "@/components/main/system/SystemCharts";
|
||||
import { DetailModal } from "@/components/main/system/DetailModal";
|
||||
import type { HistoryEntry } from "@/components/main/system/SystemCharts";
|
||||
import { getSystemspannung5VplusThunk } from "@/redux/thunks/getSystemspannung5VplusThunk";
|
||||
|
||||
const SystemPage = () => {
|
||||
const dispatch = useDispatch<AppDispatch>();
|
||||
@@ -21,15 +22,21 @@ const SystemPage = () => {
|
||||
|
||||
const [selectedKey, setSelectedKey] = useState<string | null>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [zeitraum, setZeitraum] = useState<"DIA0" | "DIA1" | "DIA2">("DIA1");
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getSystemVoltTempThunk());
|
||||
|
||||
const interval = setInterval(() => {
|
||||
dispatch(getSystemVoltTempThunk());
|
||||
}, 5000);
|
||||
return () => clearInterval(interval);
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getSystemspannung5VplusThunk(zeitraum));
|
||||
}, [dispatch, zeitraum]);
|
||||
|
||||
const handleOpenDetail = (key: string) => {
|
||||
setSelectedKey(key);
|
||||
setIsModalOpen(true);
|
||||
@@ -46,11 +53,13 @@ const SystemPage = () => {
|
||||
System Spannungen & Temperaturen
|
||||
</h1>
|
||||
<SystemOverviewGrid voltages={voltages} onOpenDetail={handleOpenDetail} />
|
||||
<SystemCharts history={history} />
|
||||
<SystemCharts history={history} zeitraum={zeitraum} />
|
||||
<DetailModal
|
||||
isOpen={isModalOpen}
|
||||
selectedKey={selectedKey}
|
||||
onClose={handleCloseDetail}
|
||||
zeitraum={zeitraum}
|
||||
setZeitraum={setZeitraum}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -22,7 +22,33 @@ export const fetchKueDataService = async () => {
|
||||
document.body.appendChild(script);
|
||||
});
|
||||
|
||||
const win = window as any;
|
||||
const win = window as Window & {
|
||||
win_kueOnline?: unknown[];
|
||||
win_kueID?: unknown[];
|
||||
win_kueName?: unknown[];
|
||||
win_kuePSTmMinus96V?: unknown[];
|
||||
win_kueAlarm1?: unknown[];
|
||||
win_kueAlarm2?: unknown[];
|
||||
win_kueIso?: unknown[];
|
||||
win_kueResidence?: unknown[];
|
||||
win_kueCableBreak?: unknown[];
|
||||
win_kueGroundFault?: unknown[];
|
||||
win_kueLimit1?: unknown[];
|
||||
win_kueLimit2Low?: unknown[];
|
||||
win_kueDelay1?: unknown[];
|
||||
win_kueLoopInterval?: unknown[];
|
||||
win_kueVersion?: unknown[];
|
||||
win_kueOverflow?: unknown[];
|
||||
win_tdrAtten?: unknown[];
|
||||
win_tdrPulse?: unknown[];
|
||||
win_tdrSpeed?: unknown[];
|
||||
win_tdrAmp?: unknown[];
|
||||
win_tdrTrigger?: unknown[];
|
||||
win_tdrLocation?: unknown[];
|
||||
win_tdrActive?: unknown[];
|
||||
win_tdrLast?: unknown[];
|
||||
win_memoryInterval?: unknown[];
|
||||
};
|
||||
|
||||
return {
|
||||
kueOnline: win.win_kueOnline || [],
|
||||
|
||||
Reference in New Issue
Block a user