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

feat: save and delete user testing profiles #147

Merged
merged 8 commits into from
Oct 7, 2024
Merged
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
5 changes: 4 additions & 1 deletion src/components/direct/hisp/HISPPortal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import IMAP from './IMAPTab'
import POP3 from './POP3Tab'
import XDR from './XDRTab'
import ValidationResults from './ValidationResultsTab'
import ProfileProvider from './provider'

const HISPPortal = () => {
const hispTabs: TabInputs[] = [
Expand Down Expand Up @@ -41,7 +42,9 @@ const HISPPortal = () => {
}
/>
{/* Main Content */}
<TabsComponent selectedTab={''} tabs={hispTabs} />
<ProfileProvider>
<TabsComponent selectedTab={''} tabs={hispTabs} />
</ProfileProvider>
</>
)
}
Expand Down
22 changes: 20 additions & 2 deletions src/components/direct/hisp/IMAPTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,15 @@ import * as React from 'react'
import testCases from '@/assets/SMTPTestCases'
import _ from 'lodash'
import TestFilter from './TestFilter'
import { useContext } from 'react'
import { ProfileContext } from './context'

const IMAP = () => {
const [option, setOption] = React.useState('')
const imapTestCases = testCases.tests.filter((test) => test.protocol === 'imap')
const imapTestCasesSender = imapTestCases.filter((test) => test.sutRole === 'sender' && test.sutHisp)
const imapTestCasesReceiver = imapTestCases.filter((test) => test.sutRole === 'receiver' && test.sutHisp)
const { hostname, email, password, tls, username } = useContext(ProfileContext)
const handleChange = (event: SelectChangeEvent) => {
setOption(event.target.value as string)
}
Expand Down Expand Up @@ -86,7 +89,14 @@ const IMAP = () => {
{imapTestCasesSender.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard test={test} />
<TestCard
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand All @@ -98,7 +108,15 @@ const IMAP = () => {
{imapTestCasesReceiver.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard key={i} test={test} />
<TestCard
key={i}
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand Down
22 changes: 20 additions & 2 deletions src/components/direct/hisp/MessageTrackingTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,15 @@ import testCases from '@/assets/SMTPTestCases'
import DragandDropFile from '@/components/shared/DragandDropFile'
import HelpIcon from '@mui/icons-material/Help'
import TestFilter from './TestFilter'
import { useContext } from 'react'
import { ProfileContext } from './context'

const MessageTracking = () => {
const [option, setOption] = React.useState('')
const mu2TestCases = testCases.tests.filter((test) => test.protocol === 'mu2')
const mu2TestCasesSender = mu2TestCases.filter((test) => test.sutRole === 'sender' && test.sutHisp)
const mu2TestCasesReceiver = mu2TestCases.filter((test) => test.sutRole === 'receiver' && test.sutHisp)
const { hostname, email, password, tls, username } = useContext(ProfileContext)
const handleChange = (event: SelectChangeEvent) => {
setOption(event.target.value as string)
}
Expand Down Expand Up @@ -102,7 +105,14 @@ const MessageTracking = () => {
{mu2TestCasesSender.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard test={test} />
<TestCard
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand All @@ -113,7 +123,15 @@ const MessageTracking = () => {
{mu2TestCasesReceiver.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard key={i} test={test} />
<TestCard
key={i}
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand Down
23 changes: 21 additions & 2 deletions src/components/direct/hisp/POP3Tab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,16 @@ import * as React from 'react'
import testCases from '@/assets/SMTPTestCases'
import _ from 'lodash'
import TestFilter from './TestFilter'
import { useContext } from 'react'
import { ProfileContext } from './context'

const POP3 = () => {
const [option, setOption] = React.useState('')
const popTestCases = testCases.tests.filter((test) => test.protocol === 'pop')
const popTestCasesSender = popTestCases.filter((test) => test.sutRole === 'sender' && test.sutHisp)
const popTestCasesReceiver = popTestCases.filter((test) => test.sutRole === 'receiver' && test.sutHisp)
const { hostname, email, password, tls, username } = useContext(ProfileContext)

const handleChange = (event: SelectChangeEvent) => {
setOption(event.target.value as string)
}
Expand Down Expand Up @@ -86,7 +90,14 @@ const POP3 = () => {
{popTestCasesSender.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard test={test} />
<TestCard
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand All @@ -98,7 +109,15 @@ const POP3 = () => {
{popTestCasesReceiver.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard key={i} test={test} />
<TestCard
key={i}
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand Down
22 changes: 20 additions & 2 deletions src/components/direct/hisp/SMTPTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,15 @@ import palette from '@/styles/palette'
import * as React from 'react'
import testCases from '@/assets/SMTPTestCases'
import TestFilter from './TestFilter'
import { useContext } from 'react'
import { ProfileContext } from './context'

const SMTP = () => {
const [option, setOption] = React.useState('')
const smtpTestCases = testCases.tests.filter((test) => test.protocol === 'smtp')
const smtpTestCasesSender = smtpTestCases.filter((test) => test.sutRole === 'sender' && test.sutHisp)
const smtpTestCasesReceiver = smtpTestCases.filter((test) => test.sutRole === 'receiver' && test.sutHisp)
const { hostname, email, password, tls, username } = useContext(ProfileContext)
const handleChange = (event: SelectChangeEvent) => {
setOption(event.target.value as string)
}
Expand Down Expand Up @@ -85,7 +88,14 @@ const SMTP = () => {
{smtpTestCasesSender.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard test={test} />
<TestCard
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand All @@ -96,7 +106,15 @@ const SMTP = () => {
{smtpTestCasesReceiver.map((test, i) => {
return (
<Box pb={4} key={i}>
<TestCard key={i} test={test} />
<TestCard
key={i}
test={test}
email={email}
hostname={hostname}
password={password}
tlsRequired={tls}
username={username}
/>
</Box>
)
})}
Expand Down
87 changes: 56 additions & 31 deletions src/components/direct/hisp/ValidationResultsTab.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,66 @@
import * as React from 'react'
import { Box, Typography, Container } from '@mui/material'
import ProfilesCard from './ProfilesCard'
import { useSession } from 'next-auth/react'
import PageAlertBox from '@/components/shared/PageAlertBox'
import { useEffect } from 'react'

const ValidationResults = () => {
const { data: session, status } = useSession()
const [profiles, setProfiles] = React.useState([])

useEffect(() => {
if (status === 'authenticated') {
//const response = await fetchUserProfiles()
console.log(`DEBUG - Fetching profiles for user: ${session.user.email}`)
}
}, [status])

return (
<Container>
<Box
sx={{
padding: '32px',
minHeight: 'auto',
}}
>
<Typography variant="h4" sx={{ mb: 4 }}>
Below are the different profiles you are aligned to. Select one to see the validation results.
</Typography>
<>
{status !== 'authenticated' ? (
<Container sx={{ pt: 4 }}>
<PageAlertBox message="You must be logged in to see your profiles." />
</Container>
) : (
<Container>
<Box
sx={{
padding: '32px',
minHeight: 'auto',
}}
>
<Typography variant="h4" sx={{ mb: 4 }}>
Below are the different profiles you are aligned to. Select one to see the validation results.
</Typography>

<Box gap={4} display={'flex'} flexDirection={'row'} flexWrap={'wrap'}>
<ProfilesCard header=".gov" smtpAddress="direct.ett.health.gov" emailAddress="direct.ett.health.gov" />
<ProfilesCard
header="HIT2.nist.gov"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
<ProfilesCard
header=".Default Profile 3"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
<ProfilesCard header="test.gov" smtpAddress="direct.ett.health.gov" emailAddress="direct.ett.health.gov" />
<ProfilesCard
header="HIT1.nist.gov"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
</Box>
</Box>
</Container>
<Box gap={4} display={'flex'} flexDirection={'row'} flexWrap={'wrap'}>
<ProfilesCard header=".gov" smtpAddress="direct.ett.health.gov" emailAddress="direct.ett.health.gov" />
<ProfilesCard
header="HIT2.nist.gov"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
<ProfilesCard
header=".Default Profile 3"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
<ProfilesCard
header="test.gov"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
<ProfilesCard
header="HIT1.nist.gov"
smtpAddress="direct.ett.health.gov"
emailAddress="direct.ett.health.gov"
/>
</Box>
</Box>
</Container>
)}
</>
)
}

Expand Down
Loading