import RefreshIcon from "@mui/icons-material/Refresh"; import { IconButton, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tooltip, } from "@mui/material"; import React from "react"; import { DeviceRelay } from "../api/DeviceApi"; import { RelayApi } from "../api/RelayApi"; import { AsyncWidget } from "../widgets/AsyncWidget"; import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer"; export function RelaysListRoute(): React.ReactElement { const loadKey = React.useRef(1); const [list, setList] = React.useState(); const load = async () => { setList(await RelayApi.GetList()); list?.sort((a, b) => b.priority - a.priority); }; const reload = () => { loadKey.current += 1; setList(undefined); }; return ( } > } /> ); } function RelaysList(p: { list: DeviceRelay[]; onReload: () => void; }): React.ReactElement { return ( Name Enabled Priority Consumption Status {p.list.map((row) => ( {row.name} {row.enabled ? ( YES ) : ( NO )} {row.priority} {row.consumption} TODO ))}
); }