- Hinzugefügt: __mocks__/webservice/ - gisLinesStatus.js - gisStationsMeasurements.js - gisStationsStaticDistrict.js - gisStationsStatusDistrict.js - gisSystemStatic.js - userRights.js - In allen fetch*Service-Dateien Umschaltung implementiert (über NEXT_PUBLIC_USE_MOCKS) - Fallback auf Mock-Daten bei Entwicklung oder Offline-Modus - Unterstützt schnelles UI-Testing und isolierte Feature-Entwicklung ohne Backend
294 lines
4.3 KiB
JavaScript
294 lines
4.3 KiB
JavaScript
// __mocks__/webservice/userRights.js
|
||
/**
|
||
* Mock-Daten für Benutzerrechte und Systemsichtbarkeit.
|
||
*/
|
||
export const mockUserRights = {
|
||
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,
|
||
},
|
||
],
|
||
};
|
||
|
||
// 🔧 Laufzeit-Hilfsfunktionen für z. B. Mock-basierte UI-Tests
|
||
|
||
/**
|
||
* Systemdaten zur Laufzeit ändern
|
||
* @param {number} id
|
||
* @param {object} changes
|
||
*/
|
||
export const updateSystem = (id, changes) => {
|
||
const system = mockUserRights.Systems.find((s) => s.IdSystem === id);
|
||
if (system) Object.assign(system, changes);
|
||
};
|
||
|
||
/**
|
||
* Ein System aus dem Mock entfernen
|
||
* @param {number} id
|
||
*/
|
||
export const deleteSystem = (id) => {
|
||
const index = mockUserRights.Systems.findIndex((s) => s.IdSystem === id);
|
||
if (index !== -1) mockUserRights.Systems.splice(index, 1);
|
||
};
|