Skip to content

Commit

Permalink
feat(web): alert threshold UI support matches & contains (#1138)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikezzb authored Jul 29, 2023
1 parent 2886c26 commit 3c4a002
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@
required
name="target"
id="target"
[nzShowSearch]="true"
[nzOptions]="appHierarchies"
[(ngModel)]="cascadeValues"
(ngModelChange)="cascadeOnChange($event)"
Expand Down Expand Up @@ -182,7 +183,10 @@
<code>instance : {{ 'alert.setting.target.instance' | i18n }}</code>
</nz-list-item>
<nz-list-item>
<code>{{ 'alert.setting.operator' | i18n }} : equals(str1,str2), ==, <, <=, >, >=, !=, ( ), +, -, &&, ||</code>
<code>
{{ 'alert.setting.operator' | i18n }} : equals(str1,str2), contains(str1,str2), exists(keyName), matches(str,regex), ==,
<, <=, >, >=, !=, ( ), +, -, &&, ||
</code>
</nz-list-item>
</nz-list>
</nz-collapse-panel>
Expand Down Expand Up @@ -259,6 +263,26 @@
[nzValue]="'!equals'"
[nzLabel]="'alert.setting.rule.operator.str-no-equals' | i18n"
></nz-option>
<nz-option
*ngIf="!alertRule.metric || alertRule.metric.type === 1"
[nzValue]="'contains'"
[nzLabel]="'alert.setting.rule.operator.str-contains' | i18n"
></nz-option>
<nz-option
*ngIf="!alertRule.metric || alertRule.metric.type === 1"
[nzValue]="'!contains'"
[nzLabel]="'alert.setting.rule.operator.str-no-contains' | i18n"
></nz-option>
<nz-option
*ngIf="!alertRule.metric || alertRule.metric.type === 1"
[nzValue]="'matches'"
[nzLabel]="'alert.setting.rule.operator.str-matches' | i18n"
></nz-option>
<nz-option
*ngIf="!alertRule.metric || alertRule.metric.type === 1"
[nzValue]="'!matches'"
[nzLabel]="'alert.setting.rule.operator.str-no-matches' | i18n"
></nz-option>
</nz-select>
<input
nz-input
Expand All @@ -274,26 +298,26 @@
nzSpan="10"
/>
<button
*ngIf="i === alertRules.length - 1 && i < 4"
*ngIf="i != alertRules.length - 1 || i == 4"
nz-button
nzType="primary"
nz-col
nzSpan="2"
nzDanger
nzGhost="true"
(click)="onAddNewAlertRule()"
(click)="onRemoveAlertRule(i)"
>
<span nz-icon nzType="plus"></span>
<span nz-icon nzType="minus"></span>
</button>
<button
*ngIf="i != alertRules.length - 1 || i == 4"
*ngIf="i === alertRules.length - 1 && i < 4"
nz-button
nzType="primary"
nz-col
nzSpan="2"
nzDanger
nzGhost="true"
(click)="onRemoveAlertRule(i)"
(click)="onAddNewAlertRule()"
>
<span nz-icon nzType="minus"></span>
<span nz-icon nzType="plus"></span>
</button>
</div>
</div>
Expand Down
4 changes: 4 additions & 0 deletions web-app/src/assets/i18n/en-US.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
"alert.setting.rule.operator": "Operator",
"alert.setting.rule.operator.str-equals": "equals",
"alert.setting.rule.operator.str-no-equals": "not equals",
"alert.setting.rule.operator.str-contains": "contains",
"alert.setting.rule.operator.str-no-contains": "not contains",
"alert.setting.rule.operator.str-matches": "matches",
"alert.setting.rule.operator.str-no-matches": "not matches",
"alert.setting.rule.string-value.place-holder": "Please input string",
"alert.setting.rule.numeric-value.place-holder": "Please input numeric",
"alert.setting.times": "Trigger Times",
Expand Down
4 changes: 4 additions & 0 deletions web-app/src/assets/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
"alert.setting.rule.operator": "运算符",
"alert.setting.rule.operator.str-equals": "等于",
"alert.setting.rule.operator.str-no-equals": "不等于",
"alert.setting.rule.operator.str-contains": "包含",
"alert.setting.rule.operator.str-no-contains": "不包含",
"alert.setting.rule.operator.str-matches": "匹配",
"alert.setting.rule.operator.str-no-matches": "不匹配",
"alert.setting.rule.string-value.place-holder": "请输入匹配字符串",
"alert.setting.rule.numeric-value.place-holder": "请输入匹配数值",
"alert.setting.times": "触发次数",
Expand Down
4 changes: 4 additions & 0 deletions web-app/src/assets/i18n/zh-TW.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@
"alert.setting.rule.operator": "運算符",
"alert.setting.rule.operator.str-equals": "等於",
"alert.setting.rule.operator.str-no-equals": "不等於",
"alert.setting.rule.operator.str-contains": "包含",
"alert.setting.rule.operator.str-no-contains": "不包含",
"alert.setting.rule.operator.str-matches": "匹配",
"alert.setting.rule.operator.str-no-matches": "不匹配",
"alert.setting.rule.string-value.place-holder": "請輸入匹配字符串",
"alert.setting.rule.numeric-value.place-holder": "請輸入匹配數值",
"alert.setting.times": "觸發次數",
Expand Down

0 comments on commit 3c4a002

Please sign in to comment.