Skip to content

Commit

Permalink
bugfix threshold setting template variables has repeated parameters (#…
Browse files Browse the repository at this point in the history
…1223)

Co-authored-by: jimmy <jimmyqiao@augmentum.com.cn>
  • Loading branch information
qyaaaa and jimmy authored Sep 4, 2023
1 parent eae69df commit b710a9f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@
<nz-list-item *ngIf="cascadeValues.length == 3">
<code>&#36;{{ '{' + cascadeValues[2] + '}' }} : {{ 'alert.setting.template.metric-value' | i18n }}</code>
</nz-list-item>
<nz-list-item *ngFor="let item of currentMetrics">
<nz-list-item *ngFor="let item of filterMetrics(currentMetrics, cascadeValues)">
<code>&#36;{{ '{' + item.value + '}' }} : {{ 'alert.setting.template.other-value' | i18n }}</code>
</nz-list-item>
<nz-list-item *ngIf="cascadeValues.length == 3">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -653,5 +653,13 @@ export class AlertSettingComponent implements OnInit {
return e;
});
}
filterMetrics(currentMetrics: any[], cascadeValues: any): any[] {
// 检查是否需要过滤
if (cascadeValues.length !== 3) {
return currentMetrics;
}
// 过滤与cascadeValues[2]不相等的元素
return currentMetrics.filter(item => item.value !== cascadeValues[2]);
}
// end 告警定义与监控关联model
}

0 comments on commit b710a9f

Please sign in to comment.