mock: Linien

This commit is contained in:
Ismail Ali
2025-05-29 10:10:48 +02:00
parent 25508e9b22
commit 6995f4bca7
9 changed files with 2179 additions and 47 deletions

View File

@@ -13,6 +13,7 @@ NEXT_PUBLIC_DEBUG_LOG=true
#auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80 #auf dem Entwicklungsrechner dev läuft auf Port 3000 und auf dem Server prod auf Port 80, aber der WebService ist immer auf PORT 80
NEXT_PUBLIC_API_PORT_MODE=dev NEXT_PUBLIC_API_PORT_MODE=dev
NEXT_PUBLIC_USE_MOCKS=false
# Der Unterordner talas5 gleich hinter der IP-Adresse (oder Servername) muss konfigurierbar sein. # Der Unterordner talas5 gleich hinter der IP-Adresse (oder Servername) muss konfigurierbar sein.
# Es muss auch möglich sein kein Unterorder anzugeben (z.B. nur http://talasserver/). # Es muss auch möglich sein kein Unterorder anzugeben (z.B. nur http://talasserver/).

View File

@@ -1,29 +0,0 @@
const mockXmlData = `
<root>
<Name>Liste aller Status der Geräte</Name>
<Zeitstempel>2025-01-03T11:26:11.777</Zeitstempel>
<IdMap>12</IdMap>
<Statis>
<Item>
<IdLD>50922</IdLD>
<Na>system</Na>
<Le>4</Le>
<Co>#FF00FF</Co>
<Me>Eingang DE 01 kommend</Me>
<Feld>4</Feld>
<Icon>0</Icon>
</Item>
<Item>
<IdLD>50922</IdLD>
<Na>system</Na>
<Le>4</Le>
<Co>#FF00FF</Co>
<Me>Eingang DE 05 kommend</Me>
<Feld>4</Feld>
<Icon>0</Icon>
</Item>
</Statis>
</root>
`;
export default mockXmlData;

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,130 @@
// __mocks__/webservice/gisStationsMeasurements.js
export const mockGisStationsMeasurements = {
Name: "Liste aller Messungen der Geraete",
Zeitstempel: "2025-05-29T08:53:04.1449106+02:00",
IdMap: "12",
Statis: [
{
IdLD: 50937,
IdL: 24101,
IdDP: 3,
Na: "FBT",
Val: "6",
Unit: "°C",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 10,
Na: "GT",
Val: "-2.14",
Unit: "°C",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 2,
Na: "LT",
Val: "0.21",
Unit: "°C",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 6,
Na: "RLF",
Val: "77.54",
Unit: "%",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 4,
Na: "RS",
Val: "30.33",
Unit: "%",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 11,
Na: "TPT",
Val: "2.99",
Unit: "°C",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 12,
Na: "TT1",
Val: "0.1245",
Unit: "°C",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 16,
Na: "WFD",
Val: "0.211",
Unit: "mm",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 8,
Na: "WGM",
Val: "0.5",
Unit: "m/s",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 9,
Na: "WGS",
Val: "0.75",
Unit: "m/s",
Gr: "GMA",
Area_Name: "Rastede",
},
{
IdLD: 50937,
IdL: 24101,
IdDP: 7,
Na: "WR",
Val: "180",
Unit: "°",
Gr: "GMA",
Area_Name: "Rastede",
},
],
};
// Optional: Funktion zum Ändern
export const updateMeasurement = (id, changes) => {
const deviceMeasurement = mockGisStationsMeasurements.Statis.find((p) => p.IdLD === id);
if (deviceMeasurement) Object.assign(deviceMeasurement, changes);
};
export const deleteMeasurement = (id) => {
const index = mockGisStationsMeasurements.Statis.findIndex((p) => p.IdLD === id);
if (index !== -1) mockGisStationsMeasurements.Statis.splice(index, 1);
};

View File

