* Enable study prefetcher and expose configs * Fix progress for all images * Enable study loading listener * Add new default for displaying progress bar for series * Use events instead of redux to improve performance * Add documentation, resolve issues with different datasets * CR Updates * CR Updates * CR Updates & Resolve issue when activating both stack and study prefetch * Add upward and update display set logic * Add new behavior to prefetching orders * Rollback display set check and activate cache check * Remove prefetch check * Check if displayset has images * Debounce check cache events * Remove usued debounce flags * Ignore prefetching same image * Use new image instead of image rendered * Continue prefetch after cache check * Update prefetch logic after checking cache * Remove log * Update displayset count default to 3 * Update netlify config Co-authored-by: Alireza <ar.sedghi@gmail.com>
110 lines
3.3 KiB
JavaScript
110 lines
3.3 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import { Thumbnail } from './Thumbnail.js';
|
|
import './StudyBrowser.styl';
|
|
|
|
function StudyBrowser(props) {
|
|
const {
|
|
studies,
|
|
onThumbnailClick,
|
|
onThumbnailDoubleClick,
|
|
supportsDrag,
|
|
showThumbnailProgressBar,
|
|
} = props;
|
|
|
|
return (
|
|
<div className="study-browser">
|
|
<div className="scrollable-study-thumbnails">
|
|
{studies
|
|
.map((study, studyIndex) => {
|
|
const { StudyInstanceUID } = study;
|
|
return study.thumbnails.map((thumb, thumbIndex) => {
|
|
// TODO: Thumb has more props than we care about?
|
|
const {
|
|
active,
|
|
altImageText,
|
|
displaySetInstanceUID,
|
|
imageId,
|
|
InstanceNumber,
|
|
numImageFrames,
|
|
SeriesDescription,
|
|
SeriesNumber,
|
|
hasWarnings,
|
|
} = thumb;
|
|
|
|
return (
|
|
<div
|
|
key={thumb.displaySetInstanceUID}
|
|
className="thumbnail-container"
|
|
data-cy="thumbnail-list"
|
|
>
|
|
<Thumbnail
|
|
active={active}
|
|
supportsDrag={supportsDrag}
|
|
key={`${studyIndex}_${thumbIndex}`}
|
|
id={`${studyIndex}_${thumbIndex}`} // Unused?
|
|
// Study
|
|
StudyInstanceUID={StudyInstanceUID} // used by drop
|
|
// Thumb
|
|
altImageText={altImageText}
|
|
imageId={imageId}
|
|
InstanceNumber={InstanceNumber}
|
|
displaySetInstanceUID={displaySetInstanceUID} // used by drop
|
|
numImageFrames={numImageFrames}
|
|
SeriesDescription={SeriesDescription}
|
|
SeriesNumber={SeriesNumber}
|
|
hasWarnings={hasWarnings}
|
|
// Events
|
|
onClick={onThumbnailClick.bind(
|
|
undefined,
|
|
displaySetInstanceUID
|
|
)}
|
|
onDoubleClick={onThumbnailDoubleClick}
|
|
showProgressBar={showThumbnailProgressBar}
|
|
/>
|
|
</div>
|
|
);
|
|
});
|
|
})
|
|
.flat()}
|
|
</div>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
const noop = () => {};
|
|
|
|
StudyBrowser.propTypes = {
|
|
studies: PropTypes.arrayOf(
|
|
PropTypes.shape({
|
|
StudyInstanceUID: PropTypes.string.isRequired,
|
|
thumbnails: PropTypes.arrayOf(
|
|
PropTypes.shape({
|
|
altImageText: PropTypes.string,
|
|
displaySetInstanceUID: PropTypes.string.isRequired,
|
|
imageId: PropTypes.string,
|
|
InstanceNumber: PropTypes.number,
|
|
numImageFrames: PropTypes.number,
|
|
SeriesDescription: PropTypes.string,
|
|
SeriesNumber: PropTypes.number,
|
|
stackPercentComplete: PropTypes.number,
|
|
})
|
|
),
|
|
})
|
|
).isRequired,
|
|
supportsDrag: PropTypes.bool,
|
|
onThumbnailClick: PropTypes.func,
|
|
onThumbnailDoubleClick: PropTypes.func,
|
|
showThumbnailProgressBar: PropTypes.bool,
|
|
};
|
|
|
|
StudyBrowser.defaultProps = {
|
|
studies: [],
|
|
supportsDrag: true,
|
|
onThumbnailClick: noop,
|
|
onThumbnailDoubleClick: noop,
|
|
showThumbnailProgressBar: true,
|
|
};
|
|
|
|
export { StudyBrowser };
|