mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
This commit is contained in:
parent
3d4521b32e
commit
8792ca1b13
1 changed files with 11 additions and 3 deletions
|
@ -19,13 +19,18 @@ import { getAlertPanelsByCategory } from './lib/get_alert_panels_by_category';
|
|||
import { getAlertPanelsByNode } from './lib/get_alert_panels_by_node';
|
||||
|
||||
export const numberOfAlertsLabel = (count: number) => `${count} alert${count > 1 ? 's' : ''}`;
|
||||
export const numberOfRulesLabel = (count: number) => `${count} rule${count > 1 ? 's' : ''}`;
|
||||
|
||||
const MAX_TO_SHOW_BY_CATEGORY = 8;
|
||||
|
||||
const PANEL_TITLE = i18n.translate('xpack.monitoring.alerts.badge.panelTitle', {
|
||||
const PANEL_TITLE_ALERTS = i18n.translate('xpack.monitoring.alerts.badge.panelTitle', {
|
||||
defaultMessage: 'Alerts',
|
||||
});
|
||||
|
||||
const PANEL_TITLE_RULES = i18n.translate('xpack.monitoring.rules.badge.panelTitle', {
|
||||
defaultMessage: 'Rules',
|
||||
});
|
||||
|
||||
const GROUP_BY_NODE = i18n.translate('xpack.monitoring.alerts.badge.groupByNode', {
|
||||
defaultMessage: 'Group by node',
|
||||
});
|
||||
|
@ -54,6 +59,7 @@ export const AlertsBadge: React.FC<Props> = (props: Props) => {
|
|||
const [showByNode, setShowByNode] = React.useState(
|
||||
!inSetupMode && alertCount > MAX_TO_SHOW_BY_CATEGORY
|
||||
);
|
||||
const PANEL_TITLE = inSetupMode ? PANEL_TITLE_RULES : PANEL_TITLE_ALERTS;
|
||||
|
||||
React.useEffect(() => {
|
||||
if (inSetupMode && showByNode) {
|
||||
|
@ -93,10 +99,12 @@ export const AlertsBadge: React.FC<Props> = (props: Props) => {
|
|||
<EuiBadge
|
||||
iconType="bell"
|
||||
color={inSetupMode ? 'default' : 'danger'}
|
||||
onClickAriaLabel={numberOfAlertsLabel(alertCount)}
|
||||
onClickAriaLabel={
|
||||
inSetupMode ? numberOfRulesLabel(alertCount) : numberOfAlertsLabel(alertCount)
|
||||
}
|
||||
onClick={() => setShowPopover(true)}
|
||||
>
|
||||
{numberOfAlertsLabel(alertCount)}
|
||||
{inSetupMode ? numberOfRulesLabel(alertCount) : numberOfAlertsLabel(alertCount)}
|
||||
</EuiBadge>
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue