From 9dbc6d4d8f49d918e53b12469be83eb0ac8e8ccb Mon Sep 17 00:00:00 2001 From: proddy Date: Tue, 6 Apr 2021 11:18:44 +0200 Subject: [PATCH] device values table reformatting --- interface/src/project/EMSESPDevicesForm.tsx | 87 +++++++++------------ interface/src/security/ManageUsersForm.tsx | 4 +- mock-api/server.js | 4 +- src/emsdevice.cpp | 2 +- src/version.h | 2 +- 5 files changed, 44 insertions(+), 55 deletions(-) diff --git a/interface/src/project/EMSESPDevicesForm.tsx b/interface/src/project/EMSESPDevicesForm.tsx index 914547140..7d3588927 100644 --- a/interface/src/project/EMSESPDevicesForm.tsx +++ b/interface/src/project/EMSESPDevicesForm.tsx @@ -8,6 +8,8 @@ import { import RefreshIcon from "@material-ui/icons/Refresh"; import ListIcon from "@material-ui/icons/List"; +import IconButton from '@material-ui/core/IconButton'; +import EditIcon from '@material-ui/icons/Edit'; import { redirectingAuthorizedFetch, withAuthenticatedContext, AuthenticatedContextProps } from "../authentication"; import { RestFormProps, FormButton } from "../components"; @@ -44,11 +46,10 @@ interface EMSESPDevicesFormState { confirmScanDevices: boolean; processing: boolean; deviceData?: EMSESPDeviceData; + selectedDevice?: number; } -type EMSESPDevicesFormProps = RestFormProps & - AuthenticatedContextProps & - WithWidthProps; +type EMSESPDevicesFormProps = RestFormProps & AuthenticatedContextProps & WithWidthProps; function formatTemp(t: string) { if (t == null) { @@ -67,9 +68,20 @@ function formatUnit(u: string) { class EMSESPDevicesForm extends Component { state: EMSESPDevicesFormState = { confirmScanDevices: false, - processing: false, + processing: false }; + sendCommand = (i: any) => { + const name = this.state.deviceData?.data[i+2]; + const value = this.state.deviceData?.data[i]; + const deviceType = this.state.selectedDevice; + console.log("type: " + deviceType + " name: " + name + " value: " + value); + + // this.setState({ + // user: undefined + // }); + } + noDevices = () => { return this.props.data.devices.length === 0; }; @@ -95,50 +107,26 @@ class EMSESPDevicesForm extends Component - - - Type - Brand - Model - Device ID - Product ID - Version - - - {data.devices.sort(compareDevices).map((device) => ( this.handleRowClick(device.id)} + onClick={() => this.handleRowClick(device)} > - + - {device.brand} - {device.name} - - 0x - {("00" + device.deviceid.toString(16).toUpperCase()).slice( - -2 - )} - - {device.productid} - {device.version} - + {device.brand + " " + device.name} ))} @@ -148,13 +136,10 @@ class EMSESPDevicesForm extends Component - No EMS devices found. Check the connections and for possible Tx - errors. + No EMS devices found. Check the connections and for possible Tx errors. )} @@ -213,8 +198,7 @@ class EMSESPDevicesForm extends Component Confirm Scan Devices - Are you sure you want to initiate a scan on the EMS bus for all new - devices? + Are you sure you want to initiate a scan on the EMS bus for all new devices?