@@ -0,0 +1,173 @@
// __mocks__/webservice/gisStationsStaticDistrict.js
export const mockGisStationsStaticDistrict = {
Name: "Liste aller Geraete einer bestimmten Karte",
Zeitstempel: "2025-05-29T08:08:34.2019886+02:00",
IdMap: "12",
Points: [
{
LD_Name: "CPL Ismael",
IdLD: 50922,
Device: "CPL V3.5 mit 24 Kü",
Link: "cpl.aspx?ver=35&kue=24&id=50922",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 20,
System: 1,
Active: 1,
},
{
LD_Name: "LR 77 ISA",
IdLD: 50935,
Device: "LTE Modem LR77",
Link: "lr77.aspx?ver=1&id=50935",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 12,
System: 5,
Active: 1,
},
{
LD_Name: "Cisco Router 1841",
IdLD: 50936,
Device: "Cisco 1841",
Link: "cisco1841.aspx?ver=1&id=50936",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 21,
System: 6,
Active: 1,
},
{
LD_Name: "GMA Testgerät ISA",
IdLD: 50937,
Device: "Glättemeldeanlage",
Link: "gma.aspx?ver=1&id=50937",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 1,
System: 11,
Active: 1,
},
{
LD_Name: "SMS-Funkmodem",
IdLD: 50938,
Device: "SMS Funkmodem",
Link: "sms_modem.aspx?ver=1&id=50938",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 12,
System: 111,
Active: 1,
},
{
LD_Name: "TALAS Meldestationen ISA",
IdLD: 50939,
Device: "CPL V3.5 mit 16 Kü",
Link: "cpl.aspx?ver=35&kue=16&id=50939",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 20,
System: 1,
Active: 1,
},
{
LD_Name: "WAGO Klemmen ISA",
IdLD: 50941,
Device: "WAGO 16 DE",
Link: "wago.aspx?ver=1&DE=16&id=50941",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 9,
System: 7,
Active: 1,
},
{
LD_Name: "Cisco 1921",
IdLD: 50942,
Device: "Cisco 1921",
Link: "cisco1921.aspx?ver=1&id=50942",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 21,
System: 6,
Active: 1,
},
{
LD_Name: "Cisco 8200",
IdLD: 50943,
Device: "Cisco 8200",
Link: "cisco8200.aspx?ver=1&id=50943",
Location_Name: "Littwin",
Location_Short: "LTW",
IdLocation: 24101,
Area_Name: "Rastede",
Area_Short: "",
IdArea: 20998,
X: 53.242157,
Y: 8.160353,
Icon: 21,
System: 6,
Active: 1,
},
],
};
// Optional: Funktion zum Ändern
export const updateDevice = (id, changes) => {
const device = mockGisStationsStaticDistrict.Points.find((p) => p.IdLD === id);
if (device) Object.assign(device, changes);
};
export const deleteDevice = (id) => {
const index = mockGisStationsStaticDistrict.Points.findIndex((p) => p.IdLD === id);
if (index !== -1) mockGisStationsStaticDistrict.Points.splice(index, 1);
};

View File

@@ -0,0 +1,119 @@
// __mocks__/webservice/gisStationsStatusDistrict.js
export const mockGisStationsStatusDistrict = {
Name: "Liste aller Statis der Geraete",
Zeitstempel: "2025-05-29T08:45:50.7257018+02:00",
IdMap: "12",
Statis: [
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Eingang DE 01 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Eingang DE 05 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Eingang DE 17 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Eingang DE 31 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Eingang DE 32 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "system",
Le: 4,
Co: "#FF00FF",
Me: "Station offline",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "minor",
Le: 3,
Co: "#FFFF00",
Me: "Eingang DE 02 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "minor",
Le: 3,
Co: "#FFFF00",
Me: "KÜG 08: Überspannung gehend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "major",
Le: 2,
Co: "#FF9900",
Me: "Eingang DE 03 kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "critical",
Le: 1,
Co: "#FF0000",
Me: "KÜG 02: Aderbruch kommend",
Feld: 4,
Icon: 0,
},
{
IdLD: 50922,
Na: "critical",
Le: 1,
Co: "#FF0000",
Me: "KÜG 03: Aderbruch kommend",
Feld: 4,
Icon: 0,
},
],
};
// Optional: Funktion zum Ändern
export const updateDeviceStatus = (id, changes) => {
const deviceStatus = mockGisStationsStatusDistrict.Statis.find((p) => p.IdLD === id);
if (deviceStatus) Object.assign(deviceStatus, changes);
};
export const deleteDeviceStatus = (id) => {
const index = mockGisStationsStatusDistrict.Statis.findIndex((p) => p.IdLD === id);
if (index !== -1) mockGisStationsStatusDistrict.Statis.splice(index, 1);
};

