diff options
-rw-r--r-- | modern/src/DevicesList.js | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/modern/src/DevicesList.js b/modern/src/DevicesList.js index fb89260..7a60e8e 100644 --- a/modern/src/DevicesList.js +++ b/modern/src/DevicesList.js @@ -117,6 +117,17 @@ const DeviceRow = ({ data, index, style }) => { return null; } + const getPositionLock = (pos) => { + if (pos) { + if (pos.attributes.output !== undefined) { + return pos.attributes.output === 1; + } else if (pos.attributes.out1 !== undefined) { + return pos.attributes.out1; + } + } + return null; + } + return ( <div style={style}> <ListItem button key={item.id} className={classes.listItem} onClick={() => { @@ -135,10 +146,10 @@ const DeviceRow = ({ data, index, style }) => { <ListItemText primary={ <Typography noWrap> <FiberManualRecordIcon fontSize="inherit" color={statusColor()} classes={{ colorPrimary: classes.green }} /> - {position && position.attributes.out1 == false && ( + {getPositionLock(position) === false && ( <LockOpenIcon fontSize="inherit" color="primary" classes={{ colorPrimary: classes.green }} /> )} - {position && position.attributes.out1 == true && ( + {getPositionLock(position) === true && ( <LockIcon fontSize="inherit" color="error" /> )} {` ${item.name}`} |