diff --git a/src/components/editor/faultTree/Editor.tsx b/src/components/editor/faultTree/Editor.tsx index 3d31424f..89f3d088 100644 --- a/src/components/editor/faultTree/Editor.tsx +++ b/src/components/editor/faultTree/Editor.tsx @@ -176,13 +176,7 @@ const Editor = () => { const handleCutSetAnalysis = () => { setShowPath(!showPath); setShowTable(!showTable); - calculateCutSets(faultTree.iri, faultTree.operationalDataFilter) - .then((d) => { - refreshTree(); - }) - .catch((reason) => { - showSnackbar(reason, SnackbarType.ERROR); - }); + refreshTree(); }; const [failureModesTableOpen, setFailureModesTableOpen] = useState(false); diff --git a/src/components/editor/faultTree/canvas/EditorCanvas.tsx b/src/components/editor/faultTree/canvas/EditorCanvas.tsx index 53b33b8e..424c4772 100644 --- a/src/components/editor/faultTree/canvas/EditorCanvas.tsx +++ b/src/components/editor/faultTree/canvas/EditorCanvas.tsx @@ -23,6 +23,8 @@ import RestartAltIcon from "@mui/icons-material/RestartAlt"; import PlayArrow from "@mui/icons-material/PlayArrow"; import { useCurrentFaultTree } from "@hooks/useCurrentFaultTree"; import { useFaultTrees } from "@hooks/useFaultTrees"; +import { calculateCutSets } from "@services/faultTreeService"; +import { SnackbarType, useSnackbar } from "@hooks/useSnackbar"; enum MOVE_NODE { DRAGGING = 0, @@ -89,6 +91,7 @@ const EditorCanvas = ({ const [, , updateTree] = useFaultTrees(); const [updatedMinOperationalHours, setUpdatedMinOperationalHours] = useState(initialMinOperationalHours); const [inputColor, setInputColor] = useState(""); + const [showSnackbar] = useSnackbar(); let dragStartPosition = null; @@ -286,10 +289,14 @@ const EditorCanvas = ({ }; const handleSetNewDefaultOperationalHours = () => { - updateTree({ - ...faultTree, - operationalDataFilter: { ...faultTree.operationalDataFilter, minOperationalHours: updatedMinOperationalHours }, - }); + calculateCutSets(faultTree.iri, faultTree.operationalDataFilter) + .then((d) => { + refreshTree(); + }) + .catch((reason) => { + showSnackbar(reason, SnackbarType.ERROR); + }); + setInputColor(theme.synchronized.color); };