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>
{activeTab === "tdr" && <TdrEinstellung slot={slot} />}
{activeTab === "tdr" && (
<TdrEinstellung slot={slot} onClose={onClose} />
)}
{activeTab === "knoten" && <Knotenpunkte slot={slot} />}
</div>
</ReactModal>

View File

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

View File

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