Skip to content

Commit 1b1afcb

Browse files
authored
fix: Start button disabled incorrectly (#1090)
1 parent e62c334 commit 1b1afcb

File tree

2 files changed

+57
-2
lines changed

2 files changed

+57
-2
lines changed

web_ui/src/pages/project-details/components/project-models/train-model-dialog/train-model-dialog.test.tsx

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -790,7 +790,46 @@ describe('Train model dialog', () => {
790790
key: 'dataset_size',
791791
}),
792792
],
793-
augmentation: {},
793+
augmentation: {
794+
tiling: [
795+
getMockedConfigurationParameter({
796+
key: 'enable',
797+
type: 'bool',
798+
name: 'Enable tiling',
799+
value: false,
800+
description: 'Whether to apply tiling to the image',
801+
defaultValue: false,
802+
}),
803+
getMockedConfigurationParameter({
804+
key: 'adaptive_tiling',
805+
type: 'bool',
806+
name: 'Adaptive tiling',
807+
value: true,
808+
description: 'Whether to use adaptive tiling based on image content',
809+
defaultValue: true,
810+
}),
811+
getMockedConfigurationParameter({
812+
key: 'tile_size',
813+
type: 'int',
814+
name: 'Tile size',
815+
value: 400,
816+
description: 'Size of each tile in pixels',
817+
defaultValue: 400,
818+
maxValue: null,
819+
minValue: 0,
820+
}),
821+
getMockedConfigurationParameter({
822+
key: 'tile_overlap',
823+
type: 'float',
824+
name: 'Tile overlap',
825+
value: 0.2,
826+
description: 'Overlap between adjacent tiles as a fraction of tile size',
827+
defaultValue: 0.2,
828+
maxValue: 1,
829+
minValue: 0,
830+
}),
831+
],
832+
},
794833
filtering: {},
795834
},
796835
})
@@ -810,6 +849,13 @@ describe('Train model dialog', () => {
810849

811850
fireEvent.click(screen.getByRole('tab', { name: /data management/i }));
812851

852+
expect(screen.getByRole('heading', { name: /Tiling/ })).toBeInTheDocument();
853+
854+
fireEvent.click(screen.getByRole('button', { name: 'Off' }));
855+
856+
expect(screen.getByRole('button', { name: 'Off' })).toHaveAttribute('aria-pressed', 'true');
857+
expect(screen.getByRole('button', { name: /start/i })).toBeEnabled();
858+
813859
expect(screen.getByRole('heading', { name: /Training subsets/ })).toBeInTheDocument();
814860

815861
fireEvent.keyDown(screen.getByLabelText('Start range'), { key: 'Left' });

web_ui/src/pages/project-details/components/project-models/train-model-dialog/use-train-model-state.hook.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,16 @@ export const useTrainModelState = () => {
302302
return false;
303303
}
304304

305-
return !areSubsetsSizesValid(trainingConfiguration.datasetPreparation.subsetSplit);
305+
if (
306+
!isEqual(
307+
trainingConfiguration.datasetPreparation.subsetSplit,
308+
defaultTrainingConfiguration.datasetPreparation.subsetSplit
309+
)
310+
) {
311+
return !areSubsetsSizesValid(trainingConfiguration.datasetPreparation.subsetSplit);
312+
}
313+
314+
return false;
306315
};
307316

308317
return {

0 commit comments

Comments
 (0)