From 48a5ef9ca9116e34c8522e8918197b2ea1f534fd Mon Sep 17 00:00:00 2001 From: jimmy Date: Mon, 4 Sep 2023 12:33:51 +0800 Subject: [PATCH 1/2] bugfix filter metrics --- .../alert/alert-setting/alert-setting.component.html | 2 +- .../routes/alert/alert-setting/alert-setting.component.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html index 8225428ff27..36bf6746355 100644 --- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html +++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.html @@ -380,7 +380,7 @@ ${{ '{' + cascadeValues[2] + '}' }} : {{ 'alert.setting.template.metric-value' | i18n }} - + ${{ '{' + item.value + '}' }} : {{ 'alert.setting.template.other-value' | i18n }} diff --git a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts index dcc7284d55a..c7fa065c579 100644 --- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts +++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts @@ -653,5 +653,13 @@ export class AlertSettingComponent implements OnInit { return e; }); } + filterMetrics(currentMetrics: any[], cascadeValues: any): any[] { + // 检查是否需要过滤 + if (cascadeValues.length !== 3) { + return currentMetrics; + } + // 过滤与 valueToFilter 不相等的元素 + return currentMetrics.filter(item => item.value !== cascadeValues[2]); + } // end 告警定义与监控关联model } From 24fe694a53a94b3df9fc68578c3169173e7cd868 Mon Sep 17 00:00:00 2001 From: jimmy Date: Mon, 4 Sep 2023 12:35:48 +0800 Subject: [PATCH 2/2] fix --- .../app/routes/alert/alert-setting/alert-setting.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts index c7fa065c579..2c5b59d93c6 100644 --- a/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts +++ b/web-app/src/app/routes/alert/alert-setting/alert-setting.component.ts @@ -658,7 +658,7 @@ export class AlertSettingComponent implements OnInit { if (cascadeValues.length !== 3) { return currentMetrics; } - // 过滤与 valueToFilter 不相等的元素 + // 过滤与cascadeValues[2]不相等的元素 return currentMetrics.filter(item => item.value !== cascadeValues[2]); } // end 告警定义与监控关联model