Skip to content

Commit

Permalink
Ternary operator for colors
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchfrauenheim committed Oct 10, 2023
1 parent 5498104 commit 4777eaf
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
4 changes: 1 addition & 3 deletions src/components/home/queryresults/value/Value.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,8 @@ function Value(props) {
if (pvSeverity !== undefined) {
if (pvSeverity === "NONE") {
textColor = colors.SEV_COLORS["OK"];
} else if (pvSeverity in colors.SEV_COLORS) {
textColor = colors.SEV_COLORS[pvSeverity];
} else {
textColor = "#000"
textColor = pvSeverity in colors.SEV_COLORS ? colors.SEV_COLORS[pvSeverity] : "#000";
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/components/pv/valuetable/ValueTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,11 +156,7 @@ function ValueTable(props) {
if (message.severity === "NONE") {
setAlarmColor(colors.SEV_COLORS["OK"]);
} else if (message.severity !== "") {
if (message.severity in colors.SEV_COLORS) {
setAlarmColor(colors.SEV_COLORS[message.severity]);
} else {
setAlarmColor("#000")
}
message.severity in colors.SEV_COLORS ? setAlarmColor(colors.SEV_COLORS[message.severity]) : setAlarmColor("#000");
}
if (!props.snapshot) {
setPVSeverity(message.severity);
Expand Down

0 comments on commit 4777eaf

Please sign in to comment.