From c627280982c55f8cd82e178c2be014e44ce93b77 Mon Sep 17 00:00:00 2001 From: igoroctaviano Date: Thu, 6 Aug 2020 17:01:29 -0300 Subject: [PATCH 1/2] ohif-318: reflect default sorting on ui --- .../viewer/src/routes/WorkList/WorkList.jsx | 38 ++++++++++--------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/platform/viewer/src/routes/WorkList/WorkList.jsx b/platform/viewer/src/routes/WorkList/WorkList.jsx index d42f775d5..fc8fa1223 100644 --- a/platform/viewer/src/routes/WorkList/WorkList.jsx +++ b/platform/viewer/src/routes/WorkList/WorkList.jsx @@ -45,6 +45,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { const debouncedFilterValues = useDebounce(filterValues, 200); const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues; + let dynamicFilterValues = {}; 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 +55,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { if (noSortApplied && studies.length < 101) { const ascendingSortModifier = -1; - + dynamicFilterValues = { + sortBy: 'studyDate', + sortDirection: 'ascending', + }; return _sortStringDates(s1, s2, ascendingSortModifier); } else if (noSortApplied) { return 0; @@ -216,8 +220,8 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { content: patientName ? ( {patientName} ) : ( - (Empty) - ), + (Empty) + ), gridCol: 4, }, { @@ -281,13 +285,13 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { seriesTableDataSource={ seriesInStudiesMap.has(studyInstanceUid) ? seriesInStudiesMap.get(studyInstanceUid).map(s => { - return { - description: s.description || '(empty)', - seriesNumber: s.seriesNumber || '', - modality: s.modality || '', - instances: s.numSeriesInstances || '', - }; - }) + return { + description: s.description || '(empty)', + seriesNumber: s.seriesNumber || '', + modality: s.modality || '', + instances: s.numSeriesInstances || '', + }; + }) : [] } > @@ -304,7 +308,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { @@ -353,7 +357,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { setFilterValues(defaultFilterValues)} isFiltering={isFiltering(filterValues, defaultFilterValues)} @@ -376,10 +380,10 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { /> ) : ( -
- -
- )} +
+ +
+ )} ); } From 6d32225954280ff92b600865b56f6257110cd4bc Mon Sep 17 00:00:00 2001 From: igoroctaviano Date: Fri, 7 Aug 2020 11:25:25 -0300 Subject: [PATCH 2/2] ohif-318: add comment --- platform/viewer/src/routes/WorkList/WorkList.jsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/platform/viewer/src/routes/WorkList/WorkList.jsx b/platform/viewer/src/routes/WorkList/WorkList.jsx index fc8fa1223..14484b10f 100644 --- a/platform/viewer/src/routes/WorkList/WorkList.jsx +++ b/platform/viewer/src/routes/WorkList/WorkList.jsx @@ -45,7 +45,12 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { const debouncedFilterValues = useDebounce(filterValues, 200); const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues; - let dynamicFilterValues = {}; + /* + * 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 @@ -55,7 +60,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { if (noSortApplied && studies.length < 101) { const ascendingSortModifier = -1; - dynamicFilterValues = { + defaultSortValues = { sortBy: 'studyDate', sortDirection: 'ascending', }; @@ -357,7 +362,7 @@ function WorkList({ history, data: studies, isLoadingData, dataSource }) { setFilterValues(defaultFilterValues)} isFiltering={isFiltering(filterValues, defaultFilterValues)}