[BUG] [AO] - Fix alert evaluation value format in the alert flyout (#150720)

## Summary

It closes #101945 
It closes #150857
by using the formatter from the Observability plugin. 


### Before
### ms
<img width="644" alt="Screenshot 2023-02-09 at 15 49 12"
src="https://user-images.githubusercontent.com/6838659/217846452-de9b1440-ec60-4700-a3eb-71c6e9a81e08.png">

### %
<img width="643" alt="Screenshot 2023-02-10 at 12 28 34"
src="https://user-images.githubusercontent.com/6838659/218090682-af90e158-7e97-4c7f-a813-356213ec1322.png">

### After

### ms
<img width="641" alt="Screenshot 2023-02-09 at 15 48 58"
src="https://user-images.githubusercontent.com/6838659/217846507-13d21e3c-43a6-4bf9-bb3c-e559aa5b1905.png">

### %
<img width="626" alt="Screenshot 2023-02-10 at 13 17 20"
src="https://user-images.githubusercontent.com/6838659/218090805-93c39c82-2ec5-4911-9b92-c935053a056e.png">
This commit is contained in:
Faisal Kanout 2023-02-14 10:04:24 +01:00 committed by GitHub
parent ace5c10c2c
commit ea646dfe04
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 4 deletions

View file

@ -21,6 +21,7 @@ import {
ALERT_EVALUATION_VALUE,
ALERT_FLAPPING,
ALERT_RULE_CATEGORY,
ALERT_RULE_TYPE_ID,
ALERT_RULE_UUID,
ALERT_STATUS_ACTIVE,
ALERT_STATUS_RECOVERED,
@ -32,6 +33,7 @@ import { RULE_DETAILS_PAGE_ID } from '../../../rule_details/constants';
import { asDuration } from '../../../../../common/utils/formatters';
import { translations, paths } from '../../../../config';
import { FlyoutProps } from './types';
import { formatAlertEvaluationValue } from '../../../../utils/format_alert_evaluation_value';
// eslint-disable-next-line import/no-default-export
export default function AlertsFlyoutBody({ alert, id: pageId }: FlyoutProps) {
@ -74,11 +76,17 @@ export default function AlertsFlyoutBody({ alert, id: pageId }: FlyoutProps) {
},
{
title: translations.alertsFlyout.expectedValueLabel,
description: alert.fields[ALERT_EVALUATION_THRESHOLD] ?? '-',
description: formatAlertEvaluationValue(
alert.fields[ALERT_RULE_TYPE_ID],
alert.fields[ALERT_EVALUATION_THRESHOLD]
),
},
{
title: translations.alertsFlyout.actualValueLabel,
description: alert.fields[ALERT_EVALUATION_VALUE] ?? '-',
description: formatAlertEvaluationValue(
alert.fields[ALERT_RULE_TYPE_ID],
alert.fields[ALERT_EVALUATION_VALUE]
),
},
{
title: translations.alertsFlyout.ruleTypeLabel,

View file

@ -170,8 +170,8 @@ export default ({ getService }: FtrProviderContext) => {
'Oct 19, 2021 @ 15:00:41.555',
'Oct 19, 2021 @ 15:20:38.749',
'20 minutes',
'5',
'30.73',
'5.0%',
'31%',
'Failed transaction rate threshold',
];