diff --git a/frontend/src/App.js b/frontend/src/App.js index 02bc038ef9..fe17b770b5 100644 --- a/frontend/src/App.js +++ b/frontend/src/App.js @@ -10,7 +10,7 @@ import { Footer } from './Footer' import { Navigation } from './Navigation' import { Flex, Link, CSSReset, useToast, Box } from '@chakra-ui/core' import { SkipLink } from './SkipLink' -import { TwoFactorNotificationBar } from './TwoFactorNotificationBar' +// import { TwoFactorNotificationBar } from './TwoFactorNotificationBar' import { useUserState } from './UserState' import { RouteIf } from './RouteIf' import { ErrorBoundary } from 'react-error-boundary' @@ -70,7 +70,7 @@ export default function App() { )} - {1 && ( + {isLoggedIn() && ( DMARC Report @@ -113,7 +113,7 @@ export default function App() { )} - {isLoggedIn() && !currentUser.tfa && } + {/* {isLoggedIn() && !currentUser.tfa && } */}
Loading...}> diff --git a/frontend/src/DmarcByDomainPage.js b/frontend/src/DmarcByDomainPage.js index 2ab7cebe4e..3d3d064ea2 100644 --- a/frontend/src/DmarcByDomainPage.js +++ b/frontend/src/DmarcByDomainPage.js @@ -47,13 +47,7 @@ export default function DmarcByDomainPage() { relayRoot: 'findMyDomains', }) - // TODO: Properly handle these errors - if (error) - return ( - - Error while querying for DMARC report summary table - - ) + if (error) return // DMARC Summary Table setup let tableDisplay diff --git a/frontend/src/OrganizationCard.js b/frontend/src/OrganizationCard.js index 95015046bb..3028d2cf04 100644 --- a/frontend/src/OrganizationCard.js +++ b/frontend/src/OrganizationCard.js @@ -35,6 +35,18 @@ export function OrganizationCard({ if (webSummary[0]?.percentage) webValue = webSummary[0]?.percentage if (mailSummary[0]?.percentage) mailValue = mailSummary[0]?.percentage + if (webValue % 1 >= 0.5) { + webValue = Math.ceil(webValue) + } else { + webValue = Math.floor(webValue) + } + + if (mailValue % 1 >= 0.5) { + mailValue = Math.ceil(mailValue) + } else { + mailValue = Math.floor(mailValue) + } + return ( { - // history.push({ - // pathname: '/user', - // state: { detail: userName }, - // }) - // }} - // _hover={{ borderColor: 'gray.200', bg: 'gray.200' }} - p="8" - as="button" - > + {userName} @@ -38,7 +25,7 @@ export function UserCard({ userName, tfa, role }) { )} {tfa !== null && ( - + 2FA Validated diff --git a/frontend/src/UserPage.js b/frontend/src/UserPage.js index 5ed1da1767..307e7fe924 100644 --- a/frontend/src/UserPage.js +++ b/frontend/src/UserPage.js @@ -1,5 +1,5 @@ import React from 'react' -import { useHistory, useLocation, Link as RouteLink } from 'react-router-dom' +import { useHistory, useLocation } from 'react-router-dom' import { string } from 'prop-types' import { Stack, @@ -7,9 +7,8 @@ import { Divider, Heading, Icon, - Text, Badge, - Link, + Box, } from '@chakra-ui/core' import { useQuery } from '@apollo/client' import { useUserState } from './UserState' @@ -22,29 +21,12 @@ import EditableUserPassword from './EditableUserPassword' import { TrackerButton } from './TrackerButton' import { LoadingMessage } from './LoadingMessage' import { ErrorFallbackMessage } from './ErrorFallbackMessage' -import { ErrorBoundary } from 'react-error-boundary' -import { ListOf } from './ListOf' export default function UserPage() { const location = useLocation() const history = useHistory() const { currentUser } = useUserState() - // const { - // loading: queryUserLoading, - // error: queryUserError, - // data: queryUserData, - // } = useQuery(QUERY_USER, { - // context: { - // headers: { - // authorization: currentUser.jwt, - // }, - // }, - // variables: { - // userName: currentUser.userName, - // }, - // }) - const { loading: queryUserLoading, error: queryUserError, @@ -69,10 +51,6 @@ export default function UserPage() { return } - const affiliations = queryUserData.userPage.affiliations.edges.map( - (e) => e.node, - ) - return ( @@ -95,56 +73,37 @@ export default function UserPage() { /> - - - Organizations - - No Organizations} - mb="4" - > - {({ permission, organization }, index) => ( - - - - - - {organization.name} - - - {organization.verified && ( - - )} - - - Role: - - {permission} - - - - - - )} - - + Account Details + + + + 2FA Validated + + + + + + Email Validated + + + ', () => { const tfaBadge = getByText(/2FA Validated/i) expect(tfaBadge).toBeDefined() - expect(tfaBadge).toHaveStyle('background-color: rgb(198, 246, 213)') + expect(tfaBadge).toHaveStyle('background-color: rgb(56, 161, 105)') }) it('badge is red when TwoFactor value is false', async () => { @@ -59,6 +59,6 @@ describe('', () => { const tfaBadge = getByText(/2FA Validated/i) expect(tfaBadge).toBeDefined() - expect(tfaBadge).toHaveStyle('background-color: rgb(254, 215, 215)') + expect(tfaBadge).toHaveStyle('background-color: rgb(229, 62, 62)') }) }) diff --git a/frontend/src/__tests__/UserList.test.js b/frontend/src/__tests__/UserList.test.js index 7df0ad3aa8..c9fa406bc2 100644 --- a/frontend/src/__tests__/UserList.test.js +++ b/frontend/src/__tests__/UserList.test.js @@ -60,56 +60,6 @@ describe('', () => { ) }) - // it('redirects to userPage when a list element is clicked', async () => { - // // create a history object and inject it so we can inspect it afterwards - // // for the side effects of our form submission (a redirect to /!). - // const history = createMemoryHistory({ - // initialEntries: ['/user-list'], - // initialIndex: 0, - // }) - - // // Set the inital history item to user-list - // const { getByText } = render( - // - // - // - // - // - // - // - // - // - // - // , - // ) - - // const foundUserCard = await waitFor(() => - // getByText( - // data.findOrganizationBySlug.affiliations.edges[0].node.user.userName, - // ), - // ) - - // const leftClick = { button: 0 } - // fireEvent.click(foundUserCard, leftClick) - // // default `button` property for click events is set to `0` which is a left click. - - // await waitFor(() => { - // // Path should be '/user', so expect that value - // expect(history.location.pathname).toEqual('/user') - // }) - // }) - describe('Admin profile userlist', () => { it('updateUserRole elements render', async () => { const history = createMemoryHistory({ diff --git a/frontend/src/__tests__/UserPage.test.js b/frontend/src/__tests__/UserPage.test.js index 7d1254f0a9..3818872dfd 100644 --- a/frontend/src/__tests__/UserPage.test.js +++ b/frontend/src/__tests__/UserPage.test.js @@ -26,7 +26,6 @@ describe('', () => { { request: { query: QUERY_CURRENT_USER, - // variables: { userName: userName }, }, result: { data: { @@ -37,23 +36,6 @@ describe('', () => { preferredLang: 'ENGLISH', tfaValidated: false, emailValidated: false, - affiliations: { - edges: [ - { - node: { - permission: 'ADMIN', - organization: { - id: 'VXNlckxpc3RJdGVtOig0LCAzKQ==', - acronym: 'CSE', - name: 'Test Org', - slug: 'test-org', - verified: false, - domainCount: 3, - }, - }, - }, - ], - }, }, }, }, diff --git a/frontend/src/fixtures/dmarcReportSummaryTable.js b/frontend/src/fixtures/dmarcReportSummaryTable.js index 3f97896b41..0e034d653e 100644 --- a/frontend/src/fixtures/dmarcReportSummaryTable.js +++ b/frontend/src/fixtures/dmarcReportSummaryTable.js @@ -8,7 +8,7 @@ export const rawDmarcReportSummaryTableData = { domain: 'domain1.ca', dmarcSummaryByPeriod: { month: 'LAST30DAYS', - year: '2020', + year: '2021', domain: 'domain1.ca', categoryPercentages: { failPercentage: 31.5, @@ -31,7 +31,7 @@ export const rawDmarcReportSummaryTableData = { domain: 'domain2.ca', dmarcSummaryByPeriod: { month: 'LAST30DAYS', - year: '2020', + year: '2021', domain: 'domain2.ca', categoryPercentages: { failPercentage: 31.5, diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index ec8641e473..3d413e64d2 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -448,19 +448,6 @@ export const QUERY_CURRENT_USER = gql` preferredLang tfaValidated emailValidated - affiliations { - edges { - node { - permission - organization { - id - name - slug - verified - } - } - } - } } } ` diff --git a/frontend/src/locales/en.po b/frontend/src/locales/en.po index 09b57f812c..c9d33f06d1 100644 --- a/frontend/src/locales/en.po +++ b/frontend/src/locales/en.po @@ -25,10 +25,16 @@ msgstr "*All data represented is mocked for demonstration purposes" msgid "*search bars do not actively search databases currently. They are used to demonstrate the 'add' button feature" msgstr "*search bars do not actively search databases currently. They are used to demonstrate the 'add' button feature" -#: src/UserCard.js:42 +#: src/UserCard.js:44 +#: src/UserPage.js:84 + msgid "2FA Validated" msgstr "2FA Validated" +#: src/UserPage.js:93 +msgid "Email Validated" +msgstr "Email Validated" + #: src/guidanceTagConstants.js:5 msgid "3.2.2 Third Parties and DKIM" msgstr "3.2.2 Third Parties and DKIM" diff --git a/frontend/src/locales/fr.po b/frontend/src/locales/fr.po index c6136f7c0f..bb9aa5799c 100644 --- a/frontend/src/locales/fr.po +++ b/frontend/src/locales/fr.po @@ -25,10 +25,16 @@ msgstr "*Toutes les données représentées sont simulées à des fins de démon msgid "*search bars do not actively search databases currently. They are used to demonstrate the 'add' button feature" msgstr "*Les barres de recherche ne recherchent pas activement les bases de données actuellement. Elles sont utilisées pour démontrer la fonction du bouton 'Ajouter'" -#: src/UserCard.js:42 +#: src/UserCard.js:44 +#: src/UserPage.js:84 + msgid "2FA Validated" msgstr "2FA Validé" +#: src/UserPage.js:93 +msgid "Email Validated" +msgstr "Courriel validé" + #: src/guidanceTagConstants.js:5 msgid "3.2.2 Third Parties and DKIM" msgstr "3.2.2 Expéditeurs tiers et DKIM"