refactor: 💡 Remove LabellingManager and Clean LabellingFlow

Migrate logic from LabellingManager to LabellingFlow and cleanup
LabellingFlow component

Closes: #1267
This commit is contained in:
Igor 2019-12-10 18:31:55 -03:00
parent 68fcaef19a
commit 92548191e4

View File

@ -27,26 +27,25 @@ const LabellingFlow = ({
skipAddLabelButton, skipAddLabelButton,
}); });
const initialItems = OHIFLabellingData;
const currentItems = cloneDeep(initialItems);
useEffect(() => { useEffect(() => {
const treatMeasurementData = measurementData => { const newMeasurementData = cloneDeep(measurementData);
if (editDescription) { if (editDescription) {
measurementData.description = undefined; newMeasurementData.description = undefined;
} }
if (editLocation) { if (editLocation) {
measurementData.location = undefined; newMeasurementData.location = undefined;
} }
};
const newMeasurementData = cloneDeep(measurementData); let newEditLocation = editLocation;
treatMeasurementData(newMeasurementData); if (!editDescription && !editLocation) {
newEditLocation = true;
}
setState(state => ({ setState(state => ({
...state, ...state,
editLocation: !editDescription && !editLocation, editLocation: newEditLocation,
measurementData: newMeasurementData, measurementData: newMeasurementData,
})); }));
}, [editDescription, editLocation, measurementData]); }, [editDescription, editLocation, measurementData]);
@ -151,7 +150,7 @@ const LabellingFlow = ({
if (editLocation) { if (editLocation) {
return ( return (
<SelectTree <SelectTree
items={currentItems} items={OHIFLabellingData}
columns={1} columns={1}
onSelected={selectTreeSelectCallback} onSelected={selectTreeSelectCallback}
selectTreeFirstTitle="Assign Label" selectTreeFirstTitle="Assign Label"