feat: in System 5 Volt DIA0, DIA1 und DIA2 in dropdown anzeigen
This commit is contained in:
@@ -7,7 +7,7 @@ export default async function handler(
|
||||
req: NextApiRequest,
|
||||
res: NextApiResponse
|
||||
) {
|
||||
const { typ = "DIA0" } = req.query;
|
||||
const { typ = "DIA1" } = req.query;
|
||||
|
||||
if (!["DIA0", "DIA1", "DIA2"].includes(typ as string)) {
|
||||
return res
|
||||
|
||||
@@ -8,6 +8,7 @@ import { SystemOverviewGrid } from "@/components/main/system/SystemOverviewGrid"
|
||||
import { SystemCharts } from "@/components/main/system/SystemCharts";
|
||||
import { DetailModal } from "@/components/main/system/DetailModal";
|
||||
import type { HistoryEntry } from "@/components/main/system/SystemCharts";
|
||||
import { getSystemspannung5VplusThunk } from "@/redux/thunks/getSystemspannung5VplusThunk";
|
||||
|
||||
const SystemPage = () => {
|
||||
const dispatch = useDispatch<AppDispatch>();
|
||||
@@ -21,15 +22,21 @@ const SystemPage = () => {
|
||||
|
||||
const [selectedKey, setSelectedKey] = useState<string | null>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const [zeitraum, setZeitraum] = useState<"DIA0" | "DIA1" | "DIA2">("DIA1");
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getSystemVoltTempThunk());
|
||||
|
||||
const interval = setInterval(() => {
|
||||
dispatch(getSystemVoltTempThunk());
|
||||
}, 5000);
|
||||
return () => clearInterval(interval);
|
||||
}, [dispatch]);
|
||||
|
||||
useEffect(() => {
|
||||
dispatch(getSystemspannung5VplusThunk(zeitraum));
|
||||
}, [dispatch, zeitraum]);
|
||||
|
||||
const handleOpenDetail = (key: string) => {
|
||||
setSelectedKey(key);
|
||||
setIsModalOpen(true);
|
||||
@@ -46,11 +53,13 @@ const SystemPage = () => {
|
||||
System Spannungen & Temperaturen
|
||||
</h1>
|
||||
<SystemOverviewGrid voltages={voltages} onOpenDetail={handleOpenDetail} />
|
||||
<SystemCharts history={history} />
|
||||
<SystemCharts history={history} zeitraum={zeitraum} />
|
||||
<DetailModal
|
||||
isOpen={isModalOpen}
|
||||
selectedKey={selectedKey}
|
||||
onClose={handleCloseDetail}
|
||||
zeitraum={zeitraum}
|
||||
setZeitraum={setZeitraum}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user