show not available when a dallas sensor is offline

This commit is contained in:
proddy
2020-10-22 18:57:27 +02:00
parent 4cffadcea2
commit 71461eefd5

View File

@@ -70,6 +70,13 @@ type EMSESPDevicesFormProps = RestFormProps<EMSESPDevices> &
AuthenticatedContextProps & AuthenticatedContextProps &
WithWidthProps; WithWidthProps;
function formatTemp(t: string) {
if (t == null) {
return "(not available)";
}
return t + " °C";
}
class EMSESPDevicesForm extends Component< class EMSESPDevicesForm extends Component<
EMSESPDevicesFormProps, EMSESPDevicesFormProps,
EMSESPDevicesFormState EMSESPDevicesFormState
@@ -194,7 +201,7 @@ class EMSESPDevicesForm extends Component<
{sensorData.id} {sensorData.id}
</TableCell> </TableCell>
<TableCell align="right"> <TableCell align="right">
{sensorData.temp}&nbsp;&deg;C {formatTemp(sensorData.temp)}
</TableCell> </TableCell>
</TableRow> </TableRow>
))} ))}