diff --git a/public/locales/cs/translation.json b/public/locales/cs/translation.json
index 88e7732b..8129e587 100644
--- a/public/locales/cs/translation.json
+++ b/public/locales/cs/translation.json
@@ -112,7 +112,8 @@
},
"faultEventMessage": {
"outOfSyncValue": "Hodnota je zastaralá, intenzita poruch u některých listových uzlů byla aktualizována!",
- "referencedValueOutdated": "Referenční hodnota byla změněna. Hodnota bude aktualizována při vyhodnocení stromu",
+ "referencedValueOutdated": "Referencovaná hodnota byla změněna na {{newValue}}. Tuto hodnotu lze aktualizovat pomocí akce přepočítaní intenzity poruch.",
+ "predictedFailureRateOutdated": "Referencovaná hodnota byla změněna na {{newValue}}. Tuto hodnotu lze aktualizovat pomocí akce přepočítaní intenzity poruch.",
"experimental": "Min. provozní hodiny (MOH) poruchoveho stromu se liší od MOH jeho systému",
"requirementViolated": "Vypočtená intenzita poruch je větší, než je požadováno!"
},
diff --git a/public/locales/en/translation.json b/public/locales/en/translation.json
index 727775bd..fcb22c17 100644
--- a/public/locales/en/translation.json
+++ b/public/locales/en/translation.json
@@ -112,7 +112,8 @@
},
"faultEventMessage": {
"outOfSyncValue": "The value is outdated, some of the leaf node failure rates were updated!",
- "referencedValueOutdated": "The referenced value has changed. The value will be updated on tree evaluation.",
+ "referencedValueOutdated": "The referenced value has changed to {{newValue}}. The value can be updated with action to recalculate failure rate.",
+ "predictedFailureRateOutdated": "The referenced value has changed to {{newValue}}. The value can be updated with action to recalculate failure rate.",
"experimental": "Fault tree's min. operational hours (MOH) is different from its system's MOH",
"requirementViolated": "Calculated failure rate is bigger than required!"
},
diff --git a/src/components/editor/faultTree/menu/faultEvent/FaultEventMenu.tsx b/src/components/editor/faultTree/menu/faultEvent/FaultEventMenu.tsx
index 529db999..fc89150a 100644
--- a/src/components/editor/faultTree/menu/faultEvent/FaultEventMenu.tsx
+++ b/src/components/editor/faultTree/menu/faultEvent/FaultEventMenu.tsx
@@ -30,7 +30,7 @@ import UnsavedChangesDialog from "./UnsavedChangesDialog";
import { useAppBar } from "@contexts/AppBarContext";
import { syncProblemIcon, warnIcon } from "@components/Icons";
import HintText from "@components/hintText/HintText";
-import { calculationStatusMessages } from "@components/fta/FTAStatus";
+import { statusMessages } from "@components/fta/FTAStatus";
import { FaultTreeStatus } from "@models/faultTreeModel";
interface Props {
@@ -305,74 +305,69 @@ const FaultEventMenu = ({
);
};
- const numberValue = (value, cls = classes.notEditableValue) => {
+ const numberValue = (value) => {
return {value}}>{value.toExponential(2)};
};
- const requiredFailureRateComponent = (failureRate, requirementStatusColor, violates) => {
+ const requiredFailureRateComponent = (failureRate, violates) => {
const cls = violates ? classes.violated : classes.notEditableValue;
return (
{propertyLabelWithHint("eventDescription.requiredFailureRate")}
{numberValue(failureRate)}
- {violates &&
- warnIcon(calculationStatusMessages("faultEventMessage.requirementViolated", t), requirementStatusColor)}
+ {violates && warnIcon(statusMessages(t("faultEventMessage.requirementViolated")))}
);
};
- const failureRateComponent = (failureRate, failureRateCode, statusCodes: string[] = []) => {
- const isOutOfSync = statusCodes && statusCodes.length > 0;
+ const failureRateComponent = (failureRate, failureRateCode, statusMessages: string[] = []) => {
+ const _statusMessages = asArray(statusMessages);
+ const isOutOfSync = _statusMessages && _statusMessages.length > 0;
const cls = isOutOfSync ? classes.outdated : classes.notEditableValue;
return (
{propertyLabelWithHint(failureRateCode)}
{numberValue(failureRate)}
- {isOutOfSync && syncProblemIcon(calculationStatusMessages(statusCodes, t), statusCodes.length)}
+ {isOutOfSync && syncProblemIcon(statusMessages(_statusMessages), _statusMessages.length)}
);
};
- const fhaFailureRateComponent = (failureRate, failureRateStatusColor, faultTreeStatus: FaultTreeStatus) => {
- return failureRateComponent(
- failureRate,
- "eventDescription.fhaBasedFailureRate",
- failureRateStatusColor,
- faultTreeStatus,
- );
+ const fhaFailureRateComponent = (failureRate) => {
+ return failureRateComponent(failureRate, "eventDescription.fhaBasedFailureRate", null);
};
- const calculatedFailureRateComponent = (failureRate, failureRateStatusColor, statusCodes: string[]) => {
- return failureRateComponent(failureRate, "eventDescription.calculatedFailureRate", statusCodes);
+ const calculatedFailureRateComponent = (failureRate, failureRateStatusColor, statusMessages: string[]) => {
+ return failureRateComponent(failureRate, "eventDescription.calculatedFailureRate", statusMessages);
};
- const FailureRateBox = ({ value, failureRateKey, rate, selected, outdated }) => (
-
- }
- label={propertyLabelWithHint(failureRateKey)}
- className={selected ? classes.selected : classes.notSelected}
- />
- {rate}}>
-
- {rate.toExponential(2)}
-
-
-
- );
+ const FailureRateBox = ({ value, failureRateKey, rate, selected, outdated, messageCode, newValue }) => {
+ const cls = outdated ? classes.outdated : classes.notEditableValue;
+
+ return (
+
+ }
+ label={propertyLabelWithHint(failureRateKey)}
+ className={selected ? classes.selected : classes.notSelected}
+ />
+
+ {numberValue(rate)}
+ {outdated && syncProblemIcon(statusMessages(t(messageCode, { newValue: newValue })), 1)}
+
+
+ );
+ };
- const renderFailureRateBox = (rateType, rateValue, iri, selectedRadioButton, failureRateKey) => {
- const rate =
- shapeToolData.probability !== rateValue && shapeToolData?.selectedEstimate?.iri === iri
- ? shapeToolData.probability
- : rateValue;
+ const renderFailureRateBox = (rateType, rateValue, iri, selectedRadioButton, failureRateKey, messageCode) => {
const selected = selectedRadioButton === rateType;
- const outdated = selected && shapeToolData.probability !== rateValue;
+ const outdated = shapeToolData.probability !== rateValue && shapeToolData?.selectedEstimate?.iri === iri;
+ const rate = outdated ? shapeToolData.probability : rateValue;
return (
);
};
@@ -388,8 +385,6 @@ const FaultEventMenu = ({
const violatesRequirement =
shapeToolData?.probability && getRequiredFailureRate() && shapeToolData.probability > getRequiredFailureRate();
- const requiredFailureRateStatusColor = violatesRequirement ? theme.requirementViolation.color : theme.main.black;
-
const calculatedFailureRateStatusColor = faultTreeStatus.isOk ? theme.main.black : theme.notSynchronized.color;
return (
@@ -408,14 +403,13 @@ const FaultEventMenu = ({
{calculatedFailureRateComponent(
shapeToolData.probability,
calculatedFailureRateStatusColor,
- faultTreeStatus.statusCodes,
+ asArray(faultTreeStatus.statusCodes).map((c) => t(c)),
)}
)}
- {getRequiredFailureRate() &&
- requiredFailureRateComponent(getRequiredFailureRate(), requiredFailureRateStatusColor, violatesRequirement)}
+ {getRequiredFailureRate() && requiredFailureRateComponent(getRequiredFailureRate(), violatesRequirement)}
{(frEstimate?.value || frEstimate?.value === 0) && (
- {fhaFailureRateComponent(frEstimate.value, null, null)}
+ {fhaFailureRateComponent(frEstimate.value)}
)}
>
)}
@@ -428,12 +422,17 @@ const FaultEventMenu = ({
{calculatedFailureRateComponent(
shapeToolData.probability,
null,
- isReferenceProbabilityOutdated(shapeToolData) ? ["faultEventMessage.referencedValueOutdated"] : [],
+ isReferenceProbabilityOutdated(shapeToolData)
+ ? [
+ t("faultEventMessage.referencedValueOutdated", {
+ newValue: shapeToolData?.references?.probability,
+ }),
+ ]
+ : [],
)}
)}
- {getRequiredFailureRate() &&
- requiredFailureRateComponent(getRequiredFailureRate(), requiredFailureRateStatusColor, violatesRequirement)}
+ {getRequiredFailureRate() && requiredFailureRateComponent(getRequiredFailureRate(), violatesRequirement)}
{(frEstimate?.value || frEstimate?.value) && (
{fhaFailureRateComponent(frEstimate.value, null, null)}
)}
@@ -463,6 +462,7 @@ const FaultEventMenu = ({
frPrediction?.iri,
selectedRadioButton,
"eventDescription.predictedFailureRate",
+ "faultEventMessage.referencedValueOutdated",
)}
{snsOperationalFailureRate &&
renderFailureRateBox(
@@ -471,6 +471,7 @@ const FaultEventMenu = ({
frEstimate?.iri,
selectedRadioButton,
"eventDescription.operationalFailureRate",
+ "faultEventMessage.predictedFailureRateOutdated",
)}
- {ataNames.map((n) => {
+ {ataNames?.map((n) => {
return {n}
;
})}
diff --git a/src/components/fta/FTAStatus.tsx b/src/components/fta/FTAStatus.tsx
index 741bd993..53dbbeac 100644
--- a/src/components/fta/FTAStatus.tsx
+++ b/src/components/fta/FTAStatus.tsx
@@ -2,17 +2,17 @@ import * as React from "react";
import { asArray } from "@utils/utils";
import { Typography } from "@mui/material";
-export const calculationStatusMessages = (statusCodes: string[], t: any) => {
- const _statusCodes = asArray(statusCodes);
- return _statusCodes.length > 1 ? (
+export const statusMessages = (statusMessages: string | string[]) => {
+ const _statusMessages = asArray(statusMessages);
+ return _statusMessages.length > 1 ? (
- {_statusCodes.map((c) => (
- - {t(c)}
+ {_statusMessages.map((c) => (
+ - {c}
))}
- ) : _statusCodes.length == 1 ? (
+ ) : _statusMessages.length == 1 ? (
- {t(_statusCodes[0])}
+ {_statusMessages[0]}
) : null;
};
diff --git a/src/components/hintText/HintText.tsx b/src/components/hintText/HintText.tsx
index 8b0e6e6f..554650b4 100644
--- a/src/components/hintText/HintText.tsx
+++ b/src/components/hintText/HintText.tsx
@@ -4,7 +4,6 @@ import useStyles from "./HintText.styles";
import { HelpOutline } from "@mui/icons-material";
interface HintTextProps {
- text: string;
hint: string;
}
diff --git a/src/components/table/FaultTreeTableBody.tsx b/src/components/table/FaultTreeTableBody.tsx
index e6f6ca8d..f7ffc1db 100644
--- a/src/components/table/FaultTreeTableBody.tsx
+++ b/src/components/table/FaultTreeTableBody.tsx
@@ -7,11 +7,11 @@ import useStyles from "./FaultTreeOverviewTable.styles";
import { FaultTree, getFaultTreeCalculationStatus } from "@models/faultTreeModel";
import { extractFragment } from "@services/utils/uriIdentifierUtils";
import { asArray, findByIri, formatDate } from "@utils/utils";
-import { ROUTES, Status } from "@utils/constants";
+import { ROUTES } from "@utils/constants";
import { useSelectedSystemSummaries } from "@hooks/useSelectedSystemSummaries";
import { useSystems } from "@hooks/useSystems";
import { syncProblemIcon, warnIcon } from "@components/Icons";
-import { calculationStatusMessages } from "@components/fta/FTAStatus";
+import { statusMessages } from "@components/fta/FTAStatus";
interface FaultTreeTableBodyProps {
faultTrees: FaultTree[];
@@ -86,7 +86,7 @@ const FaultTreeTableBody: FC = ({ faultTrees, handleFau
!calculationStatus.isOk &&
faultTree?.calculatedFailureRate &&
syncProblemIcon(
- calculationStatusMessages(calculationStatus.statusCodes, t),
+ statusMessages(calculationStatus.statusCodes?.map((c) => t(c))),
calculationStatus.statusCodes?.length,
),
)}
@@ -95,8 +95,7 @@ const FaultTreeTableBody: FC = ({ faultTrees, handleFau
{failureRate(
faultTree?.requiredFailureRate,
- violatedRequirement &&
- warnIcon(calculationStatusMessages(["faultEventMessage.requirementViolated"], t)),
+ violatedRequirement && warnIcon(statusMessages(t("faultEventMessage.requirementViolated"))),
)}
{formatDate(faultTree?.modified)}