From 1559d5f1a7d1d667b2fafbd015d7b0c1199f23b6 Mon Sep 17 00:00:00 2001 From: proddy Date: Wed, 26 Aug 2020 16:05:54 +0200 Subject: [PATCH] tidy table, mention Rx fails is not evil --- interface/src/project/EMSESPStatusForm.tsx | 69 ++++++++++++++-------- 1 file changed, 46 insertions(+), 23 deletions(-) diff --git a/interface/src/project/EMSESPStatusForm.tsx b/interface/src/project/EMSESPStatusForm.tsx index 28af88cd4..a3c084fb3 100644 --- a/interface/src/project/EMSESPStatusForm.tsx +++ b/interface/src/project/EMSESPStatusForm.tsx @@ -1,17 +1,22 @@ import React, { Component, Fragment } from "react"; -import { WithTheme, withTheme } from "@material-ui/core/styles"; +import { WithTheme, withTheme, withStyles, Theme, createStyles } from "@material-ui/core/styles"; import { + TableContainer, Table, + Box, + Typography, TableBody, TableCell, TableHead, TableRow, - Divider, List, ListItem, ListItemAvatar, ListItemText, + withWidth, + WithWidthProps, + isWidthDown } from "@material-ui/core"; import RefreshIcon from "@material-ui/icons/Refresh"; @@ -32,14 +37,30 @@ import { import { EMSESPStatus } from "./EMSESPtypes"; -type EMSESPStatusFormProps = RestFormProps & WithTheme; +type EMSESPStatusFormProps = RestFormProps & WithTheme & WithWidthProps; + +const StyledTableCell = withStyles((theme: Theme) => + createStyles({ + head: { + backgroundColor: theme.palette.common.black, + color: theme.palette.common.white, + }, + body: { + fontSize: 14, + }, + }), +)(TableCell); class EMSESPStatusForm extends Component { + + rxErrors = () => { + return this.props.data.crc_errors !== 0; + } + createListItems() { - const { data, theme } = this.props; + const { data, theme, width } = this.props; return ( - @@ -49,46 +70,52 @@ class EMSESPStatusForm extends Component { {isConnected(data) && ( - - + +
- Statistic - # Telegrams - + Statistic + # Telegrams - + (Rx) Received telegrams {data.rx_received} - + (Rx) Incomplete telegrams {data.crc_errors} - + (Tx) Successfully sent telegrams {data.tx_sent} - + (Tx) Send Errors {data.tx_errors}
-
+ + {this.rxErrors() && ( + + + Note: Having a small number of incomplete Rx telegrams is normal and often caused by noise on the EMS line. + + + )} + + )} - -
); } @@ -99,11 +126,7 @@ class EMSESPStatusForm extends Component { {this.createListItems()} } - variant="contained" - color="secondary" - onClick={this.props.loadData} - > + startIcon={} variant="contained" color="secondary" onClick={this.props.loadData}> Refresh @@ -112,4 +135,4 @@ class EMSESPStatusForm extends Component { } } -export default withTheme(EMSESPStatusForm); +export default withTheme(withWidth()(EMSESPStatusForm));