Skip to content

Commit

Permalink
fix next button disabled in configuration tab
Browse files Browse the repository at this point in the history
  • Loading branch information
sumn2u committed Jun 22, 2024
1 parent 0c84d8e commit ff965d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
6 changes: 3 additions & 3 deletions client/src/ConfigureImageClassification/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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]
)
Expand Down
8 changes: 3 additions & 5 deletions client/src/ConfigureImageSegmentation/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useTranslation } from "react-i18next"

export default ({ config, onChange }) => {
const { t } = useTranslation();

const form = {
questions: [
{
Expand Down Expand Up @@ -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) =>
Expand Down
19 changes: 15 additions & 4 deletions client/src/SetupPage/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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");
}, []);

Expand Down

0 comments on commit ff965d8

Please sign in to comment.