Skip to content

Commit

Permalink
Direct transport test tool (#112)
Browse files Browse the repository at this point in the history
* Add file size limit for drag and drop

* Add file size to CCDA validator

* Change bgcolor in DCDT

* Transport test tool implementation

* Fix package-lock json
  • Loading branch information
akanuri9 authored Aug 23, 2024
1 parent 51d2d78 commit 235f862
Show file tree
Hide file tree
Showing 26 changed files with 1,047 additions and 446 deletions.
205 changes: 73 additions & 132 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"@mui/lab": "^5.0.0-alpha.173",
"@mui/material": "^5.16.0",
"@mui/material-nextjs": "^5.15.5",
"@mui/x-data-grid": "^7.12.1",
"axios": "^1.6.8",
"dompurify": "^3.1.2",
"lodash": "^4.17.21",
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added public/certificates/public-keys/test.der
Binary file not shown.
2 changes: 1 addition & 1 deletion src/components/c-cda/validation/IGValidatorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export default function IGValidatorForm({ version, formAction }: IGValidatorForm

{/* Upload */}
<Box sx={{ pt: 3 }}>
<DragDropFileUpload maxFiles={1} name="ccdaFile" fileName={getFileName} />
<DragDropFileUpload maxFiles={1} name="ccdaFile" fileName={getFileName} allowedSize={1048576} />
</Box>

{/* Validate */}
Expand Down
2 changes: 1 addition & 1 deletion src/components/c-cda/validation/ValidatorForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export default function ValidatorForm({
<Box sx={{ pt: 3 }}>
<FormControl fullWidth>
<FormLabel sx={{ pb: 1 }}>Upload your generated C-CDA file and submit for validation</FormLabel>
<DragDropFileUpload maxFiles={1} name="ccdaFile" fileName={getFileName} />
<DragDropFileUpload maxFiles={1} name="ccdaFile" fileName={getFileName} allowedSize={1048576} />
</FormControl>
</Box>

Expand Down
2 changes: 1 addition & 1 deletion src/components/direct/dcdt/HostingResults.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const Results = ({ response }: ResultsProps) => {
</Box>
)}
{response.status === 'success' && response.items !== undefined && (
<Box p={2} bgcolor={palette.secondaryLight} borderRadius={1} border={`1px solid ${palette.secondary}`} mb={2}>
<Box p={2} bgcolor={'#E3F2FD64'} borderRadius={1} border={`1px solid #E3F2FD64`} mb={2}>
{response.items?.map((item, i) => {
return (
<Box key={i}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/direct/dcdt/TestCasePanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ const CertificateList = ({ certificateFields }: CertificateListProps) => {
}
const TestCasePanel = ({ testCaseFields }: TestCasePanelProps) => {
return (
<Box p={2} bgcolor={palette.secondaryLight} borderRadius={1} border={`1px solid ${palette.secondary}`} mb={2}>
<Box p={2} bgcolor={'#E3F2FD64'} borderRadius={1} border={`1px solid #E3F2FD64`} mb={2}>
<Box sx={twoColumnContainer}>
<Box display={'flex'} minWidth={'50%'}>
{_.has(testCaseFields[0], 'Binding_Type') && (
Expand Down
55 changes: 34 additions & 21 deletions src/components/direct/transport-tool/OwnContentTab.tsx
Original file line number Diff line number Diff line change
@@ -1,29 +1,42 @@
import DragandDropFile from '@/components/shared/DragandDropFile'
import palette from '@/styles/palette'
import { Box, TextField, Stack, Typography, Button } from '@mui/material'
import { Box, TextField, Stack, Typography } from '@mui/material'
import { handleSendMessageWithAttachmentFile } from './actions'
import { useState } from 'react'
import { useFormState } from 'react-dom'
import OwnContentResults from './ReceiveMessageSITEResults'

const OwnContentTab = () => {
const [endpointName, setEndpointName] = useState('')
const [data, handleSubmit] = useFormState(handleSendMessageWithAttachmentFile, { response: {} })
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
const { value } = e.target
setEndpointName(value)
}
return (
<Box p={2}>
<TextField
fullWidth
id="ownEndpointName"
label="Enter Your Endpoint Name"
helperText="Recipient Direct email address"
sx={{ pb: 4 }}
/>
<Box pb={4}>
<Stack direction="row" alignItems="flex-start" gap={1}>
<Typography gutterBottom variant="body1">
<strong>Select a Local C-CDA File to Send:</strong>
</Typography>
</Stack>
<DragandDropFile />
<form action={handleSubmit}>
<Box p={2}>
<TextField
fullWidth
id="ownEndpointName"
label="Enter Your Endpoint Name"
helperText="Recipient Direct email address"
sx={{ pb: 4 }}
name="toAddress"
value={endpointName}
onChange={handleChange}
type="email"
/>
<Box pb={4}>
<Stack direction="row" alignItems="flex-start" gap={1}>
<Typography gutterBottom variant="body1">
<strong>Select a Local C-CDA File to Send:</strong>
</Typography>
</Stack>
<DragandDropFile maxFiles={1} name="attachment" />
</Box>
<OwnContentResults response={data?.response} buttonTitle={'SEND MESSAGE'} />
</Box>
<Button variant="contained" sx={{ color: palette.white }} type="submit">
SEND MESSAGE
</Button>
</Box>
</form>
)
}

Expand Down
Loading

0 comments on commit 235f862

Please sign in to comment.