fix: Schleifenwiderstand (TDR) Messung starten Button auf der Produktion
This commit is contained in:
@@ -7,12 +7,10 @@ import { RootState } from "@/redux/store";
|
||||
import {
|
||||
setLoopMeasurementCurveChartData,
|
||||
setSelectedMode,
|
||||
setSelectedSlotType,
|
||||
setChartOpen,
|
||||
setLoading,
|
||||
} from "@/redux/slices/kabelueberwachungChartSlice";
|
||||
import { setBrushRange } from "@/redux/slices/brushSlice";
|
||||
import { setChartTitle } from "@/redux/slices/loopChartTypeSlice";
|
||||
import { Listbox } from "@headlessui/react";
|
||||
|
||||
//-----------------------------------------------------------------------------------useLoopChartLoader
|
||||
@@ -130,6 +128,32 @@ const LoopChartActionBar: React.FC = () => {
|
||||
return `${year};${month};${day}`;
|
||||
};
|
||||
|
||||
const handleStartRSL = async () => {
|
||||
if (slotNumber === null) {
|
||||
alert("⚠️ Bitte zuerst einen KÜ auswählen!");
|
||||
return;
|
||||
}
|
||||
|
||||
const cgiUrl = `${window.location.origin}/CPL?kabelueberwachung.html&KS_${slotNumber}=1`;
|
||||
|
||||
try {
|
||||
console.log("🚀 Starte RSL Messung für Slot:", slotNumber);
|
||||
console.log("📡 CGI URL:", cgiUrl);
|
||||
|
||||
const response = await fetch(cgiUrl);
|
||||
|
||||
if (!response.ok) {
|
||||
throw new Error(`CGI-Fehler: ${response.status}`);
|
||||
}
|
||||
|
||||
console.log("✅ RSL Messung gestartet für Slot", slotNumber);
|
||||
alert(`✅ RSL Messung für Slot ${slotNumber + 1} gestartet`);
|
||||
} catch (err) {
|
||||
console.error("❌ Fehler beim Starten der RSL Messung:", err);
|
||||
alert("❌ Fehler beim Starten der RSL Messung.");
|
||||
}
|
||||
};
|
||||
|
||||
const handleFetchData = async () => {
|
||||
const type = selectedSlotType === "schleifenwiderstand" ? 4 : 3;
|
||||
|
||||
@@ -260,7 +284,7 @@ const LoopChartActionBar: React.FC = () => {
|
||||
|
||||
{/* Schleife starten button*/}
|
||||
<button
|
||||
onClick={handleFetchData}
|
||||
onClick={handleStartRSL}
|
||||
className="px-4 py-1 bg-littwin-blue text-white rounded text-sm whitespace-nowrap"
|
||||
disabled={isLoading}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user