import pluralize from 'pluralize';
import { Fragment } from 'react';
import * as React from 'react';
import { Badge, Stack } from '@grafana/ui';
interface Props {
active?: number;
suppressed?: number;
unprocessed?: number;
}
export const AlertGroupsSummary = ({ active = 0, suppressed = 0, unprocessed = 0 }: Props) => {
const statsComponents: React.ReactNode[] = [];
const total = active + suppressed + unprocessed;
if (active) {
statsComponents.push();
}
if (suppressed) {
statsComponents.push();
}
if (unprocessed) {
statsComponents.push();
}
// if we only have one category it's not really necessary to repeat the total
if (statsComponents.length > 1) {
statsComponents.unshift(
{total} {pluralize('instance', total)}
);
}
const hasStats = Boolean(statsComponents.length);
return hasStats ? {statsComponents} : null;
};