Merge pull request #1973 from OHIF/feat/ohif-318
OHIF-318: When the default sort "descending by study date" is applied, the UI should reflects the applied sorting
This commit is contained in:
commit
4af0933406
@ -45,6 +45,12 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
||||
const debouncedFilterValues = useDebounce(filterValues, 200);
|
||||
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
|
||||
|
||||
/*
|
||||
* The default sort value keep the filters synchronized with runtime conditional sorting
|
||||
* Only applied if no other sorting is specified and there are less than 101 studies
|
||||
*/
|
||||
let defaultSortValues = {};
|
||||
|
||||
const sortedStudies = studies
|
||||
// TOOD: Move sort to DataSourceWrapper?
|
||||
// TODO: MOTIVATION, this is triggered on every render, even if list/sort does not change
|
||||
@ -54,7 +60,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
||||
|
||||
if (noSortApplied && studies.length < 101) {
|
||||
const ascendingSortModifier = -1;
|
||||
|
||||
defaultSortValues = {
|
||||
sortBy: 'studyDate',
|
||||
sortDirection: 'ascending',
|
||||
};
|
||||
return _sortStringDates(s1, s2, ascendingSortModifier);
|
||||
} else if (noSortApplied) {
|
||||
return 0;
|
||||
@ -312,7 +321,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
||||
disabled={false}
|
||||
endIcon={<Icon name="launch-arrow" />} // launch-arrow | launch-info
|
||||
className={classnames('font-bold', { 'ml-2': !isFirst })}
|
||||
onClick={() => {}}
|
||||
onClick={() => { }}
|
||||
>
|
||||
{mode.displayName}
|
||||
</Button>
|
||||
@ -353,7 +362,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) {
|
||||
<StudyListFilter
|
||||
numOfStudies={numOfStudies}
|
||||
filtersMeta={filtersMeta}
|
||||
filterValues={filterValues}
|
||||
filterValues={{ ...filterValues, ...defaultSortValues }}
|
||||
onChange={setFilterValues}
|
||||
clearFilters={() => setFilterValues(defaultFilterValues)}
|
||||
isFiltering={isFiltering(filterValues, defaultFilterValues)}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user