Skip to content

Commit

Permalink
MHV-66099 Images page (image download, image layout and format, downl…
Browse files Browse the repository at this point in the history
…oad alerts) (#34706)

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

* update radiology images auto-test

* made updates suggested by Mike

* updated test to accept a change that I made

* removed redundant header text

---------

Co-authored-by: Timothy Steele <[email protected]>
  • Loading branch information
Wyzardsleeves and timothy-steele-va authored Feb 19, 2025
1 parent 43be0a9 commit 287b635
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
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 RadiologyDetails = props => {
const [pollInterval, setPollInterval] = useState(2000);

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

const radiologyDetails = useSelector(
state => state.mr.labsAndTests.labsAndTestsDetails,
);
Expand Down Expand Up @@ -388,6 +388,20 @@ ${record.results}`;
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();

0 comments on commit 287b635

Please sign in to comment.