From 0d685d9966eb1a4ab77ff47a26e23ad8371c8d7e Mon Sep 17 00:00:00 2001 From: ebrockainq <112428189+ebrockainq@users.noreply.github.com> Date: Fri, 6 Sep 2024 11:35:37 -0400 Subject: [PATCH] Site 3912 (#120) * Changes from SITE-3986 * Update B1Tab.tsx * Create SMTPTestCases.tsx * Remove duplicate files * Add env variables and move API calls to ServerActions * Improve environment variable name * Remove env variables * Add Loading Button, Remove Default Profile Values * add IMAP/POP3 manual validation, attachment type field * Fix tab data carryover, fix include filter * Add XDR endpoint fields * Add XDR DocumentSelector handling * Fix incorrect emails * Fix missing doc select on XDR 3 * Add logs formatting * Fix reversed IMAP and POP3 icons * Add tooltip * Fix XDR logs and missing manual validations * Add attachment type tooltip * Remove Tooltips add XDR API call * Add error condition, add clear button * Fix more info sections, censor profile password * Add clear selected document * Remove accept/reject on API error * Fix XDR more info page * add tooltip and pop over for endpoint copy * Fix incorrect xdr email addresses * Replace popover system and fix error handling * Language improvements and fix clear button visibility trigger * Fix language errors * Add clear button to XDR send * Basic xdr functionality * Add manual validation, request/response, remining request fields, * add xdr document selector * Add XDR Document Select test functionality, add colorized XML display * Correct document selection per sub criteria * Fix failure detection on empty responses * Banish type errors * Less restrictive clear button * Fix CORS issue with document select * Update DocumentSelector.tsx * add prettier ignore to bugged line * Add improved warning triggers * Add backup content, fix criteriaMet icon on non manual tests --- .prettierrc | 2 +- src/components/direct/hisp/TestCard.tsx | 49 +++++-- src/components/direct/hisp/XDRTestCard.tsx | 130 ++++++++++++------ .../direct/test-by-criteria/ServerActions.ts | 8 +- 4 files changed, 139 insertions(+), 50 deletions(-) diff --git a/.prettierrc b/.prettierrc index 0ba8bf09..d0afb198 100644 --- a/.prettierrc +++ b/.prettierrc @@ -6,7 +6,7 @@ "experimentalTernaries": false, "singleQuote": true, "jsxSingleQuote": false, - "quoteProps": "consistent", + "quoteProps": "as-needed", "trailingComma": "es5", "singleAttributePerLine": false, "htmlWhitespaceSensitivity": "css", diff --git a/src/components/direct/hisp/TestCard.tsx b/src/components/direct/hisp/TestCard.tsx index cb0a340f..edf7b037 100644 --- a/src/components/direct/hisp/TestCard.tsx +++ b/src/components/direct/hisp/TestCard.tsx @@ -1,5 +1,4 @@ import DynamicTable from './DynamicTable' -import InfoIcon from '@mui/icons-material/Info' import _ from 'lodash' import React, { useState } from 'react' import DocumentSelector from './DocumentSelector' @@ -23,6 +22,7 @@ import { Checkbox, TextField, SelectChangeEvent, + Popover, } from '@mui/material' export type TestCaseFields = { @@ -100,6 +100,10 @@ const TestCard = ({ tlsRequired = false, receive, }: TestCardProps) => { + const [popoverAnchorEl, setPopoverAnchorEl] = useState(null) + const popoverOpen = Boolean(popoverAnchorEl) + const popoverId = popoverOpen ? 'ccda-file-required-popover' : undefined + const [autoCloseTimer, setAutoCloseTimer] = useState(null) const attachmentTypeTestIDs = [231, 331] const manualValidationCriteria = [ "['b1-5']", @@ -118,7 +122,6 @@ const TestCard = ({ const [isFinished, setIsFinished] = useState(false) const [apiError, setApiError] = useState(false) const [attachmentType, setAttachmentType] = useState('') - const apiUrl = process.env.CCDA_DOCUMENTS || 'https://ett.healthit.gov/ett/api/ccdadocuments' const handleDocumentConfirm = (selectedData: SelectedDocument) => { console.log('Confirmed Document', selectedData) @@ -194,9 +197,21 @@ const TestCard = ({ setFormData((prev) => ({ ...prev, [name]: value })) } + const handleClosePopover = () => { + if (autoCloseTimer) { + clearTimeout(autoCloseTimer) + setAutoCloseTimer(null) + } + setPopoverAnchorEl(null) + } + const handleRunTest = async () => { if (test.ccdaFileRequired && !documentDetails) { - alert('This test requires a CCDA document to be selected. Please select a document before running the test.') + setPopoverAnchorEl(document.activeElement as HTMLButtonElement) + const timer = setTimeout(() => { + handleClosePopover() + }, 2500) + setAutoCloseTimer(timer) } else { try { setIsLoading(true) @@ -294,7 +309,25 @@ const TestCard = ({ - + {} + + + This test requires a CCDA document to be selected. Please select a document before running the test. + + {showDetail ? ( <> @@ -353,10 +386,10 @@ const TestCard = ({ diff --git a/src/components/direct/test-by-criteria/ServerActions.ts b/src/components/direct/test-by-criteria/ServerActions.ts index 51c92c43..e733fb42 100644 --- a/src/components/direct/test-by-criteria/ServerActions.ts +++ b/src/components/direct/test-by-criteria/ServerActions.ts @@ -131,6 +131,7 @@ export async function handleXDRAPICall(data: XDRAPICallData): Promise