feat: Datenbank-Reiter ergänzt mit neuen Löschfunktionen
- Neuen Tab „Datenbank“ in Einstellungen-Seite eingebaut - Separate Buttons für: - vollständiges Löschen der Datenbank - Konfiguration löschen (DBC1) - Meldungen löschen (DBC2) - Logger-Messwerte löschen (DBC3) - Logik über eigene Handler-Funktionen umgesetzt - „Datenbank leeren“-Button aus GeneralSettings entfernt
This commit is contained in:
@@ -0,0 +1,34 @@
|
||||
// components/main/settingsPageComponents/handlers/dbHandlers/handleClearConfig.ts
|
||||
const handleClearConfig = async () => {
|
||||
const confirmClear = window.confirm(
|
||||
"Sind Sie sicher, dass Sie die Datenbank Konfiguration löschen möchten?"
|
||||
);
|
||||
if (!confirmClear) return;
|
||||
|
||||
// Get the current path and ensure it ends with ".html"
|
||||
let currentPath = window.location.pathname;
|
||||
if (!currentPath.endsWith(".html")) {
|
||||
currentPath += ".html";
|
||||
}
|
||||
|
||||
// Full URL with host, current path, and clear database command
|
||||
const url = `${window.location.origin}/CPL?${currentPath}&DBC1=1`;
|
||||
|
||||
// Log the full URL to the console for debugging
|
||||
console.log(url);
|
||||
|
||||
// Send the clear database command to the server using fetch and GET method
|
||||
try {
|
||||
const response = await fetch(url, { method: "GET" });
|
||||
if (response.ok) {
|
||||
alert("Datenbank Konfiguration erfolgreich gelöscht!");
|
||||
} else {
|
||||
alert("Fehler beim Löschen der Datenbank Konfiguration!");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler:", error);
|
||||
alert("Fehler beim Löschen der Datenbank Konfiguration!");
|
||||
}
|
||||
};
|
||||
|
||||
export default handleClearConfig;
|
||||
@@ -1,4 +1,4 @@
|
||||
// components/main/settingsPageComponents/handlers/handleClearDatabase.ts
|
||||
// components/main/settingsPageComponents/handlers/dbHandlers/handleClearDatabase.ts
|
||||
const handleClearDatabase = async () => {
|
||||
const confirmClear = window.confirm(
|
||||
"Sind Sie sicher, dass Sie die Datenbank leeren möchten?"
|
||||
@@ -0,0 +1,34 @@
|
||||
// components/main/settingsPageComponents/handlers/dbHandlers/handleClearLogger.ts
|
||||
const handleClearLogger = async () => {
|
||||
const confirmClear = window.confirm(
|
||||
"Sind Sie sicher, dass Sie die Datenbank Messwerte Logger löschen möchten?"
|
||||
);
|
||||
if (!confirmClear) return;
|
||||
|
||||
// Get the current path and ensure it ends with ".html"
|
||||
let currentPath = window.location.pathname;
|
||||
if (!currentPath.endsWith(".html")) {
|
||||
currentPath += ".html";
|
||||
}
|
||||
|
||||
// Full URL with host, current path, and clear database command
|
||||
const url = `${window.location.origin}/CPL?${currentPath}&DBC3=1`;
|
||||
|
||||
// Log the full URL to the console for debugging
|
||||
console.log(url);
|
||||
|
||||
// Send the clear database command to the server using fetch and GET method
|
||||
try {
|
||||
const response = await fetch(url, { method: "GET" });
|
||||
if (response.ok) {
|
||||
alert("Datenbank Messwerte Logger erfolgreich gelöscht!");
|
||||
} else {
|
||||
alert("Fehler beim Löschen der Datenbank Messwerte Logger!");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler:", error);
|
||||
alert("Fehler beim Löschen der Datenbank Messwerte Logger!");
|
||||
}
|
||||
};
|
||||
|
||||
export default handleClearLogger;
|
||||
@@ -0,0 +1,34 @@
|
||||
// components/main/settingsPageComponents/handlers/dbHandlers/handleClearMessages.ts
|
||||
const handleClearMessages = async () => {
|
||||
const confirmClear = window.confirm(
|
||||
"Sind Sie sicher, dass Sie die Datenbank Meldungen löschen möchten?"
|
||||
);
|
||||
if (!confirmClear) return;
|
||||
|
||||
// Get the current path and ensure it ends with ".html"
|
||||
let currentPath = window.location.pathname;
|
||||
if (!currentPath.endsWith(".html")) {
|
||||
currentPath += ".html";
|
||||
}
|
||||
|
||||
// Full URL with host, current path, and clear database command
|
||||
const url = `${window.location.origin}/CPL?${currentPath}&DBC2=1`;
|
||||
|
||||
// Log the full URL to the console for debugging
|
||||
console.log(url);
|
||||
|
||||
// Send the clear database command to the server using fetch and GET method
|
||||
try {
|
||||
const response = await fetch(url, { method: "GET" });
|
||||
if (response.ok) {
|
||||
alert("Datenbank Meldungen erfolgreich gelöscht!");
|
||||
} else {
|
||||
alert("Fehler beim Löschen der Datenbankmeldungen !");
|
||||
}
|
||||
} catch (error) {
|
||||
console.error("Fehler:", error);
|
||||
alert("Fehler beim Löschen der Datenbankmeldungen!");
|
||||
}
|
||||
};
|
||||
|
||||
export default handleClearMessages;
|
||||
Reference in New Issue
Block a user