Skip to content

Commit

Permalink
EDSC-3093: Sort collections by start date / Extra: typo
Browse files Browse the repository at this point in the history
  • Loading branch information
tiagogalvao authored and macrouch committed Feb 20, 2023
1 parent 46da7c7 commit 3b89235
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
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

0 comments on commit 3b89235

Please sign in to comment.