import * as React from 'react'; import { Flex } from '@patternfly/react-core'; import { CheckCircleIcon } from '@patternfly/react-icons/dist/esm/icons/check-circle-icon'; import { CubesIcon } from '@patternfly/react-icons/dist/esm/icons/cubes-icon'; import { ExclamationCircleIcon } from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon'; import { t_global_icon_color_status_danger_default as dangerColor } from '@patternfly/react-tokens/dist/js/t_global_icon_color_status_danger_default'; import { t_global_icon_color_status_success_default as successColor } from '@patternfly/react-tokens/dist/js/t_global_icon_color_status_success_default'; import { t_global_icon_color_subtle as subtleColor } from '@patternfly/react-tokens/dist/js/t_global_icon_color_subtle'; import { WarningIcon } from '~/shared/components/status/icons'; import { ConformaSummaryBarSection, type ConformaSummaryBarSectionProps, } from '../ConformaSummaryBarSection'; type ConformaSummaryBarProps = { totalComponents: number; totalFailed: number; totalViolations: number; totalWarnings: number; totalSuccesses: number; /** * Rules reporting an upcoming or expired policy change — a strict subset of * the warnings, see `countPolicyChanges`. */ totalPolicyChanges: number; totalViolationsRaw?: number; totalWarningsRaw?: number; totalSuccessesRaw?: number; totalPolicyChangesRaw?: number; }; export const ConformaSummaryBar: React.FC = ({ totalComponents, totalFailed, totalViolations, totalWarnings, totalSuccesses, totalPolicyChanges, totalWarningsRaw, totalSuccessesRaw, totalViolationsRaw, totalPolicyChangesRaw, }) => { const sections: ConformaSummaryBarSectionProps[] = [ { title: 'Components', 'data-test': 'conforma-summary-components', items: [ { icon: , count: totalComponents, label: 'total', tooltip: 'Total number of components scanned', }, { icon: , count: totalFailed, label: 'failed', tooltip: 'Components with at least one violation', }, ], }, { title: 'Upcoming changes', 'data-test': 'conforma-summary-upcoming-changes', items: [ { icon: , count: totalPolicyChanges, rawCount: totalPolicyChangesRaw, label: 'policy changes', tooltip: 'Rules that start being enforced on a future date, plus exceptions that are expiring or have already expired', }, ], }, { title: 'Results summary', 'data-test': 'conforma-summary-results', items: [ { icon: , count: totalViolations, rawCount: totalViolationsRaw, label: 'violations', tooltip: 'Rules that failed validation', }, { icon: , count: totalWarnings, rawCount: totalWarningsRaw, label: 'warnings', tooltip: 'Rules with warnings', }, { icon: , count: totalSuccesses, rawCount: totalSuccessesRaw, label: 'success', tooltip: 'Rules that passed validation', }, ], }, ]; return ( {sections.map((section) => ( ))} ); };