From cee09fcf8d4bd7c288e09ee6a4ace06208e38500 Mon Sep 17 00:00:00 2001 From: Rodrigo Antinarelli Date: Wed, 29 Apr 2020 15:44:19 -0300 Subject: [PATCH] feat: OHIF-120 - Study List Route Template (#1693) * fix pagination size * clean up, start a very basic route configuration * quick navigation between routes * configure webpack to read .env variables * export studylist filter * split studylist filter into a component * minor fix in studylist pagination * update studylistfilter imports * create studylist container with study list content * moving file * study list filter doc page * catch change in ui-v2 * fix: 1px gap that shows text underneath * Shift to routes folder Co-authored-by: Danny Brown --- platform/ui/index.js | 1 + .../StudyListFilter/StudyListFilter.jsx} | 7 +- .../StudyListFilter/StudyListFilter.mdx | 118 +++++++ .../src/components/StudyListFilter/index.js | 1 + .../StudyListPagination.js | 17 +- platform/ui/src/components/index.js | 2 + platform/ui/src/views/StudyList/StudyList.js | 16 +- platform/ui/src/views/StudyList/StudyList.mdx | 6 +- platform/viewer/.webpack/webpack.pwa.js | 2 +- .../StudyListContainer/StudyListContainer.jsx | 319 +++++++++++++++++- platform/viewer/src/routes/index.js | 1 + 11 files changed, 460 insertions(+), 30 deletions(-) rename platform/ui/src/{views/StudyList/components/StudyListFilter.js => components/StudyListFilter/StudyListFilter.jsx} (96%) create mode 100644 platform/ui/src/components/StudyListFilter/StudyListFilter.mdx create mode 100644 platform/ui/src/components/StudyListFilter/index.js diff --git a/platform/ui/index.js b/platform/ui/index.js index df6706cf9..0097336b1 100644 --- a/platform/ui/index.js +++ b/platform/ui/index.js @@ -35,6 +35,7 @@ export { StudyBrowser, StudyItem, StudyListExpandedRow, + StudyListFilter, StudyListPagination, StudyListTable, Svg, diff --git a/platform/ui/src/views/StudyList/components/StudyListFilter.js b/platform/ui/src/components/StudyListFilter/StudyListFilter.jsx similarity index 96% rename from platform/ui/src/views/StudyList/components/StudyListFilter.js rename to platform/ui/src/components/StudyListFilter/StudyListFilter.jsx index 229e084a0..eed2cb795 100644 --- a/platform/ui/src/views/StudyList/components/StudyListFilter.js +++ b/platform/ui/src/components/StudyListFilter/StudyListFilter.jsx @@ -73,8 +73,11 @@ const StudyListFilter = ({ -
-
+
+
+ {() => { + const defaultFilterValues = { + patientName: '', + mrn: '', + studyDate: { + startDate: null, + endDate: null, + }, + description: '', + modality: undefined, + accession: '', + sortBy: '', + sortDirection: 'none', + page: 0, + resultsPerPage: 25, + }; + const [filterValues, setFilterValues] = useState(defaultFilterValues); + const filtersMeta = [ + { + name: 'patientName', + displayName: 'Patient Name', + inputType: 'Text', + isSortable: true, + gridCol: 4, + }, + { + name: 'mrn', + displayName: 'MRN', + inputType: 'Text', + isSortable: true, + gridCol: 2, + }, + { + name: 'studyDate', + displayName: 'Study date', + inputType: 'DateRange', + isSortable: true, + gridCol: 5, + }, + { + name: 'description', + displayName: 'Description', + inputType: 'Text', + isSortable: true, + gridCol: 4, + }, + { + name: 'modality', + displayName: 'Modality', + inputType: 'MultiSelect', + inputProps: { + options: [ + { value: 'SEG', label: 'SEG' }, + { value: 'CT', label: 'CT' }, + { value: 'MR', label: 'MR' }, + { value: 'SR', label: 'SR' }, + ], + }, + isSortable: true, + gridCol: 3, + }, + { + name: 'accession', + displayName: 'Accession', + inputType: 'Text', + isSortable: true, + gridCol: 4, + }, + { + name: 'instances', + displayName: 'Instances', + inputType: 'None', + isSortable: true, + gridCol: 2, + }, + ]; + const isFiltering = (filterValues, defaultFilterValues) => { + return Object.keys(defaultFilterValues).some(name => { + return filterValues[name] !== defaultFilterValues[name]; + }); + }; + return ( + setFilterValues(defaultFilterValues)} + isFiltering={isFiltering(filterValues, defaultFilterValues)} + /> + ); + }} + + +## Properties + + diff --git a/platform/ui/src/components/StudyListFilter/index.js b/platform/ui/src/components/StudyListFilter/index.js new file mode 100644 index 000000000..c16fbbcb6 --- /dev/null +++ b/platform/ui/src/components/StudyListFilter/index.js @@ -0,0 +1 @@ +export { default } from './StudyListFilter'; diff --git a/platform/ui/src/components/StudyListPagination/StudyListPagination.js b/platform/ui/src/components/StudyListPagination/StudyListPagination.js index 05f2f64f7..4adbe1a07 100644 --- a/platform/ui/src/components/StudyListPagination/StudyListPagination.js +++ b/platform/ui/src/components/StudyListPagination/StudyListPagination.js @@ -1,6 +1,6 @@ import React from 'react'; import PropTypes from 'prop-types'; -import { Button, ButtonGroup, Icon, IconButton, Typography } from '@ohif/ui'; +import { Button, ButtonGroup, Icon, Typography } from '@ohif/ui'; const StudyListPagination = ({ onChangePage, @@ -21,8 +21,7 @@ const StudyListPagination = ({