1 <ng-template #matcherTpl
4 <div class="input-group my-2">
5 <ng-container *ngFor="let config of matcherConfig">
6 <div class="input-group-prepend">
7 <span class="input-group-text"
8 [ngbTooltip]="config.tooltip">
9 <i [ngClass]="[config.icon]"></i>
13 <ng-container *ngIf="config.attribute !== 'isRegex'">
15 id="matcher-{{config.attribute}}-{{index}}"
17 [value]="matcher[config.attribute]"
22 <ng-container *ngIf="config.attribute === 'isRegex'">
23 <div class="input-group-append">
24 <div class="input-group-text">
25 <input type="checkbox"
26 id="matcher-{{config.attribute}}-{{index}}"
27 [checked]="matcher[config.attribute]"
35 <!-- Matcher actions -->
36 <span class="input-group-append">
39 id="matcher-edit-{{index}}"
42 (click)="showMatcherModal(index)">
43 <i [ngClass]="[icons.edit]"></i>
47 id="matcher-delete-{{index}}"
50 (click)="deleteMatcher(index)">
51 <i [ngClass]="[icons.trash]"></i>
55 <span class="help-block"></span>
58 <div class="cd-col-form">
59 <form #formDir="ngForm"
65 <div class="card-header">
66 <span i18n="@@formTitle">
67 {{ action | titlecase }} {{ resource | upperFirst }}
69 <cd-helper *ngIf="edit"
70 i18n>Editing a silence will expire the old silence and recreate it as a new silence</cd-helper>
74 <div class="card-body">
75 <div class="form-group row">
76 <label class="cd-col-form-label required"
79 <div class="cd-col-form-input">
80 <input class="form-control"
81 formControlName="createdBy"
85 <span *ngIf="form.showError('createdBy', formDir, 'required')"
86 class="invalid-feedback"
87 i18n>This field is required!</span>
92 <div class="form-group row">
93 <label class="cd-col-form-label required"
96 <div class="cd-col-form-input">
97 <textarea class="form-control"
98 formControlName="comment"
103 <span *ngIf="form.showError('comment', formDir, 'required')"
104 class="invalid-feedback"
105 i18n>This field is required!</span>
110 <div class="form-group row">
111 <label class="cd-col-form-label"
113 <span class="required"
114 i18n>Start time</span>
115 <cd-helper i18n>If the start time lies in the past the creation time will be used</cd-helper>
117 <div class="cd-col-form-input">
118 <input [bsConfig]="bsConfig"
121 formControlName="startsAt"
124 <span *ngIf="form.showError('startsAt', formDir, 'required')"
125 class="invalid-feedback"
126 i18n>This field is required!</span>
131 <div class="form-group row">
132 <label class="cd-col-form-label required"
134 i18n>Duration</label>
135 <div class="cd-col-form-input">
136 <input class="form-control"
137 formControlName="duration"
141 <span *ngIf="form.showError('duration', formDir, 'required')"
142 class="invalid-feedback"
143 i18n>This field is required!</span>
148 <div class="form-group row">
149 <label class="cd-col-form-label required"
151 i18n>End time</label>
152 <div class="cd-col-form-input">
153 <input [bsConfig]="bsConfig"
156 formControlName="endsAt"
159 <span *ngIf="form.showError('endsAt', formDir, 'required')"
160 class="invalid-feedback"
161 i18n>This field is required!</span>
167 <legend class="required"
168 i18n>Matchers</legend>
170 <div class="cd-col-form-offset">
171 <h5 *ngIf="matchers.length === 0"
172 [ngClass]="{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
173 <strong i18n>A silence requires at least one matcher</strong>
176 <span *ngFor="let matcher of matchers; let i=index;">
177 <ng-container *ngTemplateOutlet="matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
182 <button type="button"
184 class="btn btn-light float-right my-3"
185 [ngClass]="{'btn-warning': formDir.submitted && matchers.length === 0 }"
186 (click)="showMatcherModal()">
187 <i [ngClass]="[icons.add]"></i>
188 <ng-container i18n>Add matcher</ng-container>
194 <div *ngIf="matchers.length && matcherMatch"
195 class="cd-col-form-offset {{matcherMatch.cssClass}}"
197 <span class="text-muted {{matcherMatch.cssClass}}">
198 {{ matcherMatch.status }}
204 <div class="card-footer">
205 <div class="text-right">
206 <cd-submit-button (submitAction)="submit()"
209 {{ action | titlecase }} {{ resource | upperFirst }}
211 <cd-back-button></cd-back-button>