fix: get adapter store picker to show (#1134)
This commit is contained in:
parent
c73cfbc110
commit
50ca2bde97
@ -1,9 +1,9 @@
|
||||
import React, { useState, useEffect } from 'react';
|
||||
import React, { useState, useEffect, useContext } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import Dropzone from 'react-dropzone';
|
||||
import OHIF from '@ohif/core';
|
||||
import { withRouter } from 'react-router-dom';
|
||||
import { withTranslation } from 'react-i18next';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
StudyList,
|
||||
PageToolbar,
|
||||
@ -26,7 +26,8 @@ import AppContext from '../context/AppContext';
|
||||
const { urlUtil: UrlUtil } = OHIF.utils;
|
||||
|
||||
function StudyListRoute(props) {
|
||||
const { history, server, t, user, studyListFunctionsEnabled } = props;
|
||||
const { history, server, user, studyListFunctionsEnabled } = props;
|
||||
const [t] = useTranslation('Common');
|
||||
// ~~ STATE
|
||||
const [sort, setSort] = useState({
|
||||
fieldName: 'patientName',
|
||||
@ -55,6 +56,7 @@ function StudyListRoute(props) {
|
||||
const [activeModalId, setActiveModalId] = useState(null);
|
||||
const [rowsPerPage, setRowsPerPage] = useState(25);
|
||||
const [pageNumber, setPageNumber] = useState(0);
|
||||
const appContext = useContext(AppContext);
|
||||
// ~~ RESPONSIVE
|
||||
const displaySize = useMedia(
|
||||
['(min-width: 1750px)', '(min-width: 1000px)', '(min-width: 768px)'],
|
||||
@ -66,10 +68,10 @@ function StudyListRoute(props) {
|
||||
const debouncedFilters = useDebounce(filterValues, 250);
|
||||
|
||||
// Google Cloud Adapter for DICOM Store Picking
|
||||
const { appConfig = {} } = AppContext;
|
||||
const { appConfig = {} } = appContext;
|
||||
const isGoogleCHAIntegrationEnabled =
|
||||
!server && appConfig.enableGoogleCloudAdapter;
|
||||
if (isGoogleCHAIntegrationEnabled) {
|
||||
if (isGoogleCHAIntegrationEnabled && activeModalId !== 'DicomStorePicker') {
|
||||
setActiveModalId('DicomStorePicker');
|
||||
}
|
||||
|
||||
@ -97,8 +99,17 @@ function StudyListRoute(props) {
|
||||
}
|
||||
};
|
||||
|
||||
fetchStudies();
|
||||
}, [debouncedFilters, debouncedSort, rowsPerPage, pageNumber, displaySize]);
|
||||
if (server) {
|
||||
fetchStudies();
|
||||
}
|
||||
}, [
|
||||
debouncedFilters,
|
||||
debouncedSort,
|
||||
rowsPerPage,
|
||||
pageNumber,
|
||||
displaySize,
|
||||
server,
|
||||
]);
|
||||
|
||||
// TODO: Update Server
|
||||
// if (this.props.server !== prevProps.server) {
|
||||
@ -181,6 +192,13 @@ function StudyListRoute(props) {
|
||||
|
||||
return (
|
||||
<>
|
||||
{studyListFunctionsEnabled ? (
|
||||
<ConnectedDicomFilesUploader
|
||||
isOpen={activeModalId === 'DicomFilesUploader'}
|
||||
onClose={() => setActiveModalId(null)}
|
||||
/>
|
||||
) : null}
|
||||
{healthCareApiWindows}
|
||||
<WhiteLabellingContext.Consumer>
|
||||
{whiteLabelling => (
|
||||
<UserManagerContext.Consumer>
|
||||
@ -203,6 +221,7 @@ function StudyListRoute(props) {
|
||||
</h1>
|
||||
</div>
|
||||
<div className="actions">
|
||||
{studyListFunctionsEnabled && healthCareApiButtons}
|
||||
{studyListFunctionsEnabled && (
|
||||
<PageToolbar
|
||||
onImport={() => setActiveModalId('DicomFilesUploader')}
|
||||
@ -232,17 +251,8 @@ function StudyListRoute(props) {
|
||||
filterValues={filterValues}
|
||||
onFilterChange={handleFilterChange}
|
||||
studyListDateFilterNumDays={appConfig.studyListDateFilterNumDays}
|
||||
>
|
||||
{studyListFunctionsEnabled ? (
|
||||
<ConnectedDicomFilesUploader
|
||||
isOpen={activeModalId === 'DicomFilesUploader'}
|
||||
onClose={() => setActiveModalId(null)}
|
||||
/>
|
||||
) : null}
|
||||
{healthCareApiButtons}
|
||||
{healthCareApiWindows}
|
||||
</StudyList>
|
||||
}{/* PAGINATION FOOTER */}
|
||||
/>
|
||||
{/* PAGINATION FOOTER */}
|
||||
<TablePagination
|
||||
currentPage={pageNumber}
|
||||
nextPageFunc={() => setPageNumber(pageNumber + 1)}
|
||||
@ -407,7 +417,7 @@ function _sortStudies(studies, field, order) {
|
||||
});
|
||||
|
||||
// Sort by field
|
||||
sortedStudies.sort(function (a, b) {
|
||||
sortedStudies.sort(function(a, b) {
|
||||
let fieldA = a[field];
|
||||
let fieldB = b[field];
|
||||
if (field === 'studyDate') {
|
||||
@ -549,4 +559,4 @@ function _getQueryFiltersForValue(filters, fields, value) {
|
||||
return queryFilters;
|
||||
}
|
||||
|
||||
export default withRouter(withTranslation('Common')(StudyListRoute));
|
||||
export default withRouter(StudyListRoute);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user