refactor: 💡 Remove LabellingManager and Clean LabellingFlow
Migrate logic from LabellingManager to LabellingFlow and cleanup LabellingFlow component Closes: #1267
This commit is contained in:
parent
68fcaef19a
commit
92548191e4
@ -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"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user