import RefreshIcon from "@mui/icons-material/Refresh"; import VisibilityIcon from "@mui/icons-material/Visibility"; import { IconButton, Paper, Table, TableBody, TableCell, TableContainer, TableHead, TableRow, Tooltip, } from "@mui/material"; import React from "react"; import { Link, useNavigate } from "react-router-dom"; import { Device, DeviceApi, DevicesState, DeviceURL } from "../api/DeviceApi"; import { AsyncWidget } from "../widgets/AsyncWidget"; import { BoolText } from "../widgets/BoolText"; import { SolarEnergyRouteContainer } from "../widgets/SolarEnergyRouteContainer"; import { TimeWidget } from "../widgets/TimeWidget"; export function DevicesRoute(): React.ReactElement { const loadKey = React.useRef(1); const [list, setList] = React.useState(); const [states, setStates] = React.useState(); const load = async () => { setList(await DeviceApi.ValidatedList()); setStates(await DeviceApi.DevicesState()); }; const reload = () => { loadKey.current += 1; setList(undefined); setStates(undefined); }; return ( } > ( )} /> ); } function ValidatedDevicesList(p: { list: Device[]; states: DevicesState; onReload: () => void; }): React.ReactElement { const navigate = useNavigate(); if (p.list.length === 0) { return

There is no device validated yet.

; } return ( # Model Version Max number of relays Created Updated Status {p.list.map((dev) => ( navigate(DeviceURL(dev))} > {dev.id} {dev.info.reference} {dev.info.version} {dev.info.max_relays}
))}
); }