diff --git a/interface/src/project/EMSESPDataForm.tsx b/interface/src/project/EMSESPDataForm.tsx index 9c3b40d25..7f9f0d5c4 100644 --- a/interface/src/project/EMSESPDataForm.tsx +++ b/interface/src/project/EMSESPDataForm.tsx @@ -219,7 +219,9 @@ class EMSESPDataForm extends Component< }; sendCommand = (dv: DeviceValue) => { - this.setState({ edit_devicevalue: dv }); + if (dv.c && this.props.authenticatedContext.me.admin) { + this.setState({ edit_devicevalue: dv }); + } }; handleSensorChange = (name: keyof Sensor) => ( @@ -285,7 +287,9 @@ class EMSESPDataForm extends Component< }; sendSensor = (sn: Sensor) => { - this.setState({ edit_Sensor: sn }); + if (this.props.authenticatedContext.me.admin) { + this.setState({ edit_Sensor: sn }); + } }; noDevices = () => { @@ -391,7 +395,11 @@ class EMSESPDataForm extends Component< {data.sensors.map((sensorData) => ( - + this.sendSensor(sensorData)} + > {me.admin && ( @@ -553,7 +561,6 @@ class EMSESPDataForm extends Component< renderDeviceData() { const { deviceData } = this.state; const { width } = this.props; - const me = this.props.authenticatedContext.me; if (this.noDevices()) { return; @@ -580,9 +587,13 @@ class EMSESPDataForm extends Component< {deviceData.data.map((item, i) => ( - + this.sendCommand(item)} + > - {item.c && me.admin && ( + {item.c && this.props.authenticatedContext.me.admin && ( (event: React.ChangeEvent) => void; } +function formatValue(value: any, uom: number) { + if (uom === DeviceValueUOM.DEGREES) { + return new Intl.NumberFormat(undefined, { + minimumFractionDigits: 1 + }).format(value); + } + + return value; +} + class ValueForm extends React.Component { formRef: RefObject = React.createRef(); @@ -69,7 +79,7 @@ class ValueForm extends React.Component { {!devicevalue.l && (