Skip to content

Commit

Permalink
Merge pull request #584 from kbss-cvut/fix/536-distinguish-fault-tree…
Browse files Browse the repository at this point in the history
…s-violating-reuired-failure-rate

Refactor style
  • Loading branch information
kostobog authored Sep 3, 2024
2 parents 02ee0b6 + 59b1aa3 commit bd0903a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ const FaultEventMenu = ({ selectedShapeToolData, onEventUpdated, refreshTree, ro
const violatesRequirement =
shapeToolData?.probability && getRequiredFailureRate() && shapeToolData.probability > getRequiredFailureRate();

const requiredFailureRateStatusColor = violatesRequirement ? theme.main.red : theme.main.black;
const requiredFailureRateStatusColor = violatesRequirement ? theme.requirementViolation.color : theme.main.black;

return (
<Box paddingLeft={2} marginRight={2}>
Expand Down
4 changes: 3 additions & 1 deletion src/components/table/FaultTreeTableBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,9 @@ const FaultTreeTableBody: FC<FaultTreeTableBodyProps> = ({ faultTrees, handleFau
faultTree?.requiredFailureRate &&
faultTree?.calculatedFailureRate &&
faultTree?.calculatedFailureRate > faultTree?.requiredFailureRate;
const violatedRequirementStatusColor = violatedRequirement ? theme.main.red : theme.main.black;
const violatedRequirementStatusColor = violatedRequirement
? theme.requirementViolation.color
: theme.main.black;

const editor = faultTree?.editor || faultTree?.creator;
return (
Expand Down
3 changes: 3 additions & 0 deletions src/styles/App.styles.declarations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ declare module "@mui/material/styles" {
color: COLOR;
};
};
requirementViolation?: {
color: COLOR;
};
}
// allow configuration using `createMuiTheme`
interface DeprecatedThemeOptions {
Expand Down
3 changes: 3 additions & 0 deletions src/styles/App.styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ export const appTheme = createCustomMuiTheme({
synchronized: {
color: "#000000",
},
requirementViolation: {
color: "#FF0000",
},
});

0 comments on commit bd0903a

Please sign in to comment.