fix: Modal nach Speichern der TDR-Einstellungen automatisch schließen

- onClose-Callback in TdrEinstellung korrekt übergeben und genutzt
- Modal schließt sich nach erfolgreichem Speichern (Alert bestätigt oder direkt)
- Nutzerführung verbessert und Verhalten vereinheitlicht
This commit is contained in:
Ismail Ali
2025-05-01 14:30:29 +02:00
parent acba477fdb
commit 283547d9bd
3 changed files with 9 additions and 3 deletions

View File

@@ -108,7 +108,9 @@ export default function KueModal({ showModal, onClose, slot }: KueModalProps) {
/> />
</div> </div>
{activeTab === "tdr" && <TdrEinstellung slot={slot} />} {activeTab === "tdr" && (
<TdrEinstellung slot={slot} onClose={onClose} />
)}
{activeTab === "knoten" && <Knotenpunkte slot={slot} />} {activeTab === "knoten" && <Knotenpunkte slot={slot} />}
</div> </div>
</ReactModal> </ReactModal>

View File

@@ -6,9 +6,10 @@ import { RootState } from "../../../../../redux/store";
interface Props { interface Props {
slot: number; slot: number;
onClose?: () => void; // ← NEU
} }
export default function TdrEinstellung({ slot }: Props) { export default function TdrEinstellung({ slot, onClose }: Props) {
const tdrSlice = useSelector((state: RootState) => state.kueDataSlice); const tdrSlice = useSelector((state: RootState) => state.kueDataSlice);
const cacheKey = `slot_${slot}`; const cacheKey = `slot_${slot}`;
@@ -67,12 +68,14 @@ export default function TdrEinstellung({ slot }: Props) {
.then((res) => res.json()) .then((res) => res.json())
.then(() => { .then(() => {
alert("TDR-Werte erfolgreich gespeichert."); alert("TDR-Werte erfolgreich gespeichert.");
if (typeof onClose === "function") onClose(); // ← MODAL SCHLIESSEN
}) })
.catch((err) => { .catch((err) => {
console.error("Fehler beim Speichern:", err); console.error("Fehler beim Speichern:", err);
alert("Speichern fehlgeschlagen."); alert("Speichern fehlgeschlagen.");
}); });
} else { } else {
// Originaler Webservice-Teil...
const base = `${window.location.origin}/CPL?/kabelueberwachung.html`; const base = `${window.location.origin}/CPL?/kabelueberwachung.html`;
const urls = [ const urls = [
@@ -91,6 +94,7 @@ export default function TdrEinstellung({ slot }: Props) {
) )
.then(() => { .then(() => {
alert("TDR-Einstellungen erfolgreich gesendet."); alert("TDR-Einstellungen erfolgreich gesendet.");
if (typeof onClose === "function") onClose(); // ← MODAL SCHLIESSEN
}) })
.catch((err) => { .catch((err) => {
console.error("Fehler beim Senden:", err); console.error("Fehler beim Senden:", err);

View File

@@ -6,5 +6,5 @@
2: Patch oder Hotfix (Bugfixes oder kleine Änderungen). 2: Patch oder Hotfix (Bugfixes oder kleine Änderungen).
*/ */
const webVersion = "1.6.324"; const webVersion = "1.6.325";
export default webVersion; export default webVersion;