View File

@@ -0,0 +1,281 @@
// __mocks__/webservice/gisSystemStatic.js
export const mockGisSystemStatic = {
Name: "Liste aller angezeigten Systeme",
Zeitstempel: "2025-05-29T08:57:47.6981898+02:00",
IdMap: "12",
Systems: [
{
IdSystem: 1,
Name: "TALAS",
Longname: "Talas Meldestationen",
Allow: 1,
Icon: 1,
},
{
IdSystem: 2,
Name: "ECI",
Longname: "ECI Geräte",
Allow: 1,
Icon: 2,
},
{
IdSystem: 3,
Name: "ULAF",
Longname: "ULAF Geräte",
Allow: 0,
Icon: 3,
},
{
IdSystem: 5,
Name: "GSM Modem",
Longname: "LR77 GSM Modems",
Allow: 1,
Icon: 5,
},
{
IdSystem: 6,
Name: "Cisco Router",
Longname: "Cisco Router",
Allow: 1,
Icon: 6,
},
{
IdSystem: 7,
Name: "WAGO",
Longname: "WAGO I/O Systeme",
Allow: 1,
Icon: 7,
},
{
IdSystem: 8,
Name: "Siemens",
Longname: "Siemens Notrufsysteme",
Allow: 1,
Icon: 8,
},
{
IdSystem: 9,
Name: "OTDR",
Longname: "Glasfaserüberwachung OTU",
Allow: 1,
Icon: 9,
},
{
IdSystem: 10,
Name: "WDM",
Longname: " Wavelength Division Multiplexing",
Allow: 1,
Icon: 10,
},
{
IdSystem: 11,
Name: "GMA",
Longname: "Glättemeldeanlagen",
Allow: 1,
Icon: 11,
},
{
IdSystem: 13,
Name: "Messstellen",
Longname: "Messstellen",
Allow: 0,
Icon: 13,
},
{
IdSystem: 30,
Name: "TK-Komponenten",
Longname: "TK-Komponenten",
Allow: 1,
Icon: 30,
},
{
IdSystem: 100,
Name: "TALAS ICL",
Longname: "Talas ICL Unterstationen",
Allow: 1,
Icon: 100,
},
{
IdSystem: 110,
Name: "DAUZ",
Longname: "Dauerzählstellen",
Allow: 1,
Icon: 110,
},
{
IdSystem: 111,
Name: "SMS Modem",
Longname: "SMS Modem",
Allow: 1,
Icon: 111,
},
{
IdSystem: 200,
Name: "Sonstige",
Longname: "Sonstige",
Allow: 1,
Icon: 200,
},
],
Rights: [
{
IdRight: 1,
},
{
IdRight: 2,
},
{
IdRight: 3,
},
{
IdRight: 5,
},
{
IdRight: 6,
},
{
IdRight: 7,
},
{
IdRight: 8,
},
{
IdRight: 10,
},
{
IdRight: 11,
},
{
IdRight: 12,
},
{
IdRight: 20,
},
{
IdRight: 22,
},
{
IdRight: 23,
},
{
IdRight: 25,
},
{
IdRight: 30,
},
{
IdRight: 40,
},
{
IdRight: 41,
},
{
IdRight: 42,
},
{
IdRight: 43,
},
{
IdRight: 44,
},
{
IdRight: 45,
},
{
IdRight: 46,
},
{
IdRight: 47,
},
{
IdRight: 48,
},
{
IdRight: 49,
},
{
IdRight: 50,
},
{
IdRight: 51,
},
{
IdRight: 52,
},
{
IdRight: 55,
},
{
IdRight: 56,
},
{
IdRight: 60,
},
{
IdRight: 61,
},
{
IdRight: 62,
},
{
IdRight: 63,
},
{
IdRight: 64,
},
{
IdRight: 65,
},
{
IdRight: 68,
},
{
IdRight: 69,
},
{
IdRight: 70,
},
{
IdRight: 71,
},
{
IdRight: 72,
},
{
IdRight: 73,
},
{
IdRight: 79,
},
{
IdRight: 80,
},
{
IdRight: 90,
},
{
IdRight: 93,
},
{
IdRight: 94,
},
{
IdRight: 95,
},
{
IdRight: 96,
},
],
};
// Optional: Funktion zum Ändern
export const updateSystem = (id, changes) => {
const system = mockGisSystemStatic.Systems.find((p) => p.IdSystem === id);
if (system) Object.assign(system, changes);
};
export const deleteSystem = (id) => {
const index = mockGisSystemStatic.Systems.findIndex((p) => p.IdSystem === id);
if (index !== -1) mockGisSystemStatic.Systems.splice(index, 1);
};

View File

@@ -1,2 +1,2 @@
// /config/appVersion // /config/appVersion
export const APP_VERSION = "1.1.205"; export const APP_VERSION = "1.1.206";

View File

@@ -1,29 +1,38 @@
// /services/webservice/fetchGisLinesStatusService.js // /services/webservice/fetchGisLinesStatusService.js
export const fetchGisLinesStatusService = async () => { export const fetchGisLinesStatusService = async () => {
const useMocks = process.env.NEXT_PUBLIC_USE_MOCKS === "true";
const mode = process.env.NEXT_PUBLIC_API_PORT_MODE; const mode = process.env.NEXT_PUBLIC_API_PORT_MODE;
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || ""; const basePath = process.env.NEXT_PUBLIC_BASE_PATH || "";
const baseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80${basePath}/ClientData/WebServiceMap.asmx` : `${window.location.origin}${basePath}/ClientData/WebServiceMap.asmx`; if (useMocks) {
console.log("🧪 Mock-Modus aktiviert: fetchGisLinesStatusService");
const { mockGisLinesStatus } = await import("../../__mocks__/webservice/gisLinesStatus.js");
return mockGisLinesStatus.Statis;
} else {
const baseUrl = mode === "dev" ? `${window.location.protocol}//${window.location.hostname}:80${basePath}/ClientData/WebServiceMap.asmx` : `${window.location.origin}${basePath}/ClientData/WebServiceMap.asmx`;
const params = new URLSearchParams(window.location.search); const params = new URLSearchParams(window.location.search);
const idMap = params.get("m"); const idMap = params.get("m");
const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`; const url = `${baseUrl}/GisLinesStatus?idMap=${idMap}`;
console.log("📡 fetchGisLinesStatusService URL:", url); console.log("📡 fetchGisLinesStatusService URL:", url);
const response = await fetch(url); const response = await fetch(url);
if (!response.ok) throw new Error("Fehler beim Laden der Linienstatusdaten"); if (!response.ok) throw new Error("Fehler beim Laden der Linienstatusdaten");
const text = await response.text(); const text = await response.text();
let json; let json;
try { try {
json = JSON.parse(text); json = JSON.parse(text);
} catch (e) { } catch (e) {
console.error("❌ Fehler beim JSON-Parsing der Antwort:", text); console.error("❌ Fehler beim JSON-Parsing der Antwort:", text);
throw new Error("Antwort ist kein gültiges JSON"); throw new Error("Antwort ist kein gültiges JSON");
}
if (!Array.isArray(json.Statis)) throw new Error("Ungültige Antwortstruktur: Statis fehlt");
return json.Statis;
} }
if (!Array.isArray(json.Statis)) throw new Error("Ungültige Antwortstruktur: Statis fehlt");
return json.Statis;
}; };