Skip to content

Commit

Permalink
[DUOS-2721] Inherit all data libraries from base url (#2357)
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois authored Oct 17, 2023
1 parent 9993ba5 commit 7938991
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
5 changes: 0 additions & 5 deletions src/Routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ const Routes = (props) => (
<AuthenticatedRoute path="/dataset_catalog" component={DatasetCatalog} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary/:query" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary_broad" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary_mgb" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary_elwazi" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary_myinstitution" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/datalibrary_nhgri" component={DatasetSearch} props={props} rolesAllowed={[USER_ROLES.admin, USER_ROLES.all]} />
<AuthenticatedRoute path="/dataset_statistics/:datasetId" component={DatasetStatistics} props={props}
rolesAllowed={[USER_ROLES.all]} />
<AuthenticatedRoute path="/dac_datasets" component={DACDatasets} props={props} rolesAllowed={[USER_ROLES.chairperson]} />
Expand Down
16 changes: 8 additions & 8 deletions src/pages/DatasetSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ const myInstitutionQuery = (user) => {
}

export const DatasetSearch = (props) => {
const { location } = props;
const { match: { params: { query } } } = props;
const [datasets, setDatasets] = useState([]);
const [loading, setLoading] = useState(true);
Expand All @@ -54,7 +53,7 @@ export const DatasetSearch = (props) => {
icon: duosIcon,
title: 'DUOS Data Library',
},
'/datalibrary_broad': {
'broad': {
query: {
'match_phrase': {
'submitter.institution.name': 'The Broad Institute of MIT and Harvard'
Expand All @@ -63,7 +62,7 @@ export const DatasetSearch = (props) => {
icon: broadIcon,
title: 'Broad Data Library',
},
'/datalibrary_mgb': {
'mgb': {
query: {
'bool': {
'should': [
Expand Down Expand Up @@ -93,7 +92,7 @@ export const DatasetSearch = (props) => {
icon: mgbIcon,
title: 'Mass General Brigham Data Library',
},
'/datalibrary_elwazi': {
'elwazi': {
query: {
'match_phrase': {
'study.description': 'elwazi'
Expand All @@ -102,12 +101,12 @@ export const DatasetSearch = (props) => {
icon: elwaziIcon,
title: 'eLwazi Data Library',
},
'/datalibrary_myinstitution': {
'myinstitution': {
query: user.isSigningOfficial ? signingOfficialQuery(user) : myInstitutionQuery(user),
icon: null,
title: user.institution.name + ' Data Library',
},
'/datalibrary_nhgri': {
'nhgri': {
query: {
'match_phrase': {
'study.description': 'anvil'
Expand All @@ -116,7 +115,7 @@ export const DatasetSearch = (props) => {
icon: nhgriIcon,
title: 'NHGRI Data Library',
},
'custom': {
'/custom': {
query: {
'bool': {
'should': [
Expand All @@ -138,7 +137,8 @@ export const DatasetSearch = (props) => {
}
}

const version = query === undefined ? versions[location.pathname] : versions['custom'];
const key = query === undefined ? '/datalibrary' : query;
const version = versions[key] === undefined ? versions['/custom'] : versions[key];

useEffect(() => {
const init = async () => {
Expand Down

0 comments on commit 7938991

Please sign in to comment.