Skip to content

Commit 800103a

Browse files
committed
feat(add-after-event): update operator selection logic based on field type
1 parent 115c534 commit 800103a

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

frontend/src/app/rule-management/app-rule/components/add-after-event/add-after-event.component.html

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@
181181
<label class="form-label text-muted small">Operator</label>
182182
<ng-select
183183
formControlName="operator"
184-
[items]="operators"
184+
[items]="getOperators(expr.get('field').value)"
185+
bindLabel="label"
186+
bindValue="value"
185187
class="w-100"
186188
placeholder="Choose"
187189
></ng-select>

frontend/src/app/rule-management/app-rule/components/add-after-event/add-after-event.component.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,17 @@ export class AddAfterEventComponent implements OnInit {
110110
);
111111
}
112112

113+
getOperators(field: string) {
114+
const fieldName = field || '';
115+
const hasKeyword = fieldName.includes('.keyword');
116+
117+
return hasKeyword ? this.allOperators.keyword : this.allOperators.text;
118+
}
119+
113120
onFieldChange($event: any, index: number) {
114121
const fieldName = $event.name || '';
115-
const hasKeyword = fieldName.includes('.keyword');
116122

117-
this.operators = hasKeyword ? this.allOperators.keyword : this.allOperators.text;
123+
this.operators = this.getOperators(fieldName);
118124

119125
const control = this.with.at(index);
120126
control.get('operator').reset();

0 commit comments

Comments
 (0)