Skip to content

Commit

Permalink
Task/WC-96: Log views of non-Other type publications as listings on t…
Browse files Browse the repository at this point in the history
…he root dir (#1433)

* log views of non-Other type projects as listings on the root dir

* fix hook dependencies
  • Loading branch information
jarosenb authored Sep 5, 2024
1 parent 541144e commit 667821c
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion client/src/datafiles/layouts/published/PublishedDetailLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 (
<Layout>
Expand Down

0 comments on commit 667821c

Please sign in to comment.