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

Feature: Add aggregated negative findings summary list to org details #5812

5 changes: 5 additions & 0 deletions frontend/src/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ export function createCache() {
domains: relayStylePagination(),
},
},
OrganizationSummary: {
fields: {
negativeFindings: relayStylePagination(),
FestiveKyle marked this conversation as resolved.
Show resolved Hide resolved
},
},
MyTrackerResult: {
fields: {
domains: relayStylePagination(),
Expand Down
26 changes: 26 additions & 0 deletions frontend/src/graphql/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,32 @@ export const GET_HISTORICAL_ORG_SUMMARIES = gql`
${Summary.fragments.requiredFields}
`

export const ORG_NEGATIVE_FINDINGS = gql`
query OrgAggregatedNegativeGuidance($orgSlug: Slug!) {
findOrganizationBySlug(orgSlug: $orgSlug) {
summaries {
negativeFindings(orderBy: { direction: DESC, field: TAG_COUNT }) {
guidanceTags {
tagId
tagName
guidance
refLinks {
description
refLink
}
refLinksTech {
description
refLink
}
count
}
totalCount
}
}
}
}
`

export const PAGINATED_ORG_DOMAINS = gql`
query OrgDomainsNext(
$slug: Slug!
Expand Down
27 changes: 18 additions & 9 deletions frontend/src/guidance/GuidanceTagDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ export function GuidanceTagDetails({ guidanceTag, tagType }) {
negative: t`Negative`,
}

const tagTypeColor = {
positive: 'strong',
informative: 'info',
negative: 'weak',
}

const getTagCategoryFromId = (tagId) => {
return tagId.split(/[0-9]/)[0].toUpperCase()
}

const cccsGuidance =
guidanceTag.refLinks[0]?.description !== null && guidanceTag.refLinks.length !== 0 ? (
<Stack isInline={guidanceTag.refLinks.length <= 1}>
Expand Down Expand Up @@ -67,17 +77,16 @@ export function GuidanceTagDetails({ guidanceTag, tagType }) {

return (
<AccordionItem>
<Flex
align="center"
color={tagType === 'negative' ? 'weak' : tagType === 'positive' ? 'strong' : 'info'}
fontWeight="bold"
as={AccordionButton}
fontSize="lg"
>
<Flex align="center" color={tagTypeColor[tagType]} fontWeight="bold" as={AccordionButton} fontSize="lg">
{tagIcon()}
<Text ml="2">{guidanceTag.tagName}</Text>
<Text ml="2">
{guidanceTag?.count && `${getTagCategoryFromId(guidanceTag.tagId)}: `}
{guidanceTag.tagName}
</Text>
<AccordionIcon />
<Text ml="auto">{tagTypeList[tagType]?.toUpperCase()}</Text>
<Text ml="auto">
{guidanceTag?.count ? <Trans>{guidanceTag?.count} Findings</Trans> : tagTypeList[tagType]?.toUpperCase()}
</Text>
</Flex>
<AccordionPanel>
<Box>
Expand Down
Loading