Phase 3a Frontend-Hygiene: Toast statt alert/confirm
- src/static/css/style.css: Toast-Styles (.toast-container, .toast,
Varianten info/success/warning/error, Animations)
- src/static/dashboard.html: <div id=toastContainer> vor </body>,
Cancel-Button im Confirm-Modal bekommt id=confirmCancelBtn
- src/static/js/app.js:
- showToast(msg, type) neu - links oben, autoclose 3.5s (error: 6s)
- showConfirm(title, text, callback?) jetzt Promise<boolean>-fähig
(Backwards-compat: Legacy-Callback wird bei OK weiter aufgerufen)
- Cancel/Close-Hooks am modalConfirm setzen Promise auf false
- alle 18 alert() in app.js / source-health.js / sources.js durch
showToast(msg, type) ersetzt (type je nach Kontext error/success/warning/info)
- 2 confirm() in source-health.js durch await showConfirm() ersetzt
Dieser Commit ist enthalten in:
@@ -258,7 +258,7 @@ function confirmDeleteGlobalSource(id, name) {
|
||||
await API.del("/api/sources/global/" + id);
|
||||
loadGlobalSources();
|
||||
} catch (err) {
|
||||
alert(err.message);
|
||||
showToast(err.message, "error");
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -320,7 +320,7 @@ function promoteSource(id, name) {
|
||||
await API.post("/api/sources/tenant/" + id + "/promote");
|
||||
loadTenantSources();
|
||||
} catch (err) {
|
||||
alert(err.message);
|
||||
showToast(err.message, "error");
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -399,7 +399,7 @@ async function addDiscoveredFeeds() {
|
||||
});
|
||||
|
||||
if (selected.length === 0) {
|
||||
alert("Keine Feeds ausgewählt");
|
||||
showToast("Keine Feeds ausgewählt", "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -411,9 +411,9 @@ async function addDiscoveredFeeds() {
|
||||
const result = await API.post("/api/sources/discover/add", selected);
|
||||
closeModal("modalDiscover");
|
||||
loadGlobalSources();
|
||||
alert(result.added + " Grundquelle(n) hinzugefügt" + (result.skipped ? ", " + result.skipped + " übersprungen" : ""));
|
||||
showToast(result.added + " Grundquelle(n) hinzugefügt" + (result.skipped ? ", " + result.skipped + " übersprungen" : ""), "success");
|
||||
} catch (err) {
|
||||
alert("Fehler: " + err.message);
|
||||
showToast("Fehler: " + err.message, "error");
|
||||
} finally {
|
||||
btn.disabled = false;
|
||||
btn.textContent = "Ausgewählte hinzufügen";
|
||||
|
||||
In neuem Issue referenzieren
Einen Benutzer sperren