Skip to content

Commit d55ec8b

Browse files
authored
Allow for organization summaries to be null on org summary page (canada-ca#2322)
1 parent 3bb24e9 commit d55ec8b

5 files changed

Lines changed: 633 additions & 686 deletions

File tree

frontend/src/OrganizationDetails.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ export default function OrganizationDetails() {
100100
<TabPanel>
101101
<ErrorBoundary FallbackComponent={ErrorFallbackMessage}>
102102
<OrganizationSummary
103-
summaries={data.organization.summaries}
103+
summaries={data?.organization?.summaries}
104104
domainCount={data.organization.domainCount}
105105
userCount={data.organization.affiliations.totalCount}
106106
city={data.organization.city}

frontend/src/OrganizationSummary.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function OrganizationSummary({
3838
</Text>
3939
</Stack>
4040
</Stack>
41-
<SummaryGroup web={summaries.web} mail={summaries.mail} />
41+
<SummaryGroup web={summaries?.web} mail={summaries?.mail} />
4242
</Layout>
4343
)
4444
}

frontend/src/SummaryGroup.js

Lines changed: 47 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,56 @@
11
import React from 'react'
2-
import { t } from '@lingui/macro'
3-
import { SimpleGrid } from '@chakra-ui/core'
2+
import { t, Trans } from '@lingui/macro'
3+
import { SimpleGrid, Text } from '@chakra-ui/core'
44
import SummaryCard from './SummaryCard'
55
import { object } from 'prop-types'
66
import theme from './theme/canada'
77

88
const { colors } = theme
99

1010
export function SummaryGroup({ web, mail }) {
11+
const webCard = web ? (
12+
<SummaryCard
13+
title={t`Web Configuration`}
14+
description={t`Web encryption settings summary`}
15+
categoryDisplay={{
16+
fail: {
17+
name: t`Non-compliant TLS`,
18+
color: colors.weak,
19+
},
20+
pass: {
21+
name: t`Compliant TLS`,
22+
color: colors.strong,
23+
},
24+
}}
25+
data={web}
26+
/>
27+
) : (
28+
<Text fontWeight="bold" textAlign="center">
29+
<Trans>No web configuration information available for this org.</Trans>
30+
</Text>
31+
)
32+
33+
const mailCard = mail ? (
34+
<SummaryCard
35+
title={t`Email Configuration`}
36+
description={t`Email security settings summary`}
37+
categoryDisplay={{
38+
pass: {
39+
name: t`DMARC pass`,
40+
color: colors.strong,
41+
},
42+
fail: {
43+
name: t`DMARC fail`,
44+
color: colors.weak,
45+
},
46+
}}
47+
data={mail}
48+
/>
49+
) : (
50+
<Text fontWeight="bold" textAlign="center">
51+
<Trans>No mail configuration information available for this org.</Trans>
52+
</Text>
53+
)
1154
return (
1255
<SimpleGrid
1356
columns={[1, 1, 1, 2]}
@@ -17,36 +60,8 @@ export function SummaryGroup({ web, mail }) {
1760
mx="auto"
1861
p={['2', '8']}
1962
>
20-
<SummaryCard
21-
title={t`Web Configuration`}
22-
description={t`Web encryption settings summary`}
23-
categoryDisplay={{
24-
fail: {
25-
name: t`Non-compliant TLS`,
26-
color: colors.weak,
27-
},
28-
pass: {
29-
name: t`Compliant TLS`,
30-
color: colors.strong,
31-
},
32-
}}
33-
data={web}
34-
/>
35-
<SummaryCard
36-
title={t`Email Configuration`}
37-
description={t`Email security settings summary`}
38-
categoryDisplay={{
39-
pass: {
40-
name: t`DMARC pass`,
41-
color: colors.strong,
42-
},
43-
fail: {
44-
name: t`DMARC fail`,
45-
color: colors.weak,
46-
},
47-
}}
48-
data={mail}
49-
/>
63+
{webCard}
64+
{mailCard}
5065
</SimpleGrid>
5166
)
5267
}

0 commit comments

Comments
 (0)