diff --git a/client/src/ConfigureImageClassification/index.jsx b/client/src/ConfigureImageClassification/index.jsx index 0f07672..bc20d78 100644 --- a/client/src/ConfigureImageClassification/index.jsx +++ b/client/src/ConfigureImageClassification/index.jsx @@ -57,14 +57,14 @@ export default ({ config, onChange }) => { const defaultAnswers = useMemo( () => ({ - multipleRegions: Boolean(config.multipleRegions ? config.multipleRegions : true), + multipleRegions: config.multipleRegions ?? false, + multipleRegionLabels: config.multipleRegionLabels ?? false, regionTypesAllowed: config.regionTypesAllowed ? config.regionTypesAllowed : [], - multipleRegionLabels: Boolean(config.multipleRegionLabels ? config.multipleRegionLabels : true), labels: (config.labels || []).map((a) => { return typeof a === "string" ? { id: a, description: a } : a }) || [], - regions: config.regions ? config.regions : "Polygon" + regions: config.regions ?? "Polygon" }), [config.labels, config.multipleRegions] ) diff --git a/client/src/ConfigureImageSegmentation/index.jsx b/client/src/ConfigureImageSegmentation/index.jsx index 69fbfa0..c50acf9 100644 --- a/client/src/ConfigureImageSegmentation/index.jsx +++ b/client/src/ConfigureImageSegmentation/index.jsx @@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next" export default ({ config, onChange }) => { const { t } = useTranslation(); - + const form = { questions: [ { @@ -50,10 +50,8 @@ export default ({ config, onChange }) => { () => asMutable( { - multipleRegions: Boolean( - config.multipleRegions ? config.multipleRegions : true - ), - multipleRegionLabels: Boolean(config.multipleRegionLabels ? config.multipleRegionLabels : true), + multipleRegions: config.multipleRegions ?? false, + multipleRegionLabels: config.multipleRegionLabels ?? false, regionTypesAllowed: config.regionTypesAllowed, labels: (config.labels || []).map((a) => diff --git a/client/src/SetupPage/index.jsx b/client/src/SetupPage/index.jsx index 63034d9..c432db5 100644 --- a/client/src/SetupPage/index.jsx +++ b/client/src/SetupPage/index.jsx @@ -52,18 +52,22 @@ const StyledCardContent = styled(CardContent)(({ theme }) => ({ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotationLab}) => { - const { configuration } = settings; + const { configuration, taskChoice } = settings; const [currentTab, setTab] = useState(false); const [hasConfig, setHasConfig] = useState(false); const settingsConfig = useSettings() + const updateConfiguration = (newConfig) => { - const {labels} = newConfig - setHasConfig(labels.length > 0) + const {labels, regionTypesAllowed, multipleRegionLabels, multipleRegions} = newConfig + setHasConfig(labels?.length > 0) const newSettings = { ...settings, configuration: { ...settings.configuration, - labels + labels, + regionTypesAllowed, + multipleRegionLabels, + multipleRegions } }; settingsConfig.changeSetting('settings',newSettings); @@ -87,9 +91,16 @@ export const SetupPage = ({setConfiguration, settings, setShowLabel, showAnnotat const updateTaskInfo = (newTaskInfo) => { setConfiguration({type: "UPDATE_TASK_INFO", payload: newTaskInfo}) + settings.taskDescription = newTaskInfo.taskDescription; + settings.taskChoice = newTaskInfo.taskChoice; + settingsConfig.changeSetting('settings',settings); } useEffect(() => { + const { labels } = configuration + if (labels.length > 0) { + setHasConfig(true) + } setTab("datatype"); }, []);