mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-07 16:29:51 +03:00
refactor device value rendering (to Web, Console or MQTT) to base class #632
This commit is contained in:
@@ -342,13 +342,13 @@ class EMSESPDevicesForm extends Component<
|
||||
<TableHead></TableHead>
|
||||
<TableBody>
|
||||
{deviceData.data.map((item, i) => {
|
||||
if (i % 2) {
|
||||
if (i % 3) {
|
||||
return null;
|
||||
} else {
|
||||
return (
|
||||
<TableRow key={i}>
|
||||
<TableCell component="th" scope="row">{deviceData.data[i]}</TableCell>
|
||||
<TableCell align="right">{deviceData.data[i + 1]}</TableCell>
|
||||
<TableCell component="th" scope="row">{deviceData.data[i+2]}</TableCell>
|
||||
<TableCell align="right">{deviceData.data[i]}{deviceData.data[i + 1]}</TableCell>
|
||||
</TableRow>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,30 +60,16 @@ class EMSESPStatusForm extends Component<EMSESPStatusFormProps> {
|
||||
<TableBody>
|
||||
<TableRow>
|
||||
<TableCell>
|
||||
Received telegrams
|
||||
# Telegrams Received
|
||||
</TableCell>
|
||||
<TableCell align="right">{formatNumber(data.rx_received)}
|
||||
<TableCell align="right">{formatNumber(data.rx_received)} ({data.rx_quality}%)
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell >
|
||||
Rx line quality
|
||||
</TableCell>
|
||||
<TableCell align="right">{data.rx_quality} %
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell >
|
||||
Sent telegrams
|
||||
# Telegrams Sent
|
||||
</TableCell >
|
||||
<TableCell align="right">{formatNumber(data.tx_sent)}
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
<TableRow>
|
||||
<TableCell >
|
||||
Tx line quality
|
||||
</TableCell>
|
||||
<TableCell align="right">{data.tx_quality} %
|
||||
<TableCell align="right">{formatNumber(data.tx_sent)} ({data.tx_quality}%)
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
</TableBody>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Redirect, Switch } from 'react-router';
|
||||
|
||||
import { AuthenticatedRoute } from '../authentication';
|
||||
|
||||
import EMSESP from './EMSESP';
|
||||
import EMSESPDashboard from './EMSESPDashboard';
|
||||
import EMSESPSettings from './EMSESPSettings';
|
||||
|
||||
class ProjectRouting extends Component {
|
||||
@@ -11,9 +11,9 @@ class ProjectRouting extends Component {
|
||||
render() {
|
||||
return (
|
||||
<Switch>
|
||||
<AuthenticatedRoute exact path="/ems-esp/status/*" component={EMSESP} />
|
||||
<AuthenticatedRoute exact path="/ems-esp/status/*" component={EMSESPDashboard} />
|
||||
<AuthenticatedRoute exact path="/ems-esp/settings" component={EMSESPSettings} />
|
||||
<AuthenticatedRoute exact path="/ems-esp/*" component={EMSESP} />
|
||||
<AuthenticatedRoute exact path="/ems-esp/*" component={EMSESPDashboard} />
|
||||
{
|
||||
/*
|
||||
* The redirect below caters for the default project route and redirecting invalid paths.
|
||||
|
||||
Reference in New Issue
Block a user