Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EDSC-3093: Sort collections by start date #1583

Merged
merged 1 commit into from
Feb 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions schemas/sitePreferencesSchema.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,14 @@
"default",
"relevance",
"-usage_score",
"start_date",
"-ongoing"
],
"enumNames": [
"Default",
"Relevance",
"Usage",
"Start Date",
"End Date"
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ describe('renderOpenSearchTemplate', () => {
expect(response).toEqual('https://cwic.wgiss.ceos.org/opensearch/granules.atom?datasetId=C1597928934-NOAA_NCEI&count=20&geoBox=-92.5761953125,40.874451651754995,-92.57519531250.001,40.875451651754990.001&clientId=eed-edsc-dev')
})

test('inlcludes a start and end date when temporal values are provided', () => {
test('includes a start and end date when temporal values are provided', () => {
const response = renderOpenSearchTemplate(
'https://cwic.wgiss.ceos.org/opensearch/granules.atom?datasetId=C1597928934-NOAA_NCEI&startIndex={startIndex?}&count={count?}&timeStart={time:start}&timeEnd={time:end}&geoBox={geo:box}&clientId=eed-edsc-dev',
{
Expand Down
5 changes: 5 additions & 0 deletions static/src/js/components/SearchPanels/SearchPanels.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,11 @@ class SearchPanels extends PureComponent {
isActive: activeCollectionsSortKey === '-usage_score',
onClick: () => setCollectionSort('-usage_score')
},
{
label: 'Start Date',
isActive: activeCollectionsSortKey === 'start_date',
onClick: () => setCollectionSort('start_date')
},
{
label: 'End Date',
isActive: activeCollectionsSortKey === '-ongoing',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ describe('SearchPanels component', () => {
expect(collectionResultsPanelProps.sortsArray[0].isActive).toBe(true)
expect(collectionResultsPanelProps.sortsArray[1].label).toBe('Usage')
expect(collectionResultsPanelProps.sortsArray[1].isActive).toBe(false)
expect(collectionResultsPanelProps.sortsArray[2].label).toBe('End Date')
expect(collectionResultsPanelProps.sortsArray[2].label).toBe('Start Date')
expect(collectionResultsPanelProps.sortsArray[2].isActive).toBe(false)
expect(collectionResultsPanelProps.sortsArray[3].label).toBe('End Date')
expect(collectionResultsPanelProps.sortsArray[3].isActive).toBe(false)
})

describe('when in the default portal', () => {
Expand Down