diff --git a/src/components/data_search/DatasetFilterList.js b/src/components/data_search/DatasetFilterList.js index 2de088cef..f63ffa395 100644 --- a/src/components/data_search/DatasetFilterList.js +++ b/src/components/data_search/DatasetFilterList.js @@ -12,6 +12,8 @@ import { Checkbox } from '@mui/material'; export const DatasetFilterList = (props) => { const { datasets, filters, filterHandler } = props; + const accessManagementFilters = ['Controlled', 'Open', 'External']; + const isFiltered = (filter) => filters.indexOf(filter) > -1; return ( @@ -24,22 +26,21 @@ export const DatasetFilterList = (props) => { Access Type - - filterHandler(event, datasets, 'open')}> - - - - - - - - filterHandler(event, datasets, 'controlled')}> - - - - - - + { + accessManagementFilters.map((filterName) => { + const filter = filterName.toLowerCase(); + return ( + + filterHandler(event, datasets, filter)}> + + + + + + + ); + }) + } ); diff --git a/src/components/data_search/DatasetSearchTable.js b/src/components/data_search/DatasetSearchTable.js index 565ef24d3..e0e5bb8d7 100644 --- a/src/components/data_search/DatasetSearchTable.js +++ b/src/components/data_search/DatasetSearchTable.js @@ -51,10 +51,16 @@ export const DatasetSearchTable = (props) => { newFiltered = data; } else { newFiltered = data.filter((dataset) => { - if (newFilters.includes('open') && dataset.openAccess) { + // TODO: remove extra checks when openAccess property is deprecated + if (newFilters.includes('open') && (dataset.openAccess || dataset.accessManagement === 'open')) { return true; } - if (newFilters.includes('controlled') && !dataset.openAccess) { + if (newFilters.includes('controlled') && ( + (!dataset.openAccess && dataset.accessManagement === undefined) || (dataset.openAccess === undefined && dataset.accessManagement === 'controlled') + )) { + return true; + } + if (newFilters.includes('external') && dataset.accessManagement === 'external') { return true; } return false;