Fixed bugs in warnings and alarms representation (front end)

This commit is contained in:
Noe 2024-06-03 13:16:09 +02:00
parent 41318805e5
commit 42ba224603
3 changed files with 125 additions and 5 deletions

View File

@ -375,6 +375,112 @@ function BatteryView(props: BatteryViewProps) {
</TableCell> </TableCell>
</> </>
)} )}
{props.productNum === 1 && (
<>
<TableCell
style={{
width: '20%',
textAlign: 'center',
padding: '8px',
fontWeight:
Number(battery.Warnings.value) !== 0
? 'bold'
: 'inherit',
backgroundColor:
Number(battery.Warnings.value) === 0
? 'inherit'
: '#ff9900',
color:
Number(battery.Warnings.value) != 0
? 'black'
: 'inherit'
}}
>
{Number(battery.Warnings.value) === 0 ? (
'None'
) : Number(battery.Warnings.value) === 1 ? (
<Link
style={{ color: 'black' }}
to={
currentLocation.pathname.substring(
0,
currentLocation.pathname.lastIndexOf('/') + 1
) +
routes.log +
'?open=warning'
}
>
New Warning
</Link>
) : (
<Link
style={{ color: 'black' }}
to={
currentLocation.pathname.substring(
0,
currentLocation.pathname.lastIndexOf('/') + 1
) +
routes.log +
'?open=warning'
}
>
Multiple Warnings
</Link>
)}
</TableCell>
<TableCell
sx={{
width: '20%',
textAlign: 'center',
fontWeight:
Number(battery.Alarms.value) !== 0
? 'bold'
: 'inherit',
backgroundColor:
Number(battery.Alarms.value) === 0
? 'inherit'
: '#FF033E',
color:
Number(battery.Alarms.value) != 0
? 'black'
: 'inherit'
}}
>
{Number(battery.Alarms.value) === 0 ? (
'None'
) : Number(battery.Alarms.value) === 1 ? (
<Link
style={{ color: 'black' }}
to={
currentLocation.pathname.substring(
0,
currentLocation.pathname.lastIndexOf('/') + 1
) +
routes.log +
'?open=error'
}
>
New Alarm
</Link>
) : (
<Link
style={{ color: 'black' }}
to={
currentLocation.pathname.substring(
0,
currentLocation.pathname.lastIndexOf('/') + 1
) +
routes.log +
'?open=error'
}
>
Multiple Alarms
</Link>
)}
</TableCell>
</>
)}
</TableRow> </TableRow>
))} ))}
</TableBody> </TableBody>

View File

@ -335,7 +335,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
...batteryStringStyle, ...batteryStringStyle,
backgroundColor: backgroundColor:
props.batteryData.String1Active.value == 'True' || props.batteryData.String1Active.value == 'True' ||
props.batteryData.String4Active.value == 0 Number(props.batteryData.String1Active.value) == 0
? '#32CD32' ? '#32CD32'
: '#FF033E' : '#FF033E'
}} }}
@ -345,7 +345,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
...batteryStringStyle, ...batteryStringStyle,
backgroundColor: backgroundColor:
props.batteryData.String2Active.value == 'True' || props.batteryData.String2Active.value == 'True' ||
props.batteryData.String4Active.value == 0 Number(props.batteryData.String2Active.value) == 0
? '#32CD32' ? '#32CD32'
: '#FF033E' : '#FF033E'
}} }}
@ -355,7 +355,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
...batteryStringStyle, ...batteryStringStyle,
backgroundColor: backgroundColor:
props.batteryData.String3Active.value == 'True' || props.batteryData.String3Active.value == 'True' ||
props.batteryData.String4Active.value == 0 Number(props.batteryData.String3Active.value) == 0
? '#32CD32' ? '#32CD32'
: '#FF033E' : '#FF033E'
}} }}
@ -365,7 +365,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
...batteryStringStyle, ...batteryStringStyle,
backgroundColor: backgroundColor:
props.batteryData.String4Active.value == 'True' || props.batteryData.String4Active.value == 'True' ||
props.batteryData.String4Active.value == 0 Number(props.batteryData.String4Active.value) == 0
? '#32CD32' ? '#32CD32'
: '#FF033E' : '#FF033E'
}} }}
@ -375,7 +375,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
...batteryStringStyle, ...batteryStringStyle,
backgroundColor: backgroundColor:
props.batteryData.String5Active.value == 'True' || props.batteryData.String5Active.value == 'True' ||
props.batteryData.String4Active.value == 0 Number(props.batteryData.String5Active.value) == 0
? '#32CD32' ? '#32CD32'
: '#FF033E' : '#FF033E'
}} }}
@ -639,6 +639,7 @@ function DetailedBatteryView(props: DetailedBatteryViewProps) {
</Card> </Card>
</Grid> </Grid>
{/*----------------------------------------------------------------------------------------------------------------------------------*/} {/*----------------------------------------------------------------------------------------------------------------------------------*/}
{props.productNum === 0 && ( {props.productNum === 0 && (
<> <>
<Grid item md={3} xs={3}> <Grid item md={3} xs={3}>

View File

@ -275,6 +275,19 @@ function InformationSalidomo(props: InformationSalidomoProps) {
/> />
</div> </div>
{/*<div>*/}
{/* <TextField*/}
{/* label={*/}
{/* <FormattedMessage id="vrmLink" defaultMessage="vrmLink" />*/}
{/* }*/}
{/* name="vrmLink"*/}
{/* value={formValues.vrmLink}*/}
{/* onChange={handleChange}*/}
{/* variant="outlined"*/}
{/* fullWidth*/}
{/* />*/}
{/*</div>*/}
<div> <div>
<TextField <TextField
label="S3 Bucket Name" label="S3 Bucket Name"