mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
# Backport This will backport the following commits from `main` to `8.x`: - [[Obs Alerts table] Fix error on clicking alert reason message (#193693)](https://github.com/elastic/kibana/pull/193693) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Bena Kansara","email":"69037875+benakansara@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-23T13:08:15Z","message":"[Obs Alerts table] Fix error on clicking alert reason message (#193693)\n\nResolves https://github.com/elastic/kibana/issues/193692","sha":"2304fb67365325bfcb530d3fa2a658544d8a7016","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","ci:project-deploy-observability","Team:obs-ux-management","v8.16.0","backport:version"],"title":"[Obs Alerts table] Fix error on clicking alert reason message","number":193693,"url":"https://github.com/elastic/kibana/pull/193693","mergeCommit":{"message":"[Obs Alerts table] Fix error on clicking alert reason message (#193693)\n\nResolves https://github.com/elastic/kibana/issues/193692","sha":"2304fb67365325bfcb530d3fa2a658544d8a7016"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193693","number":193693,"mergeCommit":{"message":"[Obs Alerts table] Fix error on clicking alert reason message (#193693)\n\nResolves https://github.com/elastic/kibana/issues/193692","sha":"2304fb67365325bfcb530d3fa2a658544d8a7016"}},{"branch":"8.x","label":"v8.16.0","branchLabelMappingKey":"^v8.16.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Bena Kansara <69037875+benakansara@users.noreply.github.com>
This commit is contained in:
parent
e3723fee29
commit
a460623ef0
1 changed files with 32 additions and 15 deletions
|
@ -89,7 +89,9 @@ export const mapRuleParamsWithFlyout = (alert: TopAlert): FlyoutThresholdData[]
|
|||
switch (ruleId) {
|
||||
case OBSERVABILITY_THRESHOLD_RULE_TYPE_ID:
|
||||
return observedValues.map((observedValue, metricIndex) => {
|
||||
const criteria = ruleCriteria[metricIndex] as CustomMetricExpressionParams;
|
||||
const criteria = Array.isArray(ruleCriteria)
|
||||
? (ruleCriteria[metricIndex] as CustomMetricExpressionParams)
|
||||
: (ruleCriteria as CustomMetricExpressionParams);
|
||||
const fields = criteria.metrics.map((metric) => metric.field || 'COUNT_AGG');
|
||||
const comparator = criteria.comparator;
|
||||
const threshold = criteria.threshold;
|
||||
|
@ -118,12 +120,20 @@ export const mapRuleParamsWithFlyout = (alert: TopAlert): FlyoutThresholdData[]
|
|||
|
||||
case METRIC_THRESHOLD_ALERT_TYPE_ID:
|
||||
return observedValues.map((observedValue, metricIndex) => {
|
||||
const criteria = ruleCriteria[metricIndex] as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetrics: Array<{
|
||||
field?: string;
|
||||
}>;
|
||||
};
|
||||
const criteria = Array.isArray(ruleCriteria)
|
||||
? (ruleCriteria[metricIndex] as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetrics: Array<{
|
||||
field?: string;
|
||||
}>;
|
||||
})
|
||||
: (ruleCriteria as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetrics: Array<{
|
||||
field?: string;
|
||||
}>;
|
||||
});
|
||||
|
||||
let fields: string[] = [];
|
||||
const metric = criteria.metric;
|
||||
const customMetric = criteria.customMetrics;
|
||||
|
@ -157,14 +167,21 @@ export const mapRuleParamsWithFlyout = (alert: TopAlert): FlyoutThresholdData[]
|
|||
|
||||
case METRIC_INVENTORY_THRESHOLD_ALERT_TYPE_ID:
|
||||
return observedValues.map((observedValue, metricIndex) => {
|
||||
const { threshold, customMetric, metric, comparator } = ruleCriteria[
|
||||
metricIndex
|
||||
] as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetric: {
|
||||
field: string;
|
||||
};
|
||||
};
|
||||
const criteria = Array.isArray(ruleCriteria)
|
||||
? (ruleCriteria[metricIndex] as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetric: {
|
||||
field: string;
|
||||
};
|
||||
})
|
||||
: (ruleCriteria as BaseMetricExpressionParams & {
|
||||
metric: string;
|
||||
customMetric: {
|
||||
field: string;
|
||||
};
|
||||
});
|
||||
|
||||
const { threshold, customMetric, metric, comparator } = criteria;
|
||||
const metricField = customMetric?.field || metric;
|
||||
const thresholdFormatted = threshold.map((thresholdToFormat) => {
|
||||
if (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue