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

# Backport

This will backport the following commits from `main` to `8.7`:
- [[BUG] [AO] - Fix alert evaluation value format in the alert flyout
(#150720)](https://github.com/elastic/kibana/pull/150720)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Faisal
Kanout","email":"faisal.kanout@elastic.co"},"sourceCommit":{"committedDate":"2023-02-14T09:04:24Z","message":"[BUG]
[AO] - Fix alert evaluation value format in the alert flyout
(#150720)\n\n## Summary\r\n\r\nIt closes #101945 \r\nIt closes
#150857\r\nby using the formatter from the Observability plugin.
\r\n\r\n\r\n### Before\r\n### ms\r\n<img width=\"644\" alt=\"Screenshot
2023-02-09 at 15 49
12\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846452-de9b1440-ec60-4700-a3eb-71c6e9a81e08.png\">\r\n\r\n###
%\r\n<img width=\"643\" alt=\"Screenshot 2023-02-10 at 12 28
34\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090682-af90e158-7e97-4c7f-a813-356213ec1322.png\">\r\n\r\n###
After\r\n\r\n### ms\r\n<img width=\"641\" alt=\"Screenshot 2023-02-09 at
15 48
58\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846507-13d21e3c-43a6-4bf9-bb3c-e559aa5b1905.png\">\r\n\r\n###
%\r\n<img width=\"626\" alt=\"Screenshot 2023-02-10 at 13 17
20\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090805-93c39c82-2ec5-4911-9b92-c935053a056e.png\">","sha":"ea646dfe04799775de988dfb34248001e23e4437","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:
Actionable
Observability","v8.7.0","v8.8.0"],"number":150720,"url":"https://github.com/elastic/kibana/pull/150720","mergeCommit":{"message":"[BUG]
[AO] - Fix alert evaluation value format in the alert flyout
(#150720)\n\n## Summary\r\n\r\nIt closes #101945 \r\nIt closes
#150857\r\nby using the formatter from the Observability plugin.
\r\n\r\n\r\n### Before\r\n### ms\r\n<img width=\"644\" alt=\"Screenshot
2023-02-09 at 15 49
12\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846452-de9b1440-ec60-4700-a3eb-71c6e9a81e08.png\">\r\n\r\n###
%\r\n<img width=\"643\" alt=\"Screenshot 2023-02-10 at 12 28
34\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090682-af90e158-7e97-4c7f-a813-356213ec1322.png\">\r\n\r\n###
After\r\n\r\n### ms\r\n<img width=\"641\" alt=\"Screenshot 2023-02-09 at
15 48
58\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846507-13d21e3c-43a6-4bf9-bb3c-e559aa5b1905.png\">\r\n\r\n###
%\r\n<img width=\"626\" alt=\"Screenshot 2023-02-10 at 13 17
20\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090805-93c39c82-2ec5-4911-9b92-c935053a056e.png\">","sha":"ea646dfe04799775de988dfb34248001e23e4437"}},"sourceBranch":"main","suggestedTargetBranches":["8.7"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150720","number":150720,"mergeCommit":{"message":"[BUG]
[AO] - Fix alert evaluation value format in the alert flyout
(#150720)\n\n## Summary\r\n\r\nIt closes #101945 \r\nIt closes
#150857\r\nby using the formatter from the Observability plugin.
\r\n\r\n\r\n### Before\r\n### ms\r\n<img width=\"644\" alt=\"Screenshot
2023-02-09 at 15 49
12\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846452-de9b1440-ec60-4700-a3eb-71c6e9a81e08.png\">\r\n\r\n###
%\r\n<img width=\"643\" alt=\"Screenshot 2023-02-10 at 12 28
34\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090682-af90e158-7e97-4c7f-a813-356213ec1322.png\">\r\n\r\n###
After\r\n\r\n### ms\r\n<img width=\"641\" alt=\"Screenshot 2023-02-09 at
15 48
58\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/217846507-13d21e3c-43a6-4bf9-bb3c-e559aa5b1905.png\">\r\n\r\n###
%\r\n<img width=\"626\" alt=\"Screenshot 2023-02-10 at 13 17
20\"\r\nsrc=\"https://user-images.githubusercontent.com/6838659/218090805-93c39c82-2ec5-4911-9b92-c935053a056e.png\">","sha":"ea646dfe04799775de988dfb34248001e23e4437"}}]}]
BACKPORT-->

Co-authored-by: Faisal Kanout <faisal.kanout@elastic.co>
This commit is contained in:
Kibana Machine 2023-02-14 05:10:07 -05:00 committed by GitHub
parent 1f065db062
commit 31b85a8103
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',
];