diff --git a/client/src/datafiles/layouts/published/PublishedDetailLayout.tsx b/client/src/datafiles/layouts/published/PublishedDetailLayout.tsx index f50ee09e13..2de053ad81 100644 --- a/client/src/datafiles/layouts/published/PublishedDetailLayout.tsx +++ b/client/src/datafiles/layouts/published/PublishedDetailLayout.tsx @@ -5,7 +5,11 @@ import { PublishedCitation, DownloadCitation, } from '@client/datafiles'; -import { usePublicationDetail, usePublicationVersions } from '@client/hooks'; +import { + apiClient, + usePublicationDetail, + usePublicationVersions, +} from '@client/hooks'; import React, { useEffect } from 'react'; import { Alert, Button, Form, Input, Layout, Spin } from 'antd'; import { Navigate, Outlet, useParams, useSearchParams } from 'react-router-dom'; @@ -54,6 +58,25 @@ export const PublishedDetailLayout: React.FC = () => { } }, [version, searchParams, setSearchParams]); + // List files in the project root for metrics/reporting purposes. + useEffect(() => { + if (!data) return; + + const selectedVersion = + version || + searchParams.get('version') || + Math.max(...allVersions).toString(); + + data?.baseProject.projectType !== 'other' && + apiClient.get( + `/api/datafiles/tapis/public/listing/designsafe.storage.published/${projectId}${ + selectedVersion && parseInt(selectedVersion) > 1 + ? `v${selectedVersion}` + : '' + }` + ); + }, [data, allVersions, searchParams, version, projectId]); + if (isError) { return (