diff --git a/platform/ui/src/components/EmptyStudies/EmptyStudies.js b/platform/ui/src/components/EmptyStudies/EmptyStudies.js
index 48e3baaa6..893ecf3e3 100644
--- a/platform/ui/src/components/EmptyStudies/EmptyStudies.js
+++ b/platform/ui/src/components/EmptyStudies/EmptyStudies.js
@@ -3,12 +3,13 @@ import PropTypes from 'prop-types';
import classnames from 'classnames';
import { Icon, Typography } from '@ohif/ui';
-const EmptyStudies = ({ className }) => {
+// TODO: Add loading spinner to OHIF + use it here.
+const EmptyStudies = ({ className, isLoading }) => {
return (
- No studies available
+ {!isLoading ? 'No studies available' : 'Loading...'}
);
diff --git a/platform/viewer/src/routes/DataSourceWrapper.jsx b/platform/viewer/src/routes/DataSourceWrapper.jsx
index d0a0711e3..158594128 100644
--- a/platform/viewer/src/routes/DataSourceWrapper.jsx
+++ b/platform/viewer/src/routes/DataSourceWrapper.jsx
@@ -46,14 +46,17 @@ function DataSourceWrapper(props) {
// studies.processResults -->
// But only for LayoutTemplate type of 'list'?
// Or no data fetching here, and just hand down my source
- const [data, setData] = useState();
+ const [data, setData] = useState([]);
+ const [isLoading, setIsLoading] = useState(false);
useEffect(() => {
// 204: no content
async function getData() {
+ setIsLoading(true);
const searchResults = await dataSource.query.studies.search(
queryFilterValues
);
setData(searchResults);
+ setIsLoading(false);
}
try {
@@ -61,23 +64,19 @@ function DataSourceWrapper(props) {
} catch (ex) {
console.warn(ex);
}
- console.log('DataSourceWrapper: useEffect');
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [history.location.search]);
// queryFilterValues
// TODO: Better way to pass DataSource?
return (
-
- {data && (
-
- )}
-
+
);
}
diff --git a/platform/viewer/src/routes/WorkList/WorkList.jsx b/platform/viewer/src/routes/WorkList/WorkList.jsx
index 264bc87e2..e3610cf90 100644
--- a/platform/viewer/src/routes/WorkList/WorkList.jsx
+++ b/platform/viewer/src/routes/WorkList/WorkList.jsx
@@ -1,4 +1,4 @@
-import React, { useState, useEffect } from 'react';
+import React, { Suspense, useState, useEffect } from 'react';
import classnames from 'classnames';
import PropTypes from 'prop-types';
import { Link } from 'react-router-dom';
@@ -28,15 +28,13 @@ const seriesInStudiesMap = new Map();
* TODO:
* - debounce `setFilterValues` (150ms?)
*/
-function WorkList({ history, data: studies, dataSource }) {
+function WorkList({ history, data: studies, isLoadingData, dataSource }) {
// ~ Modes
const [appConfig] = useAppConfig();
// ~ Filters
const query = useQuery();
const queryFilterValues = _getQueryFilterValues(query);
- const [filterValues, _setFilterValues] = useState(
- Object.assign({}, defaultFilterValues, queryFilterValues)
- );
+ const [filterValues, _setFilterValues] = useState({ ...defaultFilterValues, ...queryFilterValues });
const debouncedFilterValues = useDebounce(filterValues, 200);
const { resultsPerPage, pageNumber, sortBy, sortDirection } = filterValues;
@@ -80,6 +78,7 @@ function WorkList({ history, data: studies, dataSource }) {
return 0;
});
+
// ~ Rows & Studies
const [expandedRows, setExpandedRows] = useState([]);
const [studiesWithSeriesData, setStudiesWithSeriesData] = useState([]);
@@ -190,6 +189,7 @@ function WorkList({ history, data: studies, dataSource }) {
return filterValues[name] !== defaultFilterValues[name];
});
};
+
const tableDataSource = sortedStudies.map((study, key) => {
const rowKey = key + 1;
const isExpanded = expandedRows.some(k => k === rowKey);
@@ -211,8 +211,8 @@ function WorkList({ history, data: studies, dataSource }) {
content: patientName ? (
patientName
) : (
- (Empty)
- ),
+ (Empty)
+ ),
title: patientName,
gridCol: 4,
},
@@ -299,13 +299,13 @@ function WorkList({ history, data: studies, 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 || '',
+ };
+ })
: []
}
>
@@ -322,7 +322,7 @@ function WorkList({ history, data: studies, dataSource }) {