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