From 92548191e4cfa34179a526b9e15da4583be4baf1 Mon Sep 17 00:00:00 2001 From: Igor Date: Tue, 10 Dec 2019 18:31:55 -0300 Subject: [PATCH] =?UTF-8?q?refactor:=20=F0=9F=92=A1=20Remove=20LabellingMa?= =?UTF-8?q?nager=20and=20Clean=20LabellingFlow?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Migrate logic from LabellingManager to LabellingFlow and cleanup LabellingFlow component Closes: #1267 --- .../src/components/Labelling/LabellingFlow.js | 31 +++++++++---------- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/platform/viewer/src/components/Labelling/LabellingFlow.js b/platform/viewer/src/components/Labelling/LabellingFlow.js index d516b3173..c2749431e 100644 --- a/platform/viewer/src/components/Labelling/LabellingFlow.js +++ b/platform/viewer/src/components/Labelling/LabellingFlow.js @@ -27,26 +27,25 @@ const LabellingFlow = ({ skipAddLabelButton, }); - const initialItems = OHIFLabellingData; - const currentItems = cloneDeep(initialItems); - useEffect(() => { - const treatMeasurementData = measurementData => { - if (editDescription) { - measurementData.description = undefined; - } - - if (editLocation) { - measurementData.location = undefined; - } - }; - const newMeasurementData = cloneDeep(measurementData); - treatMeasurementData(newMeasurementData); + + if (editDescription) { + newMeasurementData.description = undefined; + } + + if (editLocation) { + newMeasurementData.location = undefined; + } + + let newEditLocation = editLocation; + if (!editDescription && !editLocation) { + newEditLocation = true; + } setState(state => ({ ...state, - editLocation: !editDescription && !editLocation, + editLocation: newEditLocation, measurementData: newMeasurementData, })); }, [editDescription, editLocation, measurementData]); @@ -151,7 +150,7 @@ const LabellingFlow = ({ if (editLocation) { return (