import * as React from 'react'; import { Alert, AlertVariant, Card, CardBody, CardTitle } from '@patternfly/react-core'; import { OutlinedClockIcon } from '@patternfly/react-icons/dist/esm/icons/outlined-clock-icon'; import { t_global_icon_color_subtle as subtleColor } from '@patternfly/react-tokens/dist/js/t_global_icon_color_subtle'; import { ConformaSummaryBarSection } from '~/components/Conforma/ConformaSummaryBarSection'; import { countExceptionsByKind, PolicyExceptionKind, } from '~/components/Conforma/policy-exception-utils'; import { PolicyExceptionList } from '~/components/Conforma/PolicyExceptionList'; import { LoadingSkeleton } from '~/shared'; import { WarningIcon } from '~/shared/components/status/icons'; import { getErrorState } from '~/shared/utils/error-utils'; import { useWorkspaceConformaViolations } from './useWorkspaceConformaViolations'; const IssuesPolicyExceptionCard: React.FC = () => { const { exceptions, loaded, settling, error, partialError } = useWorkspaceConformaViolations(); // While settling, keep the skeleton until at least one exception arrives so // the summary never flashes a premature "0 expiring exceptions". const showSkeleton = !loaded || (settling && exceptions.length === 0); return ( ECP Policy Warnings {error ? ( getErrorState(error, loaded, 'policy results', true) ) : showSkeleton ? ( ) : ( <> , count: countExceptionsByKind(exceptions, PolicyExceptionKind.EXPIRING), label: 'expiring exceptions', tooltip: 'Policy exceptions that lapse soon, after which the rule is enforced', }, { icon: , count: countExceptionsByKind(exceptions, PolicyExceptionKind.UPCOMING), label: 'upcoming activations', tooltip: 'Policy rules that start being enforced on a future date', }, ]} /> )} {loaded && !error && partialError && ( {partialError instanceof Error && partialError.message ? partialError.message : 'One or more policy result fetches failed. Upcoming policy changes shown may be incomplete.'} )} ); }; export default IssuesPolicyExceptionCard;