diff --git a/frontend/src/app/providers/models-provider.tsx b/frontend/src/app/providers/models-provider.tsx index 7047744a..1ae1b717 100644 --- a/frontend/src/app/providers/models-provider.tsx +++ b/frontend/src/app/providers/models-provider.tsx @@ -222,8 +222,8 @@ const ModelsContext = createContext<{ validateEditMode: boolean; }>({ formData: initialFormState, - setFormData: () => { }, - handleChange: () => { }, + setFormData: () => {}, + handleChange: () => {}, createNewTrainingDatasetMutation: {} as UseMutationResult< TTrainingDataset, Error, @@ -238,13 +238,13 @@ const ModelsContext = createContext<{ >, hasLabeledTrainingAreas: false, hasAOIsWithGeometry: false, - resetState: () => { }, + resetState: () => {}, isEditMode: false, modelId: "", getFullPath: () => "", - handleModelCreationAndUpdate: () => { }, + handleModelCreationAndUpdate: () => {}, trainingDatasetCreationInProgress: false, - handleTrainingDatasetCreation: () => { }, + handleTrainingDatasetCreation: () => {}, validateEditMode: false, }); @@ -306,8 +306,11 @@ export const ModelsProvider: React.FC<{ } handleChange(MODEL_CREATION_FORM_NAME.BASE_MODELS, data.base_model); - handleChange(MODEL_CREATION_FORM_NAME.MODEL_DESCRIPTION, data.description ?? ''); - handleChange(MODEL_CREATION_FORM_NAME.MODEL_NAME, data.name ?? ''); + handleChange( + MODEL_CREATION_FORM_NAME.MODEL_DESCRIPTION, + data.description ?? "", + ); + handleChange(MODEL_CREATION_FORM_NAME.MODEL_NAME, data.name ?? ""); handleChange( MODEL_CREATION_FORM_NAME.SELECTED_TRAINING_DATASET_ID, data.dataset, @@ -318,10 +321,13 @@ export const ModelsProvider: React.FC<{ useEffect(() => { if (!isEditMode || trainingDatasetIsPending || trainingDatasetIsError) return; - handleChange(MODEL_CREATION_FORM_NAME.DATASET_NAME, trainingDataset.name ?? ''); + handleChange( + MODEL_CREATION_FORM_NAME.DATASET_NAME, + trainingDataset.name ?? "", + ); handleChange( MODEL_CREATION_FORM_NAME.TMS_URL, - trainingDataset.source_imagery ?? '', + trainingDataset.source_imagery ?? "", ); }, [ isEditMode, diff --git a/frontend/src/app/routes/models/model-details.tsx b/frontend/src/app/routes/models/model-details.tsx index 2a6183c0..48f22460 100644 --- a/frontend/src/app/routes/models/model-details.tsx +++ b/frontend/src/app/routes/models/model-details.tsx @@ -32,7 +32,11 @@ export const ModelDetailsPage = () => { openDialog: openModelFilesDialog, } = useDialog(); const navigate = useNavigate(); - const { data, isPending, isError, error } = useModelDetails(id as string, id !== undefined, 10000); + const { data, isPending, isError, error } = useModelDetails( + id as string, + id !== undefined, + 10000, + ); const { isAuthenticated } = useAuth(); useEffect(() => { @@ -56,7 +60,6 @@ export const ModelDetailsPage = () => { return ; } - return ( <> { const { modelId } = useParams(); const { isError, isPending, data, error } = useModelDetails( modelId as string, - modelId !== undefined + modelId !== undefined, ); const navigate = useNavigate(); const { currentZoom } = useMap(); diff --git a/frontend/src/features/model-creation/components/model-summary.tsx b/frontend/src/features/model-creation/components/model-summary.tsx index 79900bf7..1c045cee 100644 --- a/frontend/src/features/model-creation/components/model-summary.tsx +++ b/frontend/src/features/model-creation/components/model-summary.tsx @@ -77,8 +77,12 @@ const ModelSummaryForm = () => { content: [ `${MODEL_CREATION_CONTENT.trainingSettings.form.epoch.label}: ${formData.epoch}`, `${MODEL_CREATION_CONTENT.trainingSettings.form.batchSize.label}: ${formData.batchSize}`, - formData.baseModel === BASE_MODELS.RAMP ? `${MODEL_CREATION_CONTENT.trainingSettings.form.contactSpacing.label}: ${formData.contactSpacing}` : '', - formData.baseModel === BASE_MODELS.RAMP ? `${MODEL_CREATION_CONTENT.trainingSettings.form.boundaryWidth.label}: ${formData.boundaryWidth}` : '', + formData.baseModel === BASE_MODELS.RAMP + ? `${MODEL_CREATION_CONTENT.trainingSettings.form.contactSpacing.label}: ${formData.contactSpacing}` + : "", + formData.baseModel === BASE_MODELS.RAMP + ? `${MODEL_CREATION_CONTENT.trainingSettings.form.boundaryWidth.label}: ${formData.boundaryWidth}` + : "", ], }, ]; diff --git a/frontend/src/features/model-creation/components/progress-bar.tsx b/frontend/src/features/model-creation/components/progress-bar.tsx index 73f015a6..b2ecd89d 100644 --- a/frontend/src/features/model-creation/components/progress-bar.tsx +++ b/frontend/src/features/model-creation/components/progress-bar.tsx @@ -13,20 +13,20 @@ type ProgressBarProps = { const ProgressBar: React.FC = memo( ({ currentPath, currentPageIndex, pages }) => { const navigate = useNavigate(); - const { - getFullPath, isEditMode, - } = useModelsContext(); + const { getFullPath, isEditMode } = useModelsContext(); return ( {pages.map((step, index) => { const activeStep = currentPath.includes(step.path); - const isLastPage = index === pages.length - 1 + const isLastPage = index === pages.length - 1; return ( isEditMode && !isLastPage && navigate(getFullPath(step.path))} + onClick={() => + isEditMode && !isLastPage && navigate(getFullPath(step.path)) + } > {step.id < currentPageIndex + 1 ? ( diff --git a/frontend/src/features/models/api/factory.ts b/frontend/src/features/models/api/factory.ts index b416db41..2285603b 100644 --- a/frontend/src/features/models/api/factory.ts +++ b/frontend/src/features/models/api/factory.ts @@ -46,12 +46,15 @@ export const getModelsQueryOptions = ({ }); }; -export const getModelDetailsQueryOptions = (id: string, refetchInterval: boolean | number) => { +export const getModelDetailsQueryOptions = ( + id: string, + refetchInterval: boolean | number, +) => { return queryOptions({ queryKey: [queryKeys.MODEL_DETAILS(id)], queryFn: () => getModelDetails(id), //@ts-expect-error bad type definition - refetchInterval: refetchInterval + refetchInterval: refetchInterval, }); }; diff --git a/frontend/src/features/models/components/dialogs/model-files-dialog.tsx b/frontend/src/features/models/components/dialogs/model-files-dialog.tsx index 4a2de107..d1ce6ded 100644 --- a/frontend/src/features/models/components/dialogs/model-files-dialog.tsx +++ b/frontend/src/features/models/components/dialogs/model-files-dialog.tsx @@ -20,7 +20,12 @@ const ModelFilesDialog: React.FC = ({ closeDialog={closeDialog} label={APP_CONTENT.models.modelsDetailsCard.modelFilesDialog.dialogTitle} > - {APP_CONTENT.models.modelsDetailsCard.modelFilesDialog.dialogDescription} + + { + APP_CONTENT.models.modelsDetailsCard.modelFilesDialog + .dialogDescription + } + {isOpened && ( = ({ const fetchDirectoryRecursive = async ( currentDirectory: string = "", currentDepth: number = 0, - maxDepth: number = 2 + maxDepth: number = 2, ): Promise => { if (currentDepth >= maxDepth) { - return {}; } @@ -136,24 +135,24 @@ const DirectoryTree: React.FC = ({ const subdirectories = dir && currentDepth < maxDepth ? await Promise.all( - Object.keys(dir).map(async (key: string) => { - const fullPath = currentDirectory - ? `${currentDirectory}/${key}` - : key; - const subDirData = await fetchDirectoryRecursive( - fullPath, - currentDepth + 1, - maxDepth - ); - return { - [key]: { - ...subDirData, - size: dir[key]?.size || 0, - length: dir[key]?.len || 0, - }, - }; - }) - ) + Object.keys(dir).map(async (key: string) => { + const fullPath = currentDirectory + ? `${currentDirectory}/${key}` + : key; + const subDirData = await fetchDirectoryRecursive( + fullPath, + currentDepth + 1, + maxDepth, + ); + return { + [key]: { + ...subDirData, + size: dir[key]?.size || 0, + length: dir[key]?.len || 0, + }, + }; + }), + ) : []; return { diff --git a/frontend/src/features/models/hooks/use-models.ts b/frontend/src/features/models/hooks/use-models.ts index 2606cb0d..576670a5 100644 --- a/frontend/src/features/models/hooks/use-models.ts +++ b/frontend/src/features/models/hooks/use-models.ts @@ -39,7 +39,11 @@ export const useModels = ({ }); }; -export const useModelDetails = (id: string, enabled: boolean = true, refetchInterval: boolean | number = false) => { +export const useModelDetails = ( + id: string, + enabled: boolean = true, + refetchInterval: boolean | number = false, +) => { return useQuery({ ...getModelDetailsQueryOptions(id, refetchInterval), //@ts-expect-error bad type definition
{APP_CONTENT.models.modelsDetailsCard.modelFilesDialog.dialogDescription}
+ { + APP_CONTENT.models.modelsDetailsCard.modelFilesDialog + .dialogDescription + } +