Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHV-66099 Images page (image download, image layout and format, download alerts) #34706

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
txtLine,
usePrintTitle,
} from '@department-of-veterans-affairs/mhv/exports';
import { VaAlert } from '@department-of-veterans-affairs/component-library/dist/react-bindings';
import { mhvUrl } from '~/platform/site-wide/mhv/utilities';
import { isAuthenticatedWithSSOe } from '~/platform/user/authentication/selectors';
import PrintHeader from '../shared/PrintHeader';
Expand Down Expand Up @@ -70,7 +71,6 @@
const [pollInterval, setPollInterval] = useState(2000);

const [processingRequest, setProcessingRequest] = useState(false);

const radiologyDetails = useSelector(
state => state.mr.labsAndTests.labsAndTestsDetails,
);
Expand Down Expand Up @@ -101,7 +101,7 @@
setImageProcessingAlertRendered(true);
}
},
[processingAlertHeadingRef.current],

Check warning on line 104 in src/applications/mhv-medical-records/components/LabsAndTests/RadiologyDetails.jsx

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/mhv-medical-records/components/LabsAndTests/RadiologyDetails.jsx:104:5:React Hook useEffect has an unnecessary dependency: 'processingAlertHeadingRef.current'. Either exclude it or remove the dependency array. Mutable values like 'processingAlertHeadingRef.current' aren't valid dependencies because mutating them doesn't re-render the component.
);

useEffect(
Expand Down Expand Up @@ -388,6 +388,20 @@
label="Date and time performed"
labelClass="vads-font-weight-regular"
/>
{studyJob?.status === studyJobStatus.COMPLETE && (
<VaAlert
status="success"
visible
class="vads-u-margin-top--4 no-print"
role="alert"
data-testid="alert-download-started"
>
<h3 className="vads-u-font-size--lg vads-u-font-family--sans no-print">
Images ready
</h3>
{imageAlertComplete()}
</VaAlert>
)}
{downloadStarted && <DownloadSuccessAlert />}
<PrintDownload
description="L&TR Detail"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,20 @@ const ImageGallery = ({ imageList, imagesPerPage, studyId }) => {
if (imageList.length && imagesPerPage && studyId) {
return (
<>
<div data-testid="showing-image-records">
<span>
{`Showing ${
paginatedImages[currentPage - 1][0].index
} to ${paginatedImages[currentPage - 1][0].index +
(paginatedImages[currentPage - 1].length - 1)} of ${
imageList.length
} images`}
</span>
</div>
<div className="vads-u-padding--0 vads-u-border-top--1px vads-u-border-color--gray-lighter vads-l-grid-container vads-l-row vads-u-margin-bottom--2">
{paginatedImages[currentPage - 1].map((image, idx) => (
<div
className="image-div vads-l-col--4"
className="image-div vads-l-col--6"
data-testid="image-div"
key={idx}
>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const RadiologyImagesList = ({ isTesting }) => {
isTesting || false,
);
const [isStudyJobsLoaded, setStudyJobsLoaded] = useState(isTesting || false);

const [dicomDownload, setDicomDownload] = useState(false);
const returnToDetailsPage = useCallback(
() => history.push(`/labs-and-tests/${labId}`),
[history, labId],
Expand Down Expand Up @@ -112,6 +112,11 @@ const RadiologyImagesList = ({ isTesting }) => {
[radiologyDetails, returnToDetailsPage],
);

const updateDicomDownload = truth => {
setDicomDownload(truth);
document.querySelector('#download-banner');
};

const renderImageContent = () => (
<>
<PrintHeader />
Expand All @@ -136,8 +141,8 @@ const RadiologyImagesList = ({ isTesting }) => {
VA care team to share them directly.
</p>
<p>
If you want to try to sharing these images yourself, you can download
them as DICOM files in a ZIP folder.
If you want to try sharing these images yourself, you can download them
as DICOM files in a ZIP folder.
</p>
<p>Here’s what to know:</p>
<ul>
Expand All @@ -158,16 +163,28 @@ const RadiologyImagesList = ({ isTesting }) => {
saves a copy of your files to the computer you’re using.
</li>
</ul>
<p>
{radiologyDetails?.studyId && (
<va-link
download
filetype="ZIP folder"
href={`${apiImagingPath}/${radiologyDetails.studyId}/dicom`}
text="Download DICOM files"
/>
)}
</p>
{radiologyDetails?.studyId && (
<>
<va-banner
id="download-banner"
show-close={false}
headline="Download started"
type="success"
visible={dicomDownload}
>
Check your device’s downloads location for your file.
</va-banner>
<p>
<va-link
download
filetype="ZIP folder"
href={`${apiImagingPath}/${radiologyDetails.studyId}/dicom`}
text="Download DICOM files"
onClick={() => updateDicomDownload(true)}
/>
</p>
</>
)}
</>
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ describe('Medical Records - Radiology images are shown when requested', () => {

RadiologyDetailsPage.verifyPaginationVisible();

RadiologyDetailsPage.verifyShowingImageRecords(1, 10, 11);

cy.injectAxe();
cy.axeCheck('main', {});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,19 @@ class RadiologyDetailsPage extends BaseDetailsPage {
verifyFocus = () => {
cy.get('h1').should('have.focus');
};

verifyShowingImageRecords = (
displayedStartNumber,
displayedEndNumber,
numRecords,
) => {
cy.get('[data-testid="showing-image-records"]')
.find('span')
.should(
'contain',
`Showing ${displayedStartNumber} to ${displayedEndNumber} of ${numRecords} images`,
);
};
}

export default new RadiologyDetailsPage();
Loading