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 class="form-control"
119 formControlName="startsAt"
120 [ngbPopover]="popStart"
124 (keypress)="ps.close()">
125 <span *ngIf="form.showError('startsAt', formDir, 'required')"
126 class="invalid-feedback"
127 i18n>This field is required!</span>
132 <div class="form-group row">
133 <label class="cd-col-form-label required"
135 i18n>Duration</label>
136 <div class="cd-col-form-input">
137 <input class="form-control"
138 formControlName="duration"
142 <span *ngIf="form.showError('duration', formDir, 'required')"
143 class="invalid-feedback"
144 i18n>This field is required!</span>
149 <div class="form-group row">
150 <label class="cd-col-form-label required"
152 i18n>End time</label>
153 <div class="cd-col-form-input">
154 <input class="form-control"
155 formControlName="endsAt"
156 [ngbPopover]="popEnd"
160 (keypress)="pe.close()">
161 <span *ngIf="form.showError('endsAt', formDir, 'required')"
162 class="invalid-feedback"
163 i18n>This field is required!</span>
169 <legend class="required"
170 i18n>Matchers</legend>
172 <div class="cd-col-form-offset">
173 <h5 *ngIf="matchers.length === 0"
174 [ngClass]="{'text-warning': !formDir.submitted, 'text-danger': formDir.submitted}">
175 <strong i18n>A silence requires at least one matcher</strong>
178 <span *ngFor="let matcher of matchers; let i=index;">
179 <ng-container *ngTemplateOutlet="matcherTpl; context:{index: i, matcher: matcher}"></ng-container>
184 <button type="button"
186 class="btn btn-light float-right my-3"
187 [ngClass]="{'btn-warning': formDir.submitted && matchers.length === 0 }"
188 (click)="showMatcherModal()">
189 <i [ngClass]="[icons.add]"></i>
190 <ng-container i18n>Add matcher</ng-container>
196 <div *ngIf="matchers.length && matcherMatch"
197 class="cd-col-form-offset {{matcherMatch.cssClass}}"
199 <span class="text-muted {{matcherMatch.cssClass}}">
200 {{ matcherMatch.status }}
206 <div class="card-footer">
207 <div class="text-right">
208 <cd-form-button-panel (submitActionEvent)="submit()"
210 [submitText]="(action | titlecase) + ' ' + (resource | upperFirst)"></cd-form-button-panel>
217 <ng-template #popStart>
218 <cd-date-time-picker [control]="form.get('startsAt')"
219 [hasSeconds]="false"></cd-date-time-picker>
223 <ng-template #popEnd>
224 <cd-date-time-picker [control]="form.get('endsAt')"
225 [hasSeconds]="false"></cd-date-time-picker>