<ng-container *ngFor="let config of matcherConfig">
<div class="input-group-prepend">
<span class="input-group-text"
+ *ngIf="config.attribute === 'isRegex'"
[ngbTooltip]="config.tooltip">
- <i [ngClass]="[config.icon]"></i>
+ <i *ngIf="matcher[config.attribute]">~</i>
+ <i *ngIf="!matcher[config.attribute]">=</i>
</span>
</div>
disabled
readonly>
</ng-container>
-
- <ng-container *ngIf="config.attribute === 'isRegex'">
- <div class="input-group-append">
- <div class="input-group-text">
- <input type="checkbox"
- id="matcher-{{config.attribute}}-{{index}}"
- [checked]="matcher[config.attribute]"
- disabled
- readonly>
- </div>
- </div>
- </ng-container>
</ng-container>
<!-- Matcher actions -->
it('should show added matcher', () => {
addMatcher('job', 'someJob', true);
fixtureH.expectIdElementsVisible(
- [
- 'matcher-name-0',
- 'matcher-value-0',
- 'matcher-isRegex-0',
- 'matcher-edit-0',
- 'matcher-delete-0'
- ],
+ ['matcher-name-0', 'matcher-value-0', 'matcher-edit-0', 'matcher-delete-0'],
true
);
expectMatch(null);
[
'matcher-name-0',
'matcher-value-0',
- 'matcher-isRegex-0',
'matcher-edit-0',
'matcher-delete-0',
'matcher-name-1',
'matcher-value-1',
- 'matcher-isRegex-1',
'matcher-edit-1',
'matcher-delete-1'
],
fixture.detectChanges();
fixtureH.expectFormFieldToBe('#matcher-name-0', 'alertname');
fixtureH.expectFormFieldToBe('#matcher-value-0', 'alert.*');
- fixtureH.expectFormFieldToBe('#matcher-isRegex-0', 'true');
- fixtureH.expectFormFieldToBe('#matcher-isRegex-1', 'false');
expectMatch(null);
});
fixtureH.expectFormFieldToBe('#matcher-name-0', 'alertname');
fixtureH.expectFormFieldToBe('#matcher-value-0', 'alert0');
- fixtureH.expectFormFieldToBe('#matcher-isRegex-0', 'false');
expectMatch('Matches 1 rule with 1 active alert.');
});
matcherConfig = [
{
tooltip: $localize`Attribute name`,
- icon: this.icons.paragraph,
attribute: 'name'
},
- {
- tooltip: $localize`Value`,
- icon: this.icons.terminal,
- attribute: 'value'
- },
{
tooltip: $localize`Regular expression`,
- icon: this.icons.magic,
attribute: 'isRegex'
+ },
+ {
+ tooltip: $localize`Value`,
+ attribute: 'value'
}
];