Skip to content

Commit

Permalink
#1532 - fix issues with content table and fix routing issues
Browse files Browse the repository at this point in the history
  • Loading branch information
louise-davies committed Jun 20, 2023
1 parent 69d603a commit cf95162
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 6 deletions.
19 changes: 14 additions & 5 deletions packages/datagateway-dataview/src/page/pageContainer.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
useHistory,
useRouteMatch,
matchPath,
Switch,
} from 'react-router-dom';
import PageBreadcrumbs from './breadcrumbs.component';
import PageRouting from './pageRouting.component';
Expand Down Expand Up @@ -165,7 +166,12 @@ const isisPaths = [
];

// DLS base paths - required for linking to correct search view
const dlsPaths = [paths.myData.dls, paths.myDOIs.dls, paths.toggle.dlsProposal];
const dlsPaths = [
paths.myData.dls,
paths.myDOIs.dls,
paths.toggle.dlsProposal,
paths.landing.dlsDataPublicationLanding,
];

const BlackTextTypography = styled(Typography)({
color: '#000000',
Expand Down Expand Up @@ -206,10 +212,13 @@ const NavBar = React.memo(
xs
aria-label="page-breadcrumbs"
>
{/* don't show breadcrumbs on /my-data - only on browse */}
<Route path={[paths.root, paths.dataPublications.root]}>
<PageBreadcrumbs landingPageEntities={landingPageEntities} />
</Route>
{/* don't show breadcrumbs on /my-data or dls landing pages - only on browse */}
<Switch>
<Route path={[paths.landing.dlsDataPublicationLanding]} />
<Route path={[paths.root, paths.dataPublications.root]}>
<PageBreadcrumbs landingPageEntities={landingPageEntities} />
</Route>
</Switch>
</Grid>

{props.loggedInAnonymously || isDataPublication ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ import {
useDataPublicationContentCount,
Investigation,
formatBytes,
DLSVisitDetailsPanel,
DLSDatafileDetailsPanel,
} from 'datagateway-common';
import { IndexRange, TableCellProps } from 'react-virtualized';
import { useTranslation } from 'react-i18next';
Expand Down Expand Up @@ -196,6 +198,16 @@ const DLSDataPublicationContentTable = (
}
}, [t, textFilter, dateFilter, currentTab]);

const detailsPanel = React.useMemo(() => {
if (currentTab === 'investigation') {
return DLSVisitDetailsPanel;
} else if (currentTab === 'dataset') {
return DLSDatasetDetailsPanel;
} else if (currentTab === 'datafile') {
return DLSDatafileDetailsPanel;
}
}, [currentTab]);

const selectedRows = React.useMemo(
() =>
cartItems
Expand Down Expand Up @@ -235,8 +247,11 @@ const DLSDataPublicationContentTable = (
onCheck={addToCart}
onUncheck={removeFromCart}
disableSelectAll={true}
detailsPanel={DLSDatasetDetailsPanel}
detailsPanel={detailsPanel}
columns={columns}
// key prop forces the table to fully rerender on entity type change
// which means default column sizes get properly set
key={currentTab}
/>
</>
);
Expand Down

0 comments on commit cf95162

Please sign in to comment.