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 65c4277c..4a2de107 100644 --- a/frontend/src/features/models/components/dialogs/model-files-dialog.tsx +++ b/frontend/src/features/models/components/dialogs/model-files-dialog.tsx @@ -20,6 +20,7 @@ const ModelFilesDialog: React.FC = ({ closeDialog={closeDialog} label={APP_CONTENT.models.modelsDetailsCard.modelFilesDialog.dialogTitle} > +

{APP_CONTENT.models.modelsDetailsCard.modelFilesDialog.dialogDescription}

{isOpened && ( = ({ const fetchDirectoryRecursive = async ( currentDirectory: string = "", + currentDepth: number = 0, + maxDepth: number = 2 ): Promise => { + if (currentDepth >= maxDepth) { + + return {}; + } + const data = await fetchDirectoryData(currentDirectory); if (!data) return {}; const { dir, file } = data; - const subdirectories = dir - ? await Promise.all( + + 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); + const subDirData = await fetchDirectoryRecursive( + fullPath, + currentDepth + 1, + maxDepth + ); return { [key]: { ...subDirData, @@ -139,9 +152,9 @@ const DirectoryTree: React.FC = ({ length: dir[key]?.len || 0, }, }; - }), + }) ) - : []; + : []; return { dir: Object.assign({}, ...subdirectories), diff --git a/frontend/src/utils/content.ts b/frontend/src/utils/content.ts index 40444821..e179c44e 100644 --- a/frontend/src/utils/content.ts +++ b/frontend/src/utils/content.ts @@ -506,6 +506,7 @@ export const APP_CONTENT = { modelFilesDialog: { rootDirectory: "Root Directory", dialogTitle: "Model Files", + dialogDescription: "Click to download each file...", error: "Error loading directories.", }, trainingInfoDialog: {