diff --git a/frontend/schema.faker.graphql b/frontend/schema.faker.graphql index 5ab94490a1..dc0ecdcd39 100755 --- a/frontend/schema.faker.graphql +++ b/frontend/schema.faker.graphql @@ -402,7 +402,7 @@ type DmarcReportEdge { } type Domain implements Node { - organization: Organization + organization: Organizations dmarcReports( before: String after: String @@ -951,6 +951,15 @@ type OrganizationDetail { ] ) + """ + The number of domains under this organization + """ + domainCount: Int + @fake( + type: number + options: { minNumber: 0, maxNumber: 20, precisionNumber: 1 } + ) + """ The zone which the organization belongs to. """ @@ -984,6 +993,14 @@ type OrganizationDetail { type Organizations implements Node { """ + The number of domains under this organization + """ + domainCount: Int + @fake( + type: number + options: { minNumber: 0, maxNumber: 20, precisionNumber: 1 } + ) + """ The ID of the object. """ id: ID! @@ -1012,7 +1029,6 @@ type Organizations implements Node { ] ) - """ The zone which the organization belongs to. """ @@ -1381,9 +1397,9 @@ type Query { Select all information on all organizations that a user has access to. """ findMyOrganizations( - before: String, - after: String, - first: Int, + before: String + after: String + first: Int last: Int ): OrganizationsConnection @@ -1396,19 +1412,20 @@ type Query { Select information on an organizations domains, or all domains a user has access to. """ findDomainsByOrg( - orgSlug: Slug, - before: String, - after: String, - first: Int, last: Int -): DomainConnection + orgSlug: Slug + before: String + after: String + first: Int + last: Int + ): DomainConnection """ Select information on all domains a user has access to. """ findMyDomains( - before: String, - after: String, - first: Int, + before: String + after: String + first: Int last: Int ): DomainConnection @@ -1529,10 +1546,14 @@ enum RoleEnums { } enum ScanTypeEnums { - """Used for defining if DMARC and DKIM scans should be performed""" + """ + Used for defining if DMARC and DKIM scans should be performed + """ MAIL - """Used for defining if HTTPS and SSL scans should be performed""" + """ + Used for defining if HTTPS and SSL scans should be performed + """ WEB } @@ -1796,7 +1817,7 @@ type UserAffClass implements Node { """ The organization this affiliation belongs to """ - organization: Organization + organization: Organizations """ The ID of the object. @@ -1949,7 +1970,6 @@ type UserPageAffiliations implements Node { organization: Acronym @examples(values: ["GC", "ABC", "ASDF", "NSTIR", "BC"]) } - type ValidateTwoFactor { user: User } diff --git a/frontend/src/Organization.js b/frontend/src/Organization.js index 1c6d93ddf4..479ca2d5aa 100644 --- a/frontend/src/Organization.js +++ b/frontend/src/Organization.js @@ -1,19 +1,27 @@ import React from 'react' -import { Link, ListItem, Stack } from '@chakra-ui/core' +import { Trans } from '@lingui/macro' +import { Text, Link, ListItem, Stack } from '@chakra-ui/core' import { Link as RouteLink, useRouteMatch } from 'react-router-dom' -import { string } from 'prop-types' -export function Organization({ name, slug, ...rest }) { +import { string, number } from 'prop-types' +export function Organization({ name, slug, domainCount, ...rest }) { const { path, _url } = useRouteMatch() console.log(`path: ${path}, url: ${_url}`) return ( - + - {name} + {name} + + Internet facing services: {domainCount} + ) } -Organization.propTypes = { name: string, slug: string } +Organization.propTypes = { + name: string.isRequired, + slug: string.isRequired, + domainCount: number.isRequired, +} diff --git a/frontend/src/Organizations.js b/frontend/src/Organizations.js index 20a1ac00c7..bd404ae426 100644 --- a/frontend/src/Organizations.js +++ b/frontend/src/Organizations.js @@ -57,8 +57,13 @@ export default function Organisations() { elements={organizations} ifEmpty={() => No Organizations} > - {({ name, slug }, index) => ( - + {({ name, slug, domainCount }, index) => ( + )} diff --git a/frontend/src/__tests__/Organizations.test.js b/frontend/src/__tests__/Organizations.test.js index 1993faa2d4..ec56b7fee3 100644 --- a/frontend/src/__tests__/Organizations.test.js +++ b/frontend/src/__tests__/Organizations.test.js @@ -23,12 +23,14 @@ const mocks = [ node: { name: 'Fisheries and Oceans Canada', slug: 'fisheries-and-oceans-canada', + domainCount: 2, }, }, { node: { name: 'Treasury Board of Canada Secretariat', slug: 'treasury-board-secretariat', + domainCount: 5, }, }, ], diff --git a/frontend/src/graphql/queries.js b/frontend/src/graphql/queries.js index a1be38b0ff..617824150f 100644 --- a/frontend/src/graphql/queries.js +++ b/frontend/src/graphql/queries.js @@ -26,6 +26,7 @@ export const ORGANIZATIONS = gql` edges { node { name + domainCount slug